summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2013-04-18 18:23:51 (GMT)
committerVailin Choi <vchoi@hdfgroup.org>2013-04-18 18:23:51 (GMT)
commit6ee0e05fb94445551840fcb80b9b1c254c736799 (patch)
tree0acf68cdc69dae2ff0e2a72b36e4efb6f8fbfd06 /src
parent94f89911545edce6fc9ebde2c83357cbda0bbd70 (diff)
downloadhdf5-6ee0e05fb94445551840fcb80b9b1c254c736799.zip
hdf5-6ee0e05fb94445551840fcb80b9b1c254c736799.tar.gz
hdf5-6ee0e05fb94445551840fcb80b9b1c254c736799.tar.bz2
[svn-r23599] Bring revisions 22802 : 23085 from trunk to revise_chunks.
h5committested.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/H5AC.c22
-rw-r--r--src/H5ACprivate.h32
-rw-r--r--src/H5Dmpio.c304
-rw-r--r--src/H5Dprivate.h4
-rw-r--r--src/H5Edefin.h4
-rw-r--r--src/H5Einit.h4
-rw-r--r--src/H5Eint.c4
-rw-r--r--src/H5Epubgen.h4
-rw-r--r--src/H5Eterm.h2
-rw-r--r--src/H5FDcore.c2
-rw-r--r--src/H5FDdirect.c9
-rw-r--r--src/H5FDfamily.c4
-rw-r--r--src/H5FDlog.c18
-rw-r--r--src/H5FDmpio.c4
-rw-r--r--src/H5FDmpiposix.c4
-rw-r--r--src/H5Fprivate.h70
-rw-r--r--src/H5Fsfile.c8
-rw-r--r--src/H5P.c88
-rw-r--r--src/H5Pdapl.c16
-rw-r--r--src/H5Pdcpl.c536
-rw-r--r--src/H5Pdeprec.c5
-rw-r--r--src/H5Pdxpl.c798
-rw-r--r--src/H5Pencdec.c813
-rw-r--r--src/H5Pfapl.c717
-rw-r--r--src/H5Pfcpl.c389
-rw-r--r--src/H5Pfmpl.c14
-rw-r--r--src/H5Pgcpl.c199
-rw-r--r--src/H5Pint.c262
-rw-r--r--src/H5Plapl.c273
-rw-r--r--src/H5Plcpl.c11
-rw-r--r--src/H5Pocpl.c222
-rw-r--r--src/H5Pocpypl.c157
-rw-r--r--src/H5Ppkg.h32
-rw-r--r--src/H5Pprivate.h1
-rw-r--r--src/H5Ppublic.h7
-rw-r--r--src/H5Pstrcpl.c87
-rw-r--r--src/H5T.c8
-rw-r--r--src/H5Tconv.c80
-rw-r--r--src/H5Tpkg.h4
-rw-r--r--src/H5Tprivate.h2
-rw-r--r--src/H5detect.c21
-rw-r--r--src/H5err.txt6
-rw-r--r--src/H5public.h4
-rw-r--r--src/H5trace.c4
-rw-r--r--src/Makefile.am3
-rw-r--r--src/Makefile.in14
47 files changed, 4716 insertions, 557 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 65a575b..3cbfe7e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -470,6 +470,7 @@ SET (H5P_SRCS
${HDF5_SRC_DIR}/H5Pdcpl.c
${HDF5_SRC_DIR}/H5Pdeprec.c
${HDF5_SRC_DIR}/H5Pdxpl.c
+ ${HDF5_SRC_DIR}/H5Pencdec.c
${HDF5_SRC_DIR}/H5Pfapl.c
${HDF5_SRC_DIR}/H5Pfcpl.c
${HDF5_SRC_DIR}/H5Pfmpl.c
diff --git a/src/H5AC.c b/src/H5AC.c
index abbacce..18289e7 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -129,7 +129,7 @@ static herr_t H5AC_ext_config_2_int_config(H5AC_cache_config_t * ext_conf_ptr,
H5C_auto_size_ctl_t * int_conf_ptr);
#if H5AC_DO_TAGGING_SANITY_CHECKS
-static herr_t H5AC_verify_tag(hid_t dxpl_id, H5AC_class_t * type);
+static herr_t H5AC_verify_tag(hid_t dxpl_id, const H5AC_class_t * type);
#endif /* H5AC_DO_TAGGING_SANITY_CHECKS */
#ifdef H5_HAVE_PARALLEL
@@ -286,11 +286,13 @@ H5AC_init_interface(void)
/* Insert 'block before metadata write' property */
block_before_meta_write=1;
- if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write,
+ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property")
/* Insert 'library internal' property */
- if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal,
+ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property")
/* Set the transfer mode */
@@ -308,11 +310,13 @@ H5AC_init_interface(void)
/* Insert 'block before metadata write' property */
block_before_meta_write=0;
- if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write,
+ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property")
/* Insert 'library internal' property */
- if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal,
+ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property")
/* Set the transfer mode */
@@ -330,11 +334,13 @@ H5AC_init_interface(void)
/* Insert 'block before metadata write' property */
block_before_meta_write=0;
- if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write,
+ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property")
/* Insert 'library internal' property */
- if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal,
+ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property")
/* Set the transfer mode */
@@ -5408,7 +5414,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5AC_verify_tag(hid_t dxpl_id, H5AC_class_t * type)
+H5AC_verify_tag(hid_t dxpl_id, const H5AC_class_t * type)
{
H5C_tag_t tag;
H5P_genplist_t * dxpl;
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index 6bf7bd7..16a28f9 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -241,27 +241,27 @@ H5_DLLVAR hid_t H5AC_ind_dxpl_id;
/* hbool_t evictions_enabled = */ TRUE, \
/* hbool_t set_initial_size = */ TRUE, \
/* size_t initial_size = */ ( 2 * 1024 * 1024), \
- /* double min_clean_fraction = */ 0.3, \
+ /* double min_clean_fraction = */ 0.3f, \
/* size_t max_size = */ (32 * 1024 * 1024), \
/* size_t min_size = */ (1 * 1024 * 1024), \
/* long int epoch_length = */ 50000, \
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, \
- /* double lower_hr_threshold = */ 0.9, \
- /* double increment = */ 2.0, \
+ /* double lower_hr_threshold = */ 0.9f, \
+ /* double increment = */ 2.0f, \
/* hbool_t apply_max_increment = */ TRUE, \
/* size_t max_increment = */ (4 * 1024 * 1024), \
/* enum H5C_cache_flash_incr_mode */ \
/* flash_incr_mode = */ H5C_flash_incr__add_space, \
- /* double flash_multiple = */ 1.0, \
- /* double flash_threshold = */ 0.25, \
+ /* double flash_multiple = */ 1.0f, \
+ /* double flash_threshold = */ 0.25f, \
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, \
- /* double upper_hr_threshold = */ 0.999, \
- /* double decrement = */ 0.9, \
+ /* double upper_hr_threshold = */ 0.999f, \
+ /* double decrement = */ 0.9f, \
/* hbool_t apply_max_decrement = */ TRUE, \
/* size_t max_decrement = */ (1 * 1024 * 1024), \
/* int epochs_before_eviction = */ 3, \
/* hbool_t apply_empty_reserve = */ TRUE, \
- /* double empty_reserve = */ 0.1, \
+ /* double empty_reserve = */ 0.1f, \
/* int dirty_bytes_threshold = */ (256 * 1024), \
/* int metadata_write_strategy = */ \
H5AC__DEFAULT_METADATA_WRITE_STRATEGY \
@@ -277,27 +277,27 @@ H5_DLLVAR hid_t H5AC_ind_dxpl_id;
/* hbool_t evictions_enabled = */ TRUE, \
/* hbool_t set_initial_size = */ TRUE, \
/* size_t initial_size = */ ( 2 * 1024 * 1024), \
- /* double min_clean_fraction = */ 0.01, \
+ /* double min_clean_fraction = */ 0.01f, \
/* size_t max_size = */ (32 * 1024 * 1024), \
/* size_t min_size = */ ( 1 * 1024 * 1024), \
/* long int epoch_length = */ 50000, \
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, \
- /* double lower_hr_threshold = */ 0.9, \
- /* double increment = */ 2.0, \
+ /* double lower_hr_threshold = */ 0.9f, \
+ /* double increment = */ 2.0f, \
/* hbool_t apply_max_increment = */ TRUE, \
/* size_t max_increment = */ (4 * 1024 * 1024), \
/* enum H5C_cache_flash_incr_mode */ \
/* flash_incr_mode = */ H5C_flash_incr__add_space, \
- /* double flash_multiple = */ 1.4, \
- /* double flash_threshold = */ 0.25, \
+ /* double flash_multiple = */ 1.4f, \
+ /* double flash_threshold = */ 0.25f, \
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold,\
- /* double upper_hr_threshold = */ 0.999, \
- /* double decrement = */ 0.9, \
+ /* double upper_hr_threshold = */ 0.999f, \
+ /* double decrement = */ 0.9f, \
/* hbool_t apply_max_decrement = */ TRUE, \
/* size_t max_decrement = */ (1 * 1024 * 1024), \
/* int epochs_before_eviction = */ 3, \
/* hbool_t apply_empty_reserve = */ TRUE, \
- /* double empty_reserve = */ 0.1, \
+ /* double empty_reserve = */ 0.1f, \
/* int dirty_bytes_threshold = */ (256 * 1024), \
/* int metadata_write_strategy = */ \
H5AC__DEFAULT_METADATA_WRITE_STRATEGY \
diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c
index 1bfe10a..dacce43 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -105,10 +105,9 @@ static herr_t H5D__chunk_collective_io(H5D_io_info_t *io_info,
static herr_t H5D__multi_chunk_collective_io(H5D_io_info_t *io_info,
const H5D_type_info_t *type_info, H5D_chunk_map_t *fm,
H5P_genplist_t *dx_plist);
-static herr_t H5D__multi_chunk_collective_io_no_opt(H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, H5D_chunk_map_t *fm, H5P_genplist_t *dx_plist);
static herr_t H5D__link_chunk_collective_io(H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, H5D_chunk_map_t *fm, int sum_chunk);
+ const H5D_type_info_t *type_info, H5D_chunk_map_t *fm, int sum_chunk,
+ H5P_genplist_t *dx_plist);
static herr_t H5D__inter_collective_io(H5D_io_info_t *io_info,
const H5D_type_info_t *type_info, const H5S_t *file_space,
const H5S_t *mem_space);
@@ -586,6 +585,12 @@ done:
* Programmer: Muqun Yang
* Monday, Feb. 13th, 2006
*
+ * Modification:
+ * - Refctore to remove multi-chunk-without-opimization feature and update for
+ * multi-chunk-io accordingly
+ * Programmer: Jonathan Kim
+ * Date: 2012-10-10
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -594,8 +599,6 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
{
H5P_genplist_t *dx_plist; /* Pointer to DXPL */
H5FD_mpio_chunk_opt_t chunk_opt_mode;
- H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode;
- H5D_mpio_actual_io_mode_t actual_io_mode;
int io_option = H5D_MULTI_CHUNK_IO_MORE_OPT;
int sum_chunk = -1;
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
@@ -617,10 +620,12 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
/* Check the optional property list on what to do with collective chunk IO. */
chunk_opt_mode = (H5FD_mpio_chunk_opt_t)H5P_peek_unsigned(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME);
- if(chunk_opt_mode == H5FD_MPIO_CHUNK_ONE_IO)
+ if(H5FD_MPIO_CHUNK_ONE_IO == chunk_opt_mode)
io_option = H5D_ONE_LINK_CHUNK_IO; /*no opt*/
- else if(chunk_opt_mode == H5FD_MPIO_CHUNK_MULTI_IO)
- io_option = H5D_MULTI_CHUNK_IO; /*no opt */
+ /* direct request to multi-chunk-io */
+ else if(H5FD_MPIO_CHUNK_MULTI_IO == chunk_opt_mode)
+ io_option = H5D_MULTI_CHUNK_IO;
+ /* via default path. branch by num threshold */
else {
unsigned one_link_chunk_io_threshold; /* Threshhold to use single collective I/O for all chunks */
int mpi_size; /* Number of processes in MPI job */
@@ -649,7 +654,7 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
/*** Test collective chunk user-input optimization APIs. ***/
check_prop = H5Pexist(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_LINK_HARD_NAME);
if(check_prop > 0) {
- if(io_option == H5D_ONE_LINK_CHUNK_IO) {
+ if(H5D_ONE_LINK_CHUNK_IO == io_option) {
new_value = 0;
if(H5Pset(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_LINK_HARD_NAME, &new_value) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTSET, FAIL, "unable to set property value")
@@ -657,7 +662,7 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
} /* end if */
check_prop = H5Pexist(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME);
if(check_prop > 0) {
- if(io_option == H5D_MULTI_CHUNK_IO) {
+ if(H5D_MULTI_CHUNK_IO == io_option) {
new_value = 0;
if(H5Pset(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME, &new_value) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTSET, FAIL, "unable to set property value")
@@ -665,7 +670,7 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
} /* end if */
check_prop = H5Pexist(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME);
if(check_prop > 0) {
- if(io_option == H5D_ONE_LINK_CHUNK_IO_MORE_OPT) {
+ if(H5D_ONE_LINK_CHUNK_IO_MORE_OPT == io_option) {
new_value = 0;
if(H5Pset(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME, &new_value) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTSET, FAIL, "unable to set property value")
@@ -682,39 +687,16 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
#endif
/* step 2: Go ahead to do IO.*/
- if(io_option == H5D_ONE_LINK_CHUNK_IO || io_option == H5D_ONE_LINK_CHUNK_IO_MORE_OPT) {
- /* set the actual io mode properties to the correct values for link chunk io.
- * Link chunk I/O does not break to independent, so we can set the actual_io mode
- * as well as the optimisation mode. */
- actual_chunk_opt_mode = H5D_MPIO_LINK_CHUNK;
- actual_io_mode = H5D_MPIO_CHUNK_COLLECTIVE;
-
- /* Set the actual chunk opt mode property. */
- if(H5P_set(dx_plist, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, &actual_chunk_opt_mode) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "couldn't set actual chunk opt mode property")
-
- if(H5D__link_chunk_collective_io(io_info, type_info, fm, sum_chunk) < 0)
+ if(H5D_ONE_LINK_CHUNK_IO == io_option || H5D_ONE_LINK_CHUNK_IO_MORE_OPT == io_option) {
+ if(H5D__link_chunk_collective_io(io_info, type_info, fm, sum_chunk, dx_plist) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish linked chunk MPI-IO")
-
- /* Set the actual io mode property. */
- if(H5P_set(dx_plist, H5D_MPIO_ACTUAL_IO_MODE_NAME, &actual_io_mode) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "couldn't set actual io mode property")
} /* end if */
- else
- if(io_option == H5D_MULTI_CHUNK_IO) {
- /* Set the actual chunk opt mode property */
- actual_chunk_opt_mode = H5D_MPIO_MULTI_CHUNK_NO_OPT;
- if(H5P_set(dx_plist, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, &actual_chunk_opt_mode) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "couldn't set actual chunk opt mode property")
-
- if(H5D__multi_chunk_collective_io_no_opt(io_info, type_info, fm, dx_plist) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish multiple chunk MPI-IO")
+ /* direct request to multi-chunk-io */
+ else if(H5D_MULTI_CHUNK_IO == io_option) {
+ if(H5D__multi_chunk_collective_io(io_info, type_info, fm, dx_plist) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish optimized multiple chunk MPI-IO")
} /* end if */
- else { /*multiple chunk IOs with opt */
- actual_chunk_opt_mode = H5D_MPIO_MULTI_CHUNK;
- if(H5P_set(dx_plist, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, &actual_chunk_opt_mode) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "couldn't set actual chunk opt mode property")
-
+ else { /* multiple chunk IO via threshold */
if(H5D__multi_chunk_collective_io(io_info, type_info, fm, dx_plist) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish optimized multiple chunk MPI-IO")
} /* end else */
@@ -801,11 +783,16 @@ done:
* Programmer: Muqun Yang
* Monday, Feb. 13th, 2006
*
+ * Modification:
+ * - Set H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME and H5D_MPIO_ACTUAL_IO_MODE_NAME
+ * dxpl in this.
+ * Programmer: Jonathan Kim
+ * Date: 2012-10-10
*-------------------------------------------------------------------------
*/
static herr_t
H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- H5D_chunk_map_t *fm, int sum_chunk)
+ H5D_chunk_map_t *fm, int sum_chunk, H5P_genplist_t *dx_plist)
{
H5D_chunk_addr_info_t *chunk_addr_info_array = NULL;
MPI_Datatype chunk_final_mtype; /* Final memory MPI datatype for all chunks with seletion */
@@ -824,10 +811,21 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ
int *chunk_mpi_file_counts = NULL; /* Count of MPI file datatype for each chunk */
int *chunk_mpi_mem_counts = NULL; /* Count of MPI memory datatype for each chunk */
int mpi_code; /* MPI return code */
+ H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode = H5D_MPIO_LINK_CHUNK;
+ H5D_mpio_actual_io_mode_t actual_io_mode = H5D_MPIO_CHUNK_COLLECTIVE;
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
+ /* Set the actual-chunk-opt-mode property. */
+ if(H5P_set(dx_plist, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, &actual_chunk_opt_mode) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "couldn't set actual chunk opt mode property")
+
+ /* Set the actual-io-mode property.
+ * Link chunk I/O does not break to independent, so can set right away */
+ if(H5P_set(dx_plist, H5D_MPIO_ACTUAL_IO_MODE_NAME, &actual_io_mode) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "couldn't set actual io mode property")
+
/* Get the sum # of chunks, if not already available */
if(sum_chunk < 0) {
if(H5D__mpio_get_sum_chunk(io_info, fm, &sum_chunk) < 0)
@@ -1075,6 +1073,12 @@ if(H5DEBUG(D))
* Programmer: Muqun Yang
* Monday, Feb. 13th, 2006
*
+ * Modification:
+ * - Set H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME dxpl in this to go along with
+ * setting H5D_MPIO_ACTUAL_IO_MODE_NAME dxpl at the bottom.
+ * Programmer: Jonathan Kim
+ * Date: 2012-10-10
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1096,11 +1100,16 @@ H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *ty
int mpi_rank;
#endif
size_t u; /* Local index variable */
+ H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode = H5D_MPIO_MULTI_CHUNK; /* actual chunk optimization mode */
H5D_mpio_actual_io_mode_t actual_io_mode = H5D_MPIO_NO_COLLECTIVE; /* Local variable for tracking the I/O mode used. */
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
+ /* Set the actual chunk opt mode property */
+ if(H5P_set(dx_plist, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, &actual_chunk_opt_mode) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "couldn't set actual chunk opt mode property")
+
#ifdef H5Dmpio_DEBUG
mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file);
#endif
@@ -1264,212 +1273,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__multi_chunk_collective_io_no_opt
- *
- * Purpose: To do collective IO without any optimization per chunk base
- * The internal independent IO inside HDF5 cannot handle
- * non-contiguous(or with holes) storage efficiently.
- * Under this case, the one independent IO call may consist of
- * many small disk IOs. So we may use independent IO with derived datatype
- * to replace the independent IO when we find this chunk is not good to
- * do collective IO. However, according to our performance study,
- * this approach may not overcome the overhead caused by MPI gather/scatter.
- * So we decide to leave the original collective IO per chunk approach as
- * an option for users. NO MPI gather/scatter calls are used.
- * HDF5 will try to collective IO if possible.
- * If users choose to use
- * H5Pset_dxpl_mpio_chunk_opt(dxpl_id,H5FD_MPIO_OPT_MULTI_IO),
- * this function will be called.
- * The HDF5 library won't do any IO management but leave it to MPI-IO to figure
- * out.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Muqun Yang
- * Monday, Feb. 13th, 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5D__multi_chunk_collective_io_no_opt(H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, H5D_chunk_map_t *fm, H5P_genplist_t *dx_plist)
-{
- H5SL_node_t *chunk_node; /* Current node in chunk skip list */
- H5D_io_info_t ctg_io_info; /* Contiguous I/O info object */
- H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */
- H5D_io_info_t cpt_io_info; /* Compact I/O info object */
- H5D_storage_t cpt_store; /* Chunk storage information as compact dataset */
- hbool_t cpt_dirty; /* Temporary placeholder for compact storage "dirty" flag */
- int min_chunk = -1; /* Minimum # of chunks all processes will operate on */
- int count_chunk; /* How many chunks have we operated on? */
- H5D_storage_t store; /* union of EFL and chunk pointer in file space */
- H5D_mpio_actual_io_mode_t actual_io_mode = H5D_MPIO_NO_COLLECTIVE; /*Local variable for tracking the I/O modes used. */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_STATIC
-
-#ifdef H5D_DEBUG
-if(H5DEBUG(D)) {
- int mpi_rank;
-
- mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file);
- HDfprintf(H5DEBUG(D), "Rank %d: coming to multi_chunk_collective_io_no_opt\n", mpi_rank);
-}
-#endif
-
- /* Set up contiguous I/O info object */
- HDmemcpy(&ctg_io_info, io_info, sizeof(ctg_io_info));
- ctg_io_info.store = &ctg_store;
- ctg_io_info.layout_ops = *H5D_LOPS_CONTIG;
-
- /* Initialize temporary contiguous storage info */
- ctg_store.contig.dset_size = (hsize_t)io_info->dset->shared->layout.u.chunk.size;
-
- /* Set up compact I/O info object */
- HDmemcpy(&cpt_io_info, io_info, sizeof(cpt_io_info));
- cpt_io_info.store = &cpt_store;
- cpt_io_info.layout_ops = *H5D_LOPS_COMPACT;
-
- /* Initialize temporary compact storage info */
- cpt_store.compact.dirty = &cpt_dirty;
-
- /* Set dataset storage for I/O info */
- io_info->store = &store;
-
- /* Get the min. # of chunks */
- if(H5D__mpio_get_min_chunk(io_info, fm, &min_chunk) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get minimum number of chunk")
- HDassert(min_chunk >= 0);
-
- /* Get first node in chunk skip list */
- chunk_node = H5SL_first(fm->sel_chunks);
- count_chunk = 0;
-
- /* Iterate through chunks to be operated on */
- while(chunk_node) {
- H5D_chunk_info_t *chunk_info; /* chunk information */
- H5D_chunk_ud_t udata; /* B-tree pass-through */
- hbool_t make_ind, make_coll; /* Flags to indicate that the MPI mode should change */
-
- /* Get the actual chunk information from the skip list node */
- chunk_info = H5SL_item(chunk_node);
-
- /* Pass in chunk's coordinates in a union. */
- store.chunk.offset = chunk_info->coords;
- store.chunk.index = chunk_info->index;
-
- /* Reset flags for changing parallel I/O mode */
- make_ind = make_coll = FALSE;
-
- count_chunk++;
-
- /* If the number of chunk is greater than minimum number of chunk,
- * Do independent read.
- */
- if(count_chunk > min_chunk)
- /* Switch to independent I/O (permanently) */
- make_ind = TRUE;
-
- /* Retrieve the chunk's address */
- if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->coords,
- chunk_info->index, &udata) < 0)
- HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't get chunk info from skipped list")
-
- /* Independent I/O */
- if(make_ind) {
- void *chunk; /* Pointer to the data chunk in cache */
- H5D_io_info_t *chk_io_info; /* Pointer to I/O info object for this chunk */
- uint32_t accessed_bytes = 0; /* Total accessed size in a chunk */
- htri_t cacheable; /* Whether the chunk is cacheable */
-
- /* Switch to independent I/O */
- if(H5D__ioinfo_xfer_mode(io_info, dx_plist, H5FD_MPIO_INDEPENDENT) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't switch to independent I/O")
-
- /* Update the local variable tracking the dxpl's actual io mode */
- actual_io_mode = actual_io_mode | H5D_MPIO_CHUNK_INDEPENDENT;
-
- /* Load the chunk into cache and lock it. */
- if((cacheable = H5D__chunk_cacheable(io_info, udata.addr,
- io_info->op_type == H5D_IO_OP_WRITE)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't tell if chunk is cacheable")
- if(cacheable) {
- hbool_t entire_chunk = TRUE; /* Whether whole chunk is selected */
-
- /* Compute # of bytes accessed in chunk */
- accessed_bytes = chunk_info->chunk_points * type_info->src_type_size;
-
- /* Determine if we will access all the data in the chunk */
- if(((io_info->op_type == H5D_IO_OP_WRITE) && (accessed_bytes != ctg_store.contig.dset_size))
- || (io_info->op_type != H5D_IO_OP_WRITE))
- entire_chunk = FALSE;
-
- /* Lock the chunk into the cache */
- if(NULL == (chunk = H5D__chunk_lock(io_info, &udata, entire_chunk, FALSE)))
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk")
-
- /* Set up the storage buffer information for this chunk */
- cpt_store.compact.buf = chunk;
-
- /* Point I/O info at contiguous I/O info for this chunk */
- chk_io_info = &cpt_io_info;
- } /* end if */
- else {
- /* Set up the storage address information for this chunk */
- ctg_store.contig.dset_addr = udata.addr;
-
- /* No chunk cached */
- chunk = NULL;
-
- /* Point I/O info at temporary I/O info for this chunk */
- chk_io_info = &ctg_io_info;
- } /* end else */
-
- if(io_info->op_type == H5D_IO_OP_WRITE) {
- if((io_info->io_ops.single_write)(chk_io_info, type_info,
- (hsize_t)chunk_info->chunk_points, chunk_info->fspace, chunk_info->mspace) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "optimized write failed")
- } /* end if */
- else {
- if((io_info->io_ops.single_read)(chk_io_info, type_info,
- (hsize_t)chunk_info->chunk_points, chunk_info->fspace, chunk_info->mspace) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "optimized read failed")
- } /* end ese */
-
- /* Release the cache lock on the chunk. */
- if(chunk)
- if(H5D__chunk_unlock(io_info, &udata, (io_info->op_type == H5D_IO_OP_WRITE), chunk, accessed_bytes) < 0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk")
- } /* end if */
- else { /*collective I/O */
- /* Set up the storage address information for this chunk */
- ctg_store.contig.dset_addr = udata.addr;
-
- /* Update the local variable tracking the dxpl's actual io Mode. */
- actual_io_mode = actual_io_mode | H5D_MPIO_CHUNK_COLLECTIVE;
-
- if(H5D__inter_collective_io(&ctg_io_info, type_info, chunk_info->fspace, chunk_info->mspace) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL,"couldn't finish shared collective MPI-IO")
- } /* end else */
-
- if(make_coll)
- if(H5D__ioinfo_xfer_mode(io_info, dx_plist, H5FD_MPIO_COLLECTIVE) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't switch to independent I/O")
-
- /* Get the next chunk node in the skip list */
- chunk_node = H5SL_next(chunk_node);
- } /* end while */
-
- /* Write the local value of actual io mode to the DXPL. */
- if(H5P_set(dx_plist, H5D_MPIO_ACTUAL_IO_MODE_NAME, &actual_io_mode) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "couldn't set actual io mode property")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D__multi_chunk_collective_io_no_opt */
-
-
-/*-------------------------------------------------------------------------
* Function: H5D__inter_collective_io
*
* Purpose: Routine for the shared part of collective IO between multiple chunk
@@ -1794,7 +1597,6 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm,
{
int total_chunks;
unsigned percent_nproc_per_chunk, threshold_nproc_per_chunk;
- H5FD_mpio_chunk_opt_t chunk_opt_mode;
uint8_t* io_mode_info = NULL;
uint8_t* recv_io_mode_info = NULL;
uint8_t* mergebuf = NULL;
@@ -1827,8 +1629,8 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm,
/* Setup parameters */
H5_ASSIGN_OVERFLOW(total_chunks, fm->layout->u.chunk.nchunks, hsize_t, int);
percent_nproc_per_chunk = H5P_peek_unsigned(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME);
- chunk_opt_mode = (H5FD_mpio_chunk_opt_t)H5P_peek_unsigned(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME);
- if((chunk_opt_mode == H5FD_MPIO_CHUNK_MULTI_IO) || (percent_nproc_per_chunk == 0)) {
+ /* if ratio is 0, perform collective io */
+ if(0 == percent_nproc_per_chunk) {
if(H5D__chunk_addrmap(io_info, chunk_addr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address");
for(ic = 0; ic < total_chunks; ic++)
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index c933ab1..ae55c44 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -66,7 +66,6 @@
#define H5D_XFER_VFL_ID_NAME "vfl_id" /* File driver ID */
#define H5D_XFER_VFL_INFO_NAME "vfl_info" /* File driver info */
#define H5D_XFER_HYPER_VECTOR_SIZE_NAME "vec_size" /* Hyperslab vector size */
-#ifdef H5_HAVE_PARALLEL
#define H5D_XFER_IO_XFER_MODE_NAME "io_xfer_mode" /* I/O transfer mode */
#define H5D_XFER_MPIO_COLLECTIVE_OPT_NAME "mpio_collective_opt" /* Optimization of MPI-IO transfer mode */
#define H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME "mpio_chunk_opt_hard"
@@ -76,7 +75,6 @@
#define H5D_MPIO_ACTUAL_IO_MODE_NAME "actual_io_mode"
#define H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME "local_no_collective_cause" /* cause of broken collective I/O in each process */
#define H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME "global_no_collective_cause" /* cause of broken collective I/O in all processes */
-#endif /* H5_HAVE_PARALLEL */
#define H5D_XFER_EDC_NAME "err_detect" /* EDC */
#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */
#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */
@@ -89,8 +87,6 @@
#define H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME "coll_chunk_link_false"
#define H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME "coll_chunk_multi_coll"
#define H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME "coll_chunk_multi_ind"
-#define H5D_XFER_COLL_CHUNK_LINK_TO_MULTI "coll_chunk_link_mul"/* Internal transferring from link to multiple chunk */
-#define H5D_XFER_COLL_CHUNK_LINK_TO_MULTI_OPT "coll_chunk_link_mul_opt"/* Internal transferring from link opt to multiple chunk opt*/
/* Definitions for all collective chunk instrumentation properties */
#define H5D_XFER_COLL_CHUNK_SIZE sizeof(unsigned)
diff --git a/src/H5Edefin.h b/src/H5Edefin.h
index ee284c4..2ae79e5 100644
--- a/src/H5Edefin.h
+++ b/src/H5Edefin.h
@@ -22,7 +22,7 @@
/* Major error IDs */
hid_t H5E_FUNC_g = FAIL; /* Function entry/exit */
-hid_t H5E_FILE_g = FAIL; /* File accessability */
+hid_t H5E_FILE_g = FAIL; /* File accessibilty */
hid_t H5E_SOHM_g = FAIL; /* Shared Object Header Messages */
hid_t H5E_SYM_g = FAIL; /* Symbol table */
hid_t H5E_VFL_g = FAIL; /* Virtual File Layer */
@@ -131,7 +131,7 @@ hid_t H5E_PATH_g = FAIL; /* Problem with path to object */
/* No error */
hid_t H5E_NONE_MINOR_g = FAIL; /* No error */
-/* File accessability errors */
+/* File accessibilty errors */
hid_t H5E_FILEEXISTS_g = FAIL; /* File already exists */
hid_t H5E_FILEOPEN_g = FAIL; /* File already open */
hid_t H5E_CANTCREATE_g = FAIL; /* Unable to create file */
diff --git a/src/H5Einit.h b/src/H5Einit.h
index 6881e48..a2eb02f 100644
--- a/src/H5Einit.h
+++ b/src/H5Einit.h
@@ -30,7 +30,7 @@ if((msg = H5E_create_msg(cls, H5E_MAJOR, "Function entry/exit"))==NULL)
if((H5E_FUNC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
assert(H5E_FILE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "File accessability"))==NULL)
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "File accessibilty"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
if((H5E_FILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
@@ -477,7 +477,7 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "No error"))==NULL)
if((H5E_NONE_MINOR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-/* File accessability errors */
+/* File accessibilty errors */
assert(H5E_FILEEXISTS_g==(-1));
if((msg = H5E_create_msg(cls, H5E_MINOR, "File already exists"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
diff --git a/src/H5Eint.c b/src/H5Eint.c
index 76eaaf5..88dfdee 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -380,6 +380,10 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
* they might be different. */
cls_ptr = (H5E_cls_t *)H5I_object_verify(err_desc->cls_id, H5I_ERROR_CLASS);
+ /* Check for bad pointer(s), but can't issue error, just leave */
+ if(!cls_ptr)
+ HGOTO_DONE(FAIL)
+
/* Print error class header if new class */
if(eprint->cls.lib_name == NULL || HDstrcmp(cls_ptr->lib_name, eprint->cls.lib_name)) {
/* update to the new class information */
diff --git a/src/H5Epubgen.h b/src/H5Epubgen.h
index 967b248..ddfb1d3 100644
--- a/src/H5Epubgen.h
+++ b/src/H5Epubgen.h
@@ -57,7 +57,7 @@
#define H5E_ERROR (H5OPEN H5E_ERROR_g)
#define H5E_CACHE (H5OPEN H5E_CACHE_g)
H5_DLLVAR hid_t H5E_FUNC_g; /* Function entry/exit */
-H5_DLLVAR hid_t H5E_FILE_g; /* File accessability */
+H5_DLLVAR hid_t H5E_FILE_g; /* File accessibilty */
H5_DLLVAR hid_t H5E_SOHM_g; /* Shared Object Header Messages */
H5_DLLVAR hid_t H5E_SYM_g; /* Symbol table */
H5_DLLVAR hid_t H5E_VFL_g; /* Virtual File Layer */
@@ -221,7 +221,7 @@ H5_DLLVAR hid_t H5E_PATH_g; /* Problem with path to object */
#define H5E_NONE_MINOR (H5OPEN H5E_NONE_MINOR_g)
H5_DLLVAR hid_t H5E_NONE_MINOR_g; /* No error */
-/* File accessability errors */
+/* File accessibilty errors */
#define H5E_FILEEXISTS (H5OPEN H5E_FILEEXISTS_g)
#define H5E_FILEOPEN (H5OPEN H5E_FILEOPEN_g)
#define H5E_CANTCREATE (H5OPEN H5E_CANTCREATE_g)
diff --git a/src/H5Eterm.h b/src/H5Eterm.h
index 5edcd34..6c621bc 100644
--- a/src/H5Eterm.h
+++ b/src/H5Eterm.h
@@ -133,7 +133,7 @@ H5E_PATH_g=
/* No error */
H5E_NONE_MINOR_g=
-/* File accessability errors */
+/* File accessibilty errors */
H5E_FILEEXISTS_g=
H5E_FILEOPEN_g=
H5E_CANTCREATE_g=
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index decdbf0..9b4aadc 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -484,7 +484,7 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id,
* default value. But if the file access property list was zero then use
* the default value instead.
*/
- file->increment = (fa->increment>0) ? fa->increment : H5FD_CORE_INCREMENT;
+ file->increment = (fa->increment > 0) ? fa->increment : H5FD_CORE_INCREMENT;
/* If save data in backing store. */
file->backing_store = fa->backing_store;
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c
index 1108e05..7dbabf5 100644
--- a/src/H5FDdirect.c
+++ b/src/H5FDdirect.c
@@ -536,7 +536,8 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd
/* Get the driver specific information */
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- fa = H5P_get_driver_info(plist);
+ if(NULL == (fa = (H5FD_direct_fapl_t *)H5P_get_driver_info(plist)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info")
file->fd = fd;
H5_ASSIGN_OVERFLOW(file->eof,sb.st_size,h5_stat_size_t,haddr_t);
@@ -565,9 +566,9 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd
* is to handle correctly the case that the file is in a different file system
* than the one where the program is running.
*/
- buf1 = (int*)HDmalloc(sizeof(int));
- if (HDposix_memalign(&buf2, file->fa.mboundary, file->fa.fbsize) != 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "HDposix_memalign failed")
+ buf1 = (int *)HDmalloc(sizeof(int));
+ if(HDposix_memalign(&buf2, file->fa.mboundary, file->fa.fbsize) != 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "HDposix_memalign failed")
if(o_flags & O_CREAT) {
if(write(file->fd, (void*)buf1, sizeof(int))<0) {
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index f051269..dc535a2 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -675,8 +675,8 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- fa = (H5FD_family_fapl_t *)H5P_get_driver_info(plist);
- HDassert(fa);
+ if(NULL == (fa = (H5FD_family_fapl_t *)H5P_get_driver_info(plist)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info")
/* Check for new family file size. It's used by h5repart only. */
if(H5P_exist_plist(plist, H5F_ACS_FAMILY_NEWSIZE_NAME) > 0) {
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 1c21666..89a0a28 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -535,8 +535,8 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
/* Get the driver specific information */
if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- fa = (H5FD_log_fapl_t *)H5P_get_driver_info(plist);
- HDassert(fa);
+ if(NULL == (fa = (H5FD_log_fapl_t *)H5P_get_driver_info(plist)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info")
#ifdef H5_HAVE_GETTIMEOFDAY
if(fa->flags & H5FD_LOG_TIME_OPEN)
@@ -650,9 +650,9 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
#ifdef H5_HAVE_GETTIMEOFDAY
if(file->fa.flags & H5FD_LOG_TIME_OPEN)
- HDfprintf(file->logfp, "Open took: (%f s)\n", (double)open_timeval_diff.tv_sec + ((double)open_timeval_diff.tv_usec / (double)1000000.0));
+ HDfprintf(file->logfp, "Open took: (%f s)\n", (double)open_timeval_diff.tv_sec + ((double)open_timeval_diff.tv_usec / (double)1000000.0f));
if(file->fa.flags & H5FD_LOG_TIME_STAT)
- HDfprintf(file->logfp, "Stat took: (%f s)\n", (double)stat_timeval_diff.tv_sec + ((double)stat_timeval_diff.tv_usec / (double)1000000.0));
+ HDfprintf(file->logfp, "Stat took: (%f s)\n", (double)stat_timeval_diff.tv_sec + ((double)stat_timeval_diff.tv_usec / (double)1000000.0f));
#endif /* H5_HAVE_GETTIMEOFDAY */
} /* end if */
@@ -744,7 +744,7 @@ H5FD_log_close(H5FD_t *_file)
timeval_diff.tv_usec += 1000000;
timeval_diff.tv_sec--;
} /* end if */
- HDfprintf(file->logfp, "Close took: (%f s)\n", (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0));
+ HDfprintf(file->logfp, "Close took: (%f s)\n", (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0f));
} /* end if */
#endif /* H5_HAVE_GETTIMEOFDAY */
@@ -1211,7 +1211,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t addr
timeval_diff.tv_usec += 1000000;
timeval_diff.tv_sec--;
} /* end if */
- time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0);
+ time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0f);
HDfprintf(file->logfp, " (%f s)\n", time_diff);
/* Add to total seek time */
@@ -1300,7 +1300,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t addr
timeval_diff.tv_usec += 1000000;
timeval_diff.tv_sec--;
} /* end if */
- time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0);
+ time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0f);
HDfprintf(file->logfp, " (%f s)\n", time_diff);
/* Add to total read time */
@@ -1417,7 +1417,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t add
timeval_diff.tv_usec += 1000000;
timeval_diff.tv_sec--;
} /* end if */
- time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0);
+ time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0f);
HDfprintf(file->logfp, " (%f s)\n", time_diff);
/* Add to total seek time */
@@ -1503,7 +1503,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t add
timeval_diff.tv_usec += 1000000;
timeval_diff.tv_sec--;
} /* end if */
- time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0);
+ time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0f);
HDfprintf(file->logfp, " (%f s)\n", time_diff);
/* Add to total write time */
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index cac101b..2db77c9 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -1013,8 +1013,8 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id,
_fa.info = MPI_INFO_NULL; /*default*/
fa = &_fa;
} else {
- fa = (const H5FD_mpio_fapl_t *)H5P_get_driver_info(plist);
- assert(fa);
+ if(NULL == (fa = (const H5FD_mpio_fapl_t *)H5P_get_driver_info(plist)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info")
}
/* Duplicate communicator and Info object for use by this file. */
diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c
index 35f52c3..88a5886 100644
--- a/src/H5FDmpiposix.c
+++ b/src/H5FDmpiposix.c
@@ -603,8 +603,8 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id,
fa = &_fa;
} /* end if */
else {
- fa = H5P_get_driver_info(plist);
- HDassert(fa);
+ if(NULL == (fa = (const H5FD_mpiposix_fapl_t *)H5P_get_driver_info(plist)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info")
} /* end else */
/* Duplicate the communicator for use by this file. */
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index ee89bde..9dbbba4 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -27,6 +27,7 @@
#include "H5FDpublic.h" /* File drivers */
/* Private headers needed by this file */
+#include "H5Vprivate.h" /* Vectors and arrays */
/****************************/
@@ -114,6 +115,35 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
/* (Assumes that the high bits of the integer are zero) */
# define UINT64ENCODE_VAR(p, n, l) ENCODE_VAR(p, uint64_t, n, l)
+/* Encode a 64-bit unsigned integer and its length into a variable-sized buffer */
+/* (Assumes that the high bits of the integer are zero) */
+# define UINT64ENCODE_VARLEN(p, n) { \
+ uint64_t __n = (uint64_t)(n); \
+ unsigned _s = H5V_limit_enc_size(__n); \
+ \
+ *(p)++ = (uint8_t)_s; \
+ UINT64ENCODE_VAR(p, __n, _s); \
+}
+
+# define H5_ENCODE_UNSIGNED(p, n) { \
+ HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \
+ UINT32ENCODE(p, n) \
+}
+
+/* Assumes the endianness of uint64_t is the same as double */
+# define H5_ENCODE_DOUBLE(p, n) { \
+ uint64_t _n; \
+ size_t _u; \
+ uint8_t *_p = (uint8_t*)(p); \
+ \
+ HDcompile_assert(sizeof(double) == 8); \
+ HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \
+ HDmemcpy(&_n, &n, sizeof(double)); \
+ for(_u = 0; _u < sizeof(uint64_t); _u++, _n >>= 8) \
+ *_p++ = (uint8_t)(_n & 0xff); \
+ (p) = (uint8_t *)(p) + 8; \
+}
+
/* DECODE converts little endian bytes pointed by p to integer values and store
* it in i. For signed values, need to do sign-extension when converting
* the last byte which carries the sign bit.
@@ -134,11 +164,11 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
}
# define INT32DECODE(p, i) { \
- (i) = ( *(p) & 0xff); (p)++; \
- (i) |= ((int32_t)(*(p) & 0xff) << 8); (p)++; \
- (i) |= ((int32_t)(*(p) & 0xff) << 16); (p)++; \
- (i) |= ((int32_t)(((*(p) & 0xff) << 24) | \
- ((*(p) & 0x80) ? ~0xffffffff : 0x0))); (p)++; \
+ (i) = ((int32_t)(*(p) & (unsigned)0xff)); (p)++; \
+ (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 8); (p)++; \
+ (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 16); (p)++; \
+ (i) |= ((int32_t)(((*(p) & (unsigned)0xff) << 24) | \
+ ((*(p) & (unsigned)0x80) ? (unsigned)(~0xffffffff) : (unsigned)0x0))); (p)++; \
}
# define UINT32DECODE(p, i) { \
@@ -190,6 +220,34 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
/* (Assumes that the high bits of the integer will be zero) */
# define UINT64DECODE_VAR(p, n, l) DECODE_VAR(p, n, l)
+/* Decode a 64-bit unsigned integer and its length from a variable-sized buffer */
+/* (Assumes that the high bits of the integer will be zero) */
+# define UINT64DECODE_VARLEN(p, n) { \
+ unsigned _s = *(p)++; \
+ \
+ UINT64DECODE_VAR(p, n, _s); \
+}
+
+# define H5_DECODE_UNSIGNED(p, n) { \
+ HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \
+ UINT32DECODE(p, n) \
+}
+
+/* Assumes the endianness of uint64_t is the same as double */
+# define H5_DECODE_DOUBLE(p, n) { \
+ uint64_t _n; \
+ size_t _u; \
+ \
+ HDcompile_assert(sizeof(double) == 8); \
+ HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \
+ _n = 0; \
+ (p) += 8; \
+ for(_u = 0; _u < sizeof(uint64_t); _u++) \
+ _n = (_n << 8) | *(--p); \
+ HDmemcpy(&(n), &_n, sizeof(double)); \
+ (p) += 8; \
+}
+
/* Address-related macros */
#define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \
HADDR_UNDEF==(X)+(haddr_t)(Z) || \
@@ -580,7 +638,7 @@ H5_DLL void H5F_addr_decode_len(size_t addr_len, const uint8_t **pp, haddr_t *ad
H5_DLL herr_t H5P_facc_close(hid_t dxpl_id, void *close_data);
/* Shared file list related routines */
-H5_DLL herr_t H5F_sfile_assert_num(unsigned n);
+H5_DLL void H5F_sfile_assert_num(unsigned n);
/* Routines for creating & destroying "fake" file structures */
H5_DLL H5F_t *H5F_fake_alloc(uint8_t sizeof_size);
diff --git a/src/H5Fsfile.c b/src/H5Fsfile.c
index 95e5ad2..a1c6976 100644
--- a/src/H5Fsfile.c
+++ b/src/H5Fsfile.c
@@ -46,16 +46,14 @@ H5F_sfile_node_t *H5F_sfile_head_g = NULL;
*
* Purpose: Sanity checking that shared file list is empty
*
- * Return: SUCCEED/FAIL
+ * Return: none (void)
*
* Programmer: Quincey Koziol
* Monday, July 25, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-herr_t
+void
H5F_sfile_assert_num(unsigned n)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -83,7 +81,7 @@ H5F_sfile_assert_num(unsigned n)
HDassert(count == n);
} /* end else */
- FUNC_LEAVE_NOAPI(SUCCEED)
+ FUNC_LEAVE_NOAPI_VOID
} /* H5F_sfile_assert_num() */
diff --git a/src/H5P.c b/src/H5P.c
index c7ed30b..9489e49 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -462,7 +462,7 @@ H5Pregister2(hid_t cls_id, const char *name, size_t size, void *def_value,
/* Create the new property list class */
orig_pclass = pclass;
- if((ret_value = H5P_register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, prp_delete, prp_copy, prp_cmp, prp_close)) < 0)
+ if((ret_value = H5P_register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, NULL, NULL, prp_delete, prp_copy, prp_cmp, prp_close)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in class")
/* Check if the property class changed and needs to be substituted in the ID */
@@ -645,7 +645,8 @@ H5Pinsert2(hid_t plist_id, const char *name, size_t size, void *value,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "properties >0 size must have default")
/* Create the new property list class */
- if((ret_value = H5P_insert(plist, name, size, value, prp_set, prp_get, prp_delete, prp_copy, prp_cmp, prp_close)) < 0)
+ if((ret_value = H5P_insert(plist, name, size, value, prp_set, prp_get,
+ NULL, NULL, prp_delete, prp_copy, prp_cmp, prp_close)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in plist")
done:
@@ -838,6 +839,89 @@ done:
/*--------------------------------------------------------------------------
NAME
+ H5Pencode
+ PURPOSE
+ Routine to convert the property values in a property list into a binary buffer
+ USAGE
+ herr_t H5Pencode(plist_id, buf, nalloc)
+ hid_t plist_id; IN: Identifier to property list to encode
+ void *buf: OUT: buffer to gold the encoded plist
+ size_t *nalloc; IN/OUT: size of buffer needed to encode plist
+ RETURNS
+ Returns non-negative on success, negative on failure.
+ DESCRIPTION
+ Encodes a property list into a binary buffer. If the buffer is NULL, then
+ the call will set the size needed to encode the plist in nalloc. Otherwise
+ the routine will encode the plist in buf.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5Pencode(hid_t plist_id, void *buf, size_t *nalloc)
+{
+ H5P_genplist_t *plist; /* Property list to query */
+ hid_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "i*x*z", plist_id, buf, nalloc);
+
+ /* Check arguments. */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
+
+ /* Call the internal encode routine */
+ if((ret_value = H5P__encode(plist, TRUE, buf, nalloc)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to encode property list");
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Pencode() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5Pdecode
+ PURPOSE
+ API routine to decode a property list from a binary buffer.
+ USAGE
+ hid_t H5Pdecode(buf)
+ void *buf; IN: buffer that holds the encoded plist
+ RETURNS
+ Returns non-negative ID of new property list object on success, negative
+ on failure.
+ DESCRIPTION
+ Decodes a property list from a binary buffer. The contents of the buffer
+ contain the values for the correponding properties of the plist. The decode
+ callback of a certain property decodes its value from the buffer and sets it
+ in the property list.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ Properties in the property list that are not encoded in the serialized
+ form retain their default value.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+hid_t
+H5Pdecode(const void *buf)
+{
+ hid_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("i", "*x", buf);
+
+ /* Call the internal decode routine */
+ if((ret_value = H5P__decode(buf)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "unable to decode property list");
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Pdecode() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5Pget_class
PURPOSE
Routine to query the class of a generic property list
diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c
index d21cdbf..5239fba 100644
--- a/src/H5Pdapl.c
+++ b/src/H5Pdapl.c
@@ -49,13 +49,18 @@
/* Definitions for size of raw data chunk cache(slots) */
#define H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE sizeof(size_t)
#define H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF H5D_CHUNK_CACHE_NSLOTS_DEFAULT
+#define H5D_ACS_DATA_CACHE_NUM_SLOTS_ENC H5P__encode_size_t
+#define H5D_ACS_DATA_CACHE_NUM_SLOTS_DEC H5P__decode_size_t
/* Definition for size of raw data chunk cache(bytes) */
#define H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE sizeof(size_t)
#define H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF H5D_CHUNK_CACHE_NBYTES_DEFAULT
+#define H5D_ACS_DATA_CACHE_BYTE_SIZE_ENC H5P__encode_size_t
+#define H5D_ACS_DATA_CACHE_BYTE_SIZE_DEC H5P__decode_size_t
/* Definition for preemption read chunks first */
#define H5D_ACS_PREEMPT_READ_CHUNKS_SIZE sizeof(double)
#define H5D_ACS_PREEMPT_READ_CHUNKS_DEF H5D_CHUNK_CACHE_W0_DEFAULT
-
+#define H5D_ACS_PREEMPT_READ_CHUNKS_ENC H5P__encode_double
+#define H5D_ACS_PREEMPT_READ_CHUNKS_DEC H5P__decode_double
/******************/
/* Local Typedefs */
@@ -130,15 +135,18 @@ H5P__dacc_reg_prop(H5P_genclass_t *pclass)
FUNC_ENTER_STATIC
/* Register the size of raw data chunk cache (elements) */
- if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots,
+ NULL, NULL, NULL, H5D_ACS_DATA_CACHE_NUM_SLOTS_ENC, H5D_ACS_DATA_CACHE_NUM_SLOTS_DEC, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the size of raw data chunk cache(bytes) */
- if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes,
+ NULL, NULL, NULL, H5D_ACS_DATA_CACHE_BYTE_SIZE_ENC, H5D_ACS_DATA_CACHE_BYTE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the preemption for reading chunks */
- if(H5P_register_real(pclass, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, H5D_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, H5D_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0,
+ NULL, NULL, NULL, H5D_ACS_PREEMPT_READ_CHUNKS_ENC, H5D_ACS_PREEMPT_READ_CHUNKS_DEC, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index 9cb87fd..8a15863 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -43,6 +43,7 @@
#include "H5MMprivate.h" /* Memory management */
#include "H5Ppkg.h" /* Property lists */
#include "H5Vprivate.h" /* Vectors and arrays */
+#include "H5Tprivate.h" /* Datatypes */
#include "H5Zpkg.h" /* Data filters */
@@ -77,18 +78,26 @@
/* Definitions for storage layout property */
#define H5D_CRT_LAYOUT_SIZE sizeof(H5O_layout_t)
#define H5D_CRT_LAYOUT_DEF H5D_DEF_LAYOUT_CONTIG
+#define H5D_CRT_LAYOUT_ENC H5P__dcrt_layout_enc
+#define H5D_CRT_LAYOUT_DEC H5P__dcrt_layout_dec
#define H5D_CRT_LAYOUT_CMP H5P__dcrt_layout_cmp
/* Definitions for fill value. size=0 means fill value will be 0 as
* library default; size=-1 means fill value is undefined. */
#define H5D_CRT_FILL_VALUE_SIZE sizeof(H5O_fill_t)
#define H5D_CRT_FILL_VALUE_DEF {{0, NULL, H5O_NULL_ID, {{0, HADDR_UNDEF}}}, H5O_FILL_VERSION_2, NULL, 0, NULL, H5D_ALLOC_TIME_LATE, H5D_FILL_TIME_IFSET, FALSE}
+#define H5D_CRT_FILL_VALUE_ENC H5P__fill_value_enc
+#define H5D_CRT_FILL_VALUE_DEC H5P__fill_value_dec
#define H5D_CRT_FILL_VALUE_CMP H5P_fill_value_cmp
/* Definitions for space allocation time state */
#define H5D_CRT_ALLOC_TIME_STATE_SIZE sizeof(unsigned)
#define H5D_CRT_ALLOC_TIME_STATE_DEF 1
+#define H5D_CRT_ALLOC_TIME_STATE_ENC H5P__encode_unsigned
+#define H5D_CRT_ALLOC_TIME_STATE_DEC H5P__decode_unsigned
/* Definitions for external file list */
#define H5D_CRT_EXT_FILE_LIST_SIZE sizeof(H5O_efl_t)
#define H5D_CRT_EXT_FILE_LIST_DEF {HADDR_UNDEF, 0, 0, NULL}
+#define H5D_CRT_EXT_FILE_LIST_ENC H5P__dcrt_ext_file_list_enc
+#define H5D_CRT_EXT_FILE_LIST_DEC H5P__dcrt_ext_file_list_dec
#define H5D_CRT_EXT_FILE_LIST_CMP H5P__dcrt_ext_file_list_cmp
@@ -118,7 +127,13 @@ static herr_t H5P__dcrt_copy(hid_t new_plist_t, hid_t old_plist_t, void *copy_da
static herr_t H5P__dcrt_close(hid_t dxpl_id, void *close_data);
/* Property callbacks */
+static herr_t H5P__dcrt_layout_enc(const void *value, void **pp, size_t *size);
+static herr_t H5P__dcrt_layout_dec(const void **pp, void *value);
static int H5P__dcrt_layout_cmp(const void *value1, const void *value2, size_t size);
+static herr_t H5P__fill_value_enc(const void *value, void **pp, size_t *size);
+static herr_t H5P__fill_value_dec(const void **pp, void *value);
+static herr_t H5P__dcrt_ext_file_list_enc(const void *value, void **pp, size_t *size);
+static herr_t H5P__dcrt_ext_file_list_dec(const void **pp, void *value);
static int H5P__dcrt_ext_file_list_cmp(const void *value1, const void *value2, size_t size);
@@ -150,6 +165,17 @@ const H5P_libclass_t H5P_CLS_DCRT[1] = {{
/* Declare extern the free list to manage blocks of type conversion data */
H5FL_BLK_EXTERN(type_conv);
+
+/***************************/
+/* Local Private Variables */
+/***************************/
+
+/* Property value defaults */
+static const H5O_layout_t H5D_def_layout_g = H5D_CRT_LAYOUT_DEF; /* Default storage layout */
+static const H5O_fill_t H5D_def_fill_g = H5D_CRT_FILL_VALUE_DEF; /* Default fill value */
+static const unsigned H5D_def_alloc_time_state_g = H5D_CRT_ALLOC_TIME_STATE_DEF; /* Default allocation time state */
+static const H5O_efl_t H5D_def_efl_g = H5D_CRT_EXT_FILE_LIST_DEF; /* Default external file list */
+
/* Defaults for each type of layout */
#ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER
static const H5O_layout_t H5D_def_layout_compact_g = H5D_DEF_LAYOUT_COMPACT;
@@ -178,28 +204,32 @@ static hbool_t H5P_dcrt_def_layout_init_g = FALSE;
static herr_t
H5P__dcrt_reg_prop(H5P_genclass_t *pclass)
{
- H5O_layout_t layout = H5D_CRT_LAYOUT_DEF; /* Default storage layout */
- H5O_fill_t fill = H5D_CRT_FILL_VALUE_DEF; /* Default fill value */
- unsigned alloc_time_state = H5D_CRT_ALLOC_TIME_STATE_DEF; /* Default allocation time state */
- H5O_efl_t efl = H5D_CRT_EXT_FILE_LIST_DEF; /* Default external file list */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Register the storage layout property */
- if(H5P_register_real(pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &layout, NULL, NULL, NULL, NULL, NULL, H5D_CRT_LAYOUT_CMP, NULL) < 0)
+ if(H5P_register_real(pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &H5D_def_layout_g,
+ NULL, NULL, NULL, H5D_CRT_LAYOUT_ENC, H5D_CRT_LAYOUT_DEC,
+ NULL, NULL, H5D_CRT_LAYOUT_CMP, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the fill value property */
- if(H5P_register_real(pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &fill, NULL, NULL, NULL, NULL, NULL, H5D_CRT_FILL_VALUE_CMP, NULL) < 0)
+ if(H5P_register_real(pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &H5D_def_fill_g,
+ NULL, NULL, NULL, H5D_CRT_FILL_VALUE_ENC, H5D_CRT_FILL_VALUE_DEC,
+ NULL, NULL, H5D_CRT_FILL_VALUE_CMP, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the space allocation time state property */
- if(H5P_register_real(pclass, H5D_CRT_ALLOC_TIME_STATE_NAME, H5D_CRT_ALLOC_TIME_STATE_SIZE, &alloc_time_state, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5D_CRT_ALLOC_TIME_STATE_NAME, H5D_CRT_ALLOC_TIME_STATE_SIZE, &H5D_def_alloc_time_state_g,
+ NULL, NULL, NULL, H5D_CRT_ALLOC_TIME_STATE_ENC, H5D_CRT_ALLOC_TIME_STATE_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the external file list property */
- if(H5P_register_real(pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &efl, NULL, NULL, NULL, NULL, NULL, H5D_CRT_EXT_FILE_LIST_CMP, NULL) < 0)
+ if(H5P_register_real(pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &H5D_def_efl_g,
+ NULL, NULL, NULL, H5D_CRT_EXT_FILE_LIST_ENC, H5D_CRT_EXT_FILE_LIST_DEC,
+ NULL, NULL, H5D_CRT_EXT_FILE_LIST_CMP, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
@@ -370,6 +400,150 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5P__dcrt_layout_enc
+ *
+ * Purpose: Callback routine which is called whenever the layout
+ * property in the dataset creation property list is
+ * encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Monday, October 10, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size)
+{
+ const H5O_layout_t *layout = (const H5O_layout_t *)value; /* Create local aliases for values */
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(layout);
+ HDassert(size);
+
+ if(NULL != *pp) {
+ /* Encode layout type */
+ *(*pp)++ = (uint8_t)layout->type;
+
+ /* If layout is chunked, encode chunking structure */
+ if(H5D_CHUNKED == layout->type) {
+ unsigned u; /* Local index variable */
+
+ /* Encode rank */
+ *(*pp)++ = (uint8_t)layout->u.chunk.ndims;
+
+ /* Encode chunk dims */
+ HDcompile_assert(sizeof(uint32_t) == sizeof(layout->u.chunk.dim[0]));
+ for(u = 0; u < layout->u.chunk.ndims; u++)
+ UINT32ENCODE(*pp, layout->u.chunk.dim[u])
+ } /* end if */
+ } /* end if */
+
+ /* Size of layout type */
+ *size += sizeof(uint8_t);
+
+ /* Size of chunk info encoding */
+ if(H5D_CHUNKED == layout->type) {
+ *size += sizeof(uint8_t);
+ *size += layout->u.chunk.ndims * sizeof(uint32_t);
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__dcrt_layout_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dcrt_layout_dec
+ *
+ * Purpose: Callback routine which is called whenever the layout
+ * property in the dataset creation property list is
+ * decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Monday, October 10, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dcrt_layout_dec(const void **_pp, void *value)
+{
+ const H5O_layout_t *layout; /* Storage layout */
+ H5O_layout_t chunk_layout; /* Layout structure for chunk info */
+ H5D_layout_t type; /* Layout type */
+ const uint8_t **pp = (const uint8_t **)_pp;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(value);
+
+ /* Decode layout type */
+ type = (H5D_layout_t)*(*pp)++;
+
+ /* set default layout in case the type is compact or contiguous, otherwise
+ * decode the chunked structure and set chunked layout */
+ switch(type) {
+ case H5D_COMPACT:
+ layout = &H5D_def_layout_compact_g;
+ break;
+
+ case H5D_CONTIGUOUS:
+ layout = &H5D_def_layout_contig_g;
+ break;
+
+ case H5D_CHUNKED:
+ {
+ unsigned ndims; /* Number of chunk dimensions */
+
+ /* Decode the number of chunk dimensions */
+ ndims = *(*pp)++;
+
+ /* default chunk layout */
+ if(0 == ndims)
+ layout = &H5D_def_layout_chunk_g;
+ else { /* chunk layout structure is encoded*/
+ unsigned u; /* Local index variable */
+
+ /* Initialize to default values */
+ chunk_layout = H5D_def_layout_chunk_g;
+
+ /* Set rank & dimensions */
+ chunk_layout.u.chunk.ndims = (unsigned)ndims;
+ for(u = 0; u < ndims; u++)
+ UINT32DECODE(*pp, chunk_layout.u.chunk.dim[u])
+
+ /* Point at the newly set up struct */
+ layout = &chunk_layout;
+ } /* end else */
+ }
+ break;
+
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
+ default:
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad layout type")
+ } /* end switch */
+
+ /* Set the value */
+ HDmemcpy(value, layout, sizeof(H5O_layout_t));
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__dcrt_layout_dec() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5P__dcrt_layout_cmp
*
* Purpose: Callback routine which is called whenever the layout
@@ -441,6 +615,168 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5P__fill_value_enc
+ *
+ * Purpose: Callback routine which is called whenever the fill value
+ * property in the dataset creation property list is
+ * encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Monday, October 10, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__fill_value_enc(const void *value, void **_pp, size_t *size)
+{
+ const H5O_fill_t *fill = (const H5O_fill_t *)value; /* Create local aliases for values */
+ size_t dt_size = 0; /* Size of encoded datatype */
+ herr_t ret_value = SUCCEED; /* Return value */
+ uint8_t **pp = (uint8_t **)_pp;
+ uint64_t enc_value;
+ unsigned enc_size;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
+ HDcompile_assert(sizeof(ssize_t) <= sizeof(int64_t));
+ HDassert(fill);
+ HDassert(size);
+
+ if(NULL != *pp) {
+ /* Encode alloc and fill time */
+ *(*pp)++ = (uint8_t)fill->alloc_time;
+ *(*pp)++ = (uint8_t)fill->fill_time;
+
+ /* Encode size of fill value */
+ INT64ENCODE(*pp, fill->size)
+
+ /* Encode the fill value & datatype */
+ if(fill->size > 0) {
+ /* Encode the fill value itself */
+ HDmemcpy(*pp, (uint8_t *)fill->buf, (size_t)fill->size);
+ *pp += fill->size;
+
+ /* Encode fill value datatype */
+ HDassert(fill->type);
+
+ if(H5T_encode(fill->type, NULL, &dt_size) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype")
+
+ /* Encode the size of a size_t */
+ enc_value = (uint64_t)dt_size;
+ enc_size = H5V_limit_enc_size(enc_value);
+ HDassert(enc_size < 256);
+
+ /* Encode the size */
+ *(*pp)++ = (uint8_t)enc_size;
+
+ /* Encode the size of the encoded datatype */
+ UINT64ENCODE_VAR(*pp, enc_value, enc_size);
+
+ if(H5T_encode(fill->type, *pp, &dt_size) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype")
+ *pp += dt_size;
+ } /* end if */
+ } /* end if */
+
+ /* Calculate size needed for encoding */
+ *size += 2;
+ *size += sizeof(int64_t);
+ if(fill->size > 0) {
+ /* The size of the fill value buffer */
+ *size += (size_t)fill->size;
+
+ /* calculate those if they were not calculated earlier */
+ if(NULL == *pp) {
+ /* Get the size of the encoded datatype */
+ HDassert(fill->type);
+ if(H5T_encode(fill->type, NULL, &dt_size) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype")
+ enc_value = (uint64_t)dt_size;
+ enc_size = H5V_limit_enc_size(enc_value);
+ }
+ *size += (1 + enc_size);
+ *size += dt_size;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__fill_value_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__fill_value_dec
+ *
+ * Purpose: Callback routine which is called whenever the fill value
+ * property in the dataset creation property list is
+ * decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Monday, October 10, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__fill_value_dec(const void **_pp, void *_value)
+{
+ H5O_fill_t *fill = (H5O_fill_t *)_value; /* Fill value */
+ const uint8_t **pp = (const uint8_t **)_pp;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
+ HDcompile_assert(sizeof(ssize_t) <= sizeof(int64_t));
+
+ /* Set property to default value */
+ *fill = H5D_def_fill_g;
+
+ /* Decode alloc and fill time */
+ fill->alloc_time = (H5D_alloc_time_t)*(*pp)++;
+ fill->fill_time = (H5D_fill_time_t)*(*pp)++;
+
+ /* Decode fill size */
+ INT64DECODE(*pp, fill->size)
+
+ /* Check if there's a fill value */
+ if(fill->size > 0) {
+ size_t dt_size = 0;
+ uint64_t enc_value;
+ unsigned enc_size;
+
+ /* Allocate fill buffer and copy the contents in it */
+ if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size)))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for fill value buffer")
+ HDmemcpy((uint8_t *)fill->buf, *pp, (size_t)fill->size);
+ *pp += fill->size;
+
+ enc_size = *(*pp)++;
+ HDassert(enc_size < 256);
+
+ /* Decode the size of encoded datatype */
+ UINT64DECODE_VAR(*pp, enc_value, enc_size);
+ dt_size = (size_t)enc_value;
+
+ /* Decode type */
+ if(NULL == (fill->type = H5T_decode(*pp)))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "can't decode fill value datatype")
+ *pp += dt_size;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__fill_value_dec() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5P_fill_value_cmp
*
* Purpose: Callback routine which is called whenever the fill value
@@ -502,6 +838,181 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5P__dcrt_ext_file_list_enc
+ *
+ * Purpose: Callback routine which is called whenever the efl
+ * property in the dataset creation property list is
+ * encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Monday, October 10, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size)
+{
+ const H5O_efl_t *efl = (const H5O_efl_t *)value; /* Create local aliases for values */
+ size_t len = 0; /* String length of slot name */
+ size_t u; /* Local index variable */
+ uint8_t **pp = (uint8_t **)_pp;
+ unsigned enc_size;
+ uint64_t enc_value;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(efl);
+ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
+ HDcompile_assert(sizeof(off_t) <= sizeof(uint64_t));
+ HDcompile_assert(sizeof(hsize_t) <= sizeof(uint64_t));
+ HDassert(size);
+
+ if(NULL != *pp) {
+ /* Encode number of slots used */
+ enc_value = (uint64_t)efl->nused;
+ enc_size = H5V_limit_enc_size(enc_value);
+ HDassert(enc_size < 256);
+ *(*pp)++ = (uint8_t)enc_size;
+ UINT64ENCODE_VAR(*pp, enc_value, enc_size);
+
+ /* Encode file list */
+ for(u = 0; u < efl->nused; u++) {
+ /* Calculate length of slot name and encode it */
+ len = HDstrlen(efl->slot[u].name) + 1;
+ enc_value = (uint64_t)len;
+ enc_size = H5V_limit_enc_size(enc_value);
+ HDassert(enc_size < 256);
+ *(*pp)++ = (uint8_t)enc_size;
+ UINT64ENCODE_VAR(*pp, enc_value, enc_size);
+
+ /* Encode name */
+ HDmemcpy(*pp, (uint8_t *)(efl->slot[u].name), len);
+ *pp += len;
+
+ /* Encode offset */
+ enc_value = (uint64_t)efl->slot[u].offset;
+ enc_size = H5V_limit_enc_size(enc_value);
+ HDassert(enc_size < 256);
+ *(*pp)++ = (uint8_t)enc_size;
+ UINT64ENCODE_VAR(*pp, enc_value, enc_size);
+
+ /* encode size */
+ enc_value = (uint64_t)efl->slot[u].size;
+ enc_size = H5V_limit_enc_size(enc_value);
+ HDassert(enc_size < 256);
+ *(*pp)++ = (uint8_t)enc_size;
+ UINT64ENCODE_VAR(*pp, enc_value, enc_size);
+ } /* end for */
+ } /* end if */
+
+ /* Calculate size needed for encoding */
+ *size += (1 + H5V_limit_enc_size((uint64_t)efl->nused));
+ for(u = 0; u < efl->nused; u++) {
+ len = HDstrlen(efl->slot[u].name) + 1;
+ *size += (1 + H5V_limit_enc_size((uint64_t)len));
+ *size += len;
+ *size += (1 + H5V_limit_enc_size((uint64_t)efl->slot[u].offset));
+ *size += (1 + H5V_limit_enc_size((uint64_t)efl->slot[u].size));
+ } /* end for */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__dcrt_ext_file_list_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dcrt_ext_file_list_dec
+ *
+ * Purpose: Callback routine which is called whenever the efl
+ * property in the dataset creation property list is
+ * decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Monday, October 10, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dcrt_ext_file_list_dec(const void **_pp, void *_value)
+{
+ H5O_efl_t *efl = (H5O_efl_t *)_value; /* External file list */
+ const uint8_t **pp = (const uint8_t **)_pp;
+ size_t u, nused;
+ unsigned enc_size;
+ uint64_t enc_value;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(efl);
+ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
+ HDcompile_assert(sizeof(off_t) <= sizeof(uint64_t));
+ HDcompile_assert(sizeof(hsize_t) <= sizeof(uint64_t));
+
+ /* Set property to default value */
+ *efl = H5D_def_efl_g;
+
+ /* Decode number of slots used */
+ enc_size = *(*pp)++;
+ HDassert(enc_size < 256);
+ UINT64DECODE_VAR(*pp, enc_value, enc_size);
+ nused = (size_t)enc_value;
+
+ /* Decode information for each slot */
+ for(u = 0; u < nused; u++) {
+ size_t len;
+ if(efl->nused >= efl->nalloc) {
+ size_t na = efl->nalloc + H5O_EFL_ALLOC;
+ H5O_efl_entry_t *x = (H5O_efl_entry_t *)H5MM_realloc(efl->slot,
+ na * sizeof(H5O_efl_entry_t));
+ if(!x)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed")
+
+ efl->nalloc = na;
+ efl->slot = x;
+ } /* end if */
+
+ /* Decode length of slot name */
+ enc_size = *(*pp)++;
+ HDassert(enc_size < 256);
+ UINT64DECODE_VAR(*pp, enc_value, enc_size);
+ len = (size_t)enc_value;
+
+ /* Allocate name buffer and decode the name into it */
+ efl->slot[u].name = H5MM_xstrdup((const char *)(*pp));
+ *pp += len;
+
+ /* decode offset */
+ enc_size = *(*pp)++;
+ HDassert(enc_size < 256);
+ UINT64DECODE_VAR(*pp, enc_value, enc_size);
+ efl->slot[u].offset = (off_t)enc_value;
+
+ /* decode size */
+ enc_size = *(*pp)++;
+ HDassert(enc_size < 256);
+ UINT64DECODE_VAR(*pp, enc_value, enc_size);
+ efl->slot[u].size = (hsize_t)enc_value;
+
+ efl->slot[u].name_offset = 0; /*not entered into heap yet*/
+ efl->nused++;
+ } /* end for */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__dcrt_ext_file_list_dec() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5P__dcrt_ext_file_list_cmp
*
* Purpose: Callback routine which is called whenever the external file
@@ -1538,7 +2049,7 @@ done:
* Function: H5Pset_fill_value
*
* Purpose: Set the fill value for a dataset creation property list. The
- * VALUE is interpretted as being of type TYPE, which need not
+ * VALUE is interpreted as being of type TYPE, which need not
* be the same type as the dataset but the library must be able
* to convert VALUE to the dataset type when the dataset is
* created. If VALUE is NULL, it will be interpreted as
@@ -1549,13 +2060,6 @@ done:
* Programmer: Robb Matzke
* Thursday, October 1, 1998
*
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * Changed the way to check parameter and set property for
- * generic property list.
- *
*-------------------------------------------------------------------------
*/
herr_t
diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c
index 8d1d75f..cb5e10f 100644
--- a/src/H5Pdeprec.c
+++ b/src/H5Pdeprec.c
@@ -267,7 +267,7 @@ H5Pregister1(hid_t cls_id, const char *name, size_t size, void *def_value,
/* Create the new property list class */
orig_pclass = pclass;
- if((ret_value = H5P_register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, prp_delete, prp_copy, NULL, prp_close)) < 0)
+ if((ret_value = H5P_register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, NULL, NULL, prp_delete, prp_copy, NULL, prp_close)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in class");
/* Check if the property class changed and needs to be substituted in the ID */
@@ -450,7 +450,8 @@ H5Pinsert1(hid_t plist_id, const char *name, size_t size, void *value,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "properties >0 size must have default")
/* Create the new property list class */
- if((ret_value = H5P_insert(plist, name, size, value, prp_set, prp_get, prp_delete, prp_copy, NULL, prp_close)) < 0)
+ if((ret_value = H5P_insert(plist, name, size, value, prp_set, prp_get,
+ NULL, NULL, prp_delete, prp_copy, NULL, prp_close)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in plist")
done:
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index d94ee7f..ec7def8 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -38,6 +38,7 @@
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Ppkg.h" /* Property lists */
@@ -49,6 +50,8 @@
/* Definitions for maximum temp buffer size property */
#define H5D_XFER_MAX_TEMP_BUF_SIZE sizeof(size_t)
#define H5D_XFER_MAX_TEMP_BUF_DEF H5D_TEMP_BUF_SIZE
+#define H5D_XFER_MAX_TEMP_BUF_ENC H5P__encode_size_t
+#define H5D_XFER_MAX_TEMP_BUF_DEC H5P__decode_size_t
/* Definitions for type conversion buffer property */
#define H5D_XFER_TCONV_BUF_SIZE sizeof(void *)
#define H5D_XFER_TCONV_BUF_DEF NULL
@@ -58,12 +61,16 @@
/* Definitions for background buffer type property */
#define H5D_XFER_BKGR_BUF_TYPE_SIZE sizeof(H5T_bkg_t)
#define H5D_XFER_BKGR_BUF_TYPE_DEF H5T_BKG_NO
+#define H5D_XFER_BKGR_BUF_TYPE_ENC H5P__dxfr_bkgr_buf_type_enc
+#define H5D_XFER_BKGR_BUF_TYPE_DEC H5P__dxfr_bkgr_buf_type_dec
/* Definitions for B-tree node splitting ratio property */
/* (These default B-tree node splitting ratios are also used for splitting
* group's B-trees as well as chunked dataset's B-trees - QAK)
*/
#define H5D_XFER_BTREE_SPLIT_RATIO_SIZE sizeof(double[3])
-#define H5D_XFER_BTREE_SPLIT_RATIO_DEF {0.1, 0.5, 0.9}
+#define H5D_XFER_BTREE_SPLIT_RATIO_DEF {0.1f, 0.5f, 0.9f}
+#define H5D_XFER_BTREE_SPLIT_RATIO_ENC H5P__dxfr_btree_split_ratio_enc
+#define H5D_XFER_BTREE_SPLIT_RATIO_DEC H5P__dxfr_btree_split_ratio_dec
/* Definitions for vlen allocation function property */
#define H5D_XFER_VLEN_ALLOC_SIZE sizeof(H5MM_allocate_t)
#define H5D_XFER_VLEN_ALLOC_DEF H5D_VLEN_ALLOC
@@ -82,20 +89,37 @@
*/
#define H5D_XFER_HYPER_VECTOR_SIZE_SIZE sizeof(size_t)
#define H5D_XFER_HYPER_VECTOR_SIZE_DEF H5D_IO_VECTOR_SIZE
+#define H5D_XFER_HYPER_VECTOR_SIZE_ENC H5P__encode_size_t
+#define H5D_XFER_HYPER_VECTOR_SIZE_DEC H5P__decode_size_t
+
+/* Parallel I/O properties */
+/* Note: Some of these are registered with the DXPL class even when parallel
+ * is disabled, so that property list comparisons of encoded property
+ * lists (between parallel & non-parallel builds) work properly. -QAK
+ */
-#ifdef H5_HAVE_PARALLEL
/* Definitions for I/O transfer mode property */
#define H5D_XFER_IO_XFER_MODE_SIZE sizeof(H5FD_mpio_xfer_t)
#define H5D_XFER_IO_XFER_MODE_DEF H5FD_MPIO_INDEPENDENT
+#define H5D_XFER_IO_XFER_MODE_ENC H5P__dxfr_io_xfer_mode_enc
+#define H5D_XFER_IO_XFER_MODE_DEC H5P__dxfr_io_xfer_mode_dec
/* Definitions for optimization of MPI-IO transfer mode property */
#define H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE sizeof(H5FD_mpio_collective_opt_t)
#define H5D_XFER_MPIO_COLLECTIVE_OPT_DEF H5FD_MPIO_COLLECTIVE_IO
+#define H5D_XFER_MPIO_COLLECTIVE_OPT_ENC H5P__dxfr_mpio_collective_opt_enc
+#define H5D_XFER_MPIO_COLLECTIVE_OPT_DEC H5P__dxfr_mpio_collective_opt_dec
#define H5D_XFER_MPIO_CHUNK_OPT_HARD_SIZE sizeof(H5FD_mpio_chunk_opt_t)
#define H5D_XFER_MPIO_CHUNK_OPT_HARD_DEF H5FD_MPIO_CHUNK_DEFAULT
+#define H5D_XFER_MPIO_CHUNK_OPT_HARD_ENC H5P__dxfr_mpio_chunk_opt_hard_enc
+#define H5D_XFER_MPIO_CHUNK_OPT_HARD_DEC H5P__dxfr_mpio_chunk_opt_hard_dec
#define H5D_XFER_MPIO_CHUNK_OPT_NUM_SIZE sizeof(unsigned)
#define H5D_XFER_MPIO_CHUNK_OPT_NUM_DEF H5D_ONE_LINK_CHUNK_IO_THRESHOLD
+#define H5D_XFER_MPIO_CHUNK_OPT_NUM_ENC H5P__encode_unsigned
+#define H5D_XFER_MPIO_CHUNK_OPT_NUM_DEC H5P__decode_unsigned
#define H5D_XFER_MPIO_CHUNK_OPT_RATIO_SIZE sizeof(unsigned)
#define H5D_XFER_MPIO_CHUNK_OPT_RATIO_DEF H5D_MULTI_CHUNK_IO_COL_THRESHOLD
+#define H5D_XFER_MPIO_CHUNK_OPT_RATIO_ENC H5P__encode_unsigned
+#define H5D_XFER_MPIO_CHUNK_OPT_RATIO_DEC H5P__decode_unsigned
/* Definitions for chunk opt mode property. */
#define H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_SIZE sizeof(H5D_mpio_actual_chunk_opt_mode_t)
#define H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_DEF H5D_MPIO_NO_CHUNK_OPTIMIZATION
@@ -105,6 +129,7 @@
/* Definitions for cause of broken collective io property */
#define H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE sizeof(uint32_t)
#define H5D_MPIO_NO_COLLECTIVE_CAUSE_DEF H5D_MPIO_COLLECTIVE
+#ifdef H5_HAVE_PARALLEL
/* Definitions for memory MPI type property */
#define H5FD_MPI_XFER_MEM_MPI_TYPE_SIZE sizeof(MPI_Datatype)
#define H5FD_MPI_XFER_MEM_MPI_TYPE_DEF MPI_DATATYPE_NULL
@@ -116,6 +141,8 @@
/* Definitions for EDC property */
#define H5D_XFER_EDC_SIZE sizeof(H5Z_EDC_t)
#define H5D_XFER_EDC_DEF H5Z_ENABLE_EDC
+#define H5D_XFER_EDC_ENC H5P__dxfr_edc_enc
+#define H5D_XFER_EDC_DEC H5P__dxfr_edc_dec
/* Definitions for filter callback function property */
#define H5D_XFER_FILTER_CB_SIZE sizeof(H5Z_cb_t)
#define H5D_XFER_FILTER_CB_DEF {NULL,NULL}
@@ -125,6 +152,8 @@
/* Definitions for data transform property */
#define H5D_XFER_XFORM_SIZE sizeof(void *)
#define H5D_XFER_XFORM_DEF NULL
+#define H5D_XFER_XFORM_ENC H5P__dxfr_xform_enc
+#define H5D_XFER_XFORM_DEC H5P__dxfr_xform_dec
#define H5D_XFER_XFORM_DEL H5P__dxfr_xform_del
#define H5D_XFER_XFORM_COPY H5P__dxfr_xform_copy
#define H5D_XFER_XFORM_CMP H5P__dxfr_xform_cmp
@@ -148,6 +177,20 @@
static herr_t H5P__dxfr_reg_prop(H5P_genclass_t *pclass);
/* Property list callbacks */
+static herr_t H5P__dxfr_bkgr_buf_type_enc(const void *value, void **pp, size_t *size);
+static herr_t H5P__dxfr_bkgr_buf_type_dec(const void **pp, void *value);
+static herr_t H5P__dxfr_btree_split_ratio_enc(const void *value, void **pp, size_t *size);
+static herr_t H5P__dxfr_btree_split_ratio_dec(const void **pp, void *value);
+static herr_t H5P__dxfr_io_xfer_mode_enc(const void *value, void **pp, size_t *size);
+static herr_t H5P__dxfr_io_xfer_mode_dec(const void **pp, void *value);
+static herr_t H5P__dxfr_mpio_collective_opt_enc(const void *value, void **pp, size_t *size);
+static herr_t H5P__dxfr_mpio_collective_opt_dec(const void **pp, void *value);
+static herr_t H5P__dxfr_mpio_chunk_opt_hard_enc(const void *value, void **pp, size_t *size);
+static herr_t H5P__dxfr_mpio_chunk_opt_hard_dec(const void **pp, void *value);
+static herr_t H5P__dxfr_edc_enc(const void *value, void **pp, size_t *size);
+static herr_t H5P__dxfr_edc_dec(const void **pp, void *value);
+static herr_t H5P__dxfr_xform_enc(const void *value, void **pp, size_t *size);
+static herr_t H5P__dxfr_xform_dec(const void **pp, void *value);
static herr_t H5P__dxfr_xform_del(hid_t prop_id, const char* name, size_t size, void* value);
static herr_t H5P__dxfr_xform_copy(const char* name, size_t size, void* value);
static int H5P__dxfr_xform_cmp(const void *value1, const void *value2, size_t size);
@@ -180,6 +223,39 @@ const H5P_libclass_t H5P_CLS_DXFR[1] = {{
/*****************************/
+/***************************/
+/* Local Private Variables */
+/***************************/
+
+/* Property value defaults */
+static const size_t H5D_def_max_temp_buf_g = H5D_XFER_MAX_TEMP_BUF_DEF; /* Default value for maximum temp buffer size */
+static const void *H5D_def_tconv_buf_g = H5D_XFER_TCONV_BUF_DEF; /* Default value for type conversion buffer */
+static const void *H5D_def_bkgr_buf_g = H5D_XFER_BKGR_BUF_DEF; /* Default value for background buffer */
+static const H5T_bkg_t H5D_def_bkgr_buf_type_g = H5D_XFER_BKGR_BUF_TYPE_DEF;
+static const double H5D_def_btree_split_ratio_g[3] = H5D_XFER_BTREE_SPLIT_RATIO_DEF; /* Default value for B-tree node split ratios */
+static const H5MM_allocate_t H5D_def_vlen_alloc_g = H5D_XFER_VLEN_ALLOC_DEF; /* Default value for vlen allocation function */
+static const void *H5D_def_vlen_alloc_info_g = H5D_XFER_VLEN_ALLOC_INFO_DEF; /* Default value for vlen allocation information */
+static const H5MM_free_t H5D_def_vlen_free_g = H5D_XFER_VLEN_FREE_DEF; /* Default value for vlen free function */
+static const void *H5D_def_vlen_free_info_g = H5D_XFER_VLEN_FREE_INFO_DEF; /* Default value for vlen free information */
+static const size_t H5D_def_hyp_vec_size_g = H5D_XFER_HYPER_VECTOR_SIZE_DEF; /* Default value for vector size */
+static const H5FD_mpio_xfer_t H5D_def_io_xfer_mode_g = H5D_XFER_IO_XFER_MODE_DEF; /* Default value for I/O transfer mode */
+static const H5FD_mpio_chunk_opt_t H5D_def_mpio_chunk_opt_mode_g = H5D_XFER_MPIO_CHUNK_OPT_HARD_DEF;
+static const H5FD_mpio_collective_opt_t H5D_def_mpio_collective_opt_mode_g = H5D_XFER_MPIO_COLLECTIVE_OPT_DEF;
+static const unsigned H5D_def_mpio_chunk_opt_num_g = H5D_XFER_MPIO_CHUNK_OPT_NUM_DEF;
+static const unsigned H5D_def_mpio_chunk_opt_ratio_g = H5D_XFER_MPIO_CHUNK_OPT_RATIO_DEF;
+static const H5D_mpio_actual_chunk_opt_mode_t H5D_def_mpio_actual_chunk_opt_mode_g = H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_DEF;
+static const H5D_mpio_actual_io_mode_t H5D_def_mpio_actual_io_mode_g = H5D_MPIO_ACTUAL_IO_MODE_DEF;
+static const H5D_mpio_no_collective_cause_t H5D_def_mpio_no_collective_cause_g = H5D_MPIO_NO_COLLECTIVE_CAUSE_DEF;
+#ifdef H5_HAVE_PARALLEL
+static const MPI_Datatype H5D_def_btype_g = H5FD_MPI_XFER_MEM_MPI_TYPE_DEF; /* Default value for MPI buffer type */
+static const MPI_Datatype H5D_def_ftype_g = H5FD_MPI_XFER_FILE_MPI_TYPE_DEF; /* Default value for MPI file type */
+#endif /* H5_HAVE_PARALLEL */
+static const H5Z_EDC_t H5D_def_enable_edc_g = H5D_XFER_EDC_DEF; /* Default value for EDC property */
+static const H5Z_cb_t H5D_def_filter_cb_g = H5D_XFER_FILTER_CB_DEF; /* Default value for filter callback */
+static const H5T_conv_cb_t H5D_def_conv_cb_g = H5D_XFER_CONV_CB_DEF; /* Default value for datatype conversion callback */
+static const void *H5D_def_xfer_xform_g = H5D_XFER_XFORM_DEF; /* Default value for data transform */
+
+
/*-------------------------------------------------------------------------
* Function: H5P__dxfr_reg_prop
@@ -195,135 +271,157 @@ const H5P_libclass_t H5P_CLS_DXFR[1] = {{
static herr_t
H5P__dxfr_reg_prop(H5P_genclass_t *pclass)
{
- size_t def_max_temp_buf = H5D_XFER_MAX_TEMP_BUF_DEF; /* Default value for maximum temp buffer size */
- void *def_tconv_buf = H5D_XFER_TCONV_BUF_DEF; /* Default value for type conversion buffer */
- void *def_bkgr_buf = H5D_XFER_BKGR_BUF_DEF; /* Default value for background buffer */
- H5T_bkg_t def_bkgr_buf_type = H5D_XFER_BKGR_BUF_TYPE_DEF;
- double def_btree_split_ratio[3] = H5D_XFER_BTREE_SPLIT_RATIO_DEF; /* Default value for B-tree node split ratios */
- H5MM_allocate_t def_vlen_alloc = H5D_XFER_VLEN_ALLOC_DEF; /* Default value for vlen allocation function */
- void *def_vlen_alloc_info = H5D_XFER_VLEN_ALLOC_INFO_DEF; /* Default value for vlen allocation information */
- H5MM_free_t def_vlen_free = H5D_XFER_VLEN_FREE_DEF; /* Default value for vlen free function */
- void *def_vlen_free_info = H5D_XFER_VLEN_FREE_INFO_DEF; /* Default value for vlen free information */
- size_t def_hyp_vec_size = H5D_XFER_HYPER_VECTOR_SIZE_DEF; /* Default value for vector size */
H5C_tag_t tag = H5C_TAG_DEF; /* Default value for cache entry tag */
-#ifdef H5_HAVE_PARALLEL
- H5FD_mpio_xfer_t def_io_xfer_mode = H5D_XFER_IO_XFER_MODE_DEF; /* Default value for I/O transfer mode */
- H5FD_mpio_chunk_opt_t def_mpio_chunk_opt_mode = H5D_XFER_MPIO_CHUNK_OPT_HARD_DEF;
- H5FD_mpio_collective_opt_t def_mpio_collective_opt_mode = H5D_XFER_MPIO_COLLECTIVE_OPT_DEF;
- unsigned def_mpio_chunk_opt_num = H5D_XFER_MPIO_CHUNK_OPT_NUM_DEF;
- unsigned def_mpio_chunk_opt_ratio = H5D_XFER_MPIO_CHUNK_OPT_RATIO_DEF;
- H5D_mpio_actual_chunk_opt_mode_t def_mpio_actual_chunk_opt_mode = H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_DEF;
- H5D_mpio_actual_io_mode_t def_mpio_actual_io_mode = H5D_MPIO_ACTUAL_IO_MODE_DEF;
- H5D_mpio_no_collective_cause_t def_mpio_no_collective_cause = H5D_MPIO_NO_COLLECTIVE_CAUSE_DEF;
- MPI_Datatype btype = H5FD_MPI_XFER_MEM_MPI_TYPE_DEF; /* Default value for MPI buffer type */
- MPI_Datatype ftype = H5FD_MPI_XFER_FILE_MPI_TYPE_DEF; /* Default value for MPI file type */
-#endif /* H5_HAVE_PARALLEL */
- H5Z_EDC_t enable_edc = H5D_XFER_EDC_DEF; /* Default value for EDC property */
- H5Z_cb_t filter_cb = H5D_XFER_FILTER_CB_DEF; /* Default value for filter callback */
- H5T_conv_cb_t conv_cb = H5D_XFER_CONV_CB_DEF; /* Default value for datatype conversion callback */
- void *def_xfer_xform = H5D_XFER_XFORM_DEF; /* Default value for data transform */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Register the max. temp buffer size property */
- if(H5P_register_real(pclass, H5D_XFER_MAX_TEMP_BUF_NAME, H5D_XFER_MAX_TEMP_BUF_SIZE, &def_max_temp_buf, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5D_XFER_MAX_TEMP_BUF_NAME, H5D_XFER_MAX_TEMP_BUF_SIZE, &H5D_def_max_temp_buf_g,
+ NULL, NULL, NULL, H5D_XFER_MAX_TEMP_BUF_ENC, H5D_XFER_MAX_TEMP_BUF_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the cache tag property */
- if(H5P_register_real(pclass, H5C_TAG_NAME, H5C_TAG_SIZE, &tag, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5C_TAG_NAME, H5C_TAG_SIZE, &tag, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the type conversion buffer property */
- if(H5P_register_real(pclass, H5D_XFER_TCONV_BUF_NAME, H5D_XFER_TCONV_BUF_SIZE, &def_tconv_buf, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5D_XFER_TCONV_BUF_NAME, H5D_XFER_TCONV_BUF_SIZE, &H5D_def_tconv_buf_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the background buffer property */
- if(H5P_register_real(pclass, H5D_XFER_BKGR_BUF_NAME, H5D_XFER_BKGR_BUF_SIZE, &def_bkgr_buf, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5D_XFER_BKGR_BUF_NAME, H5D_XFER_BKGR_BUF_SIZE, &H5D_def_bkgr_buf_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the background buffer type property */
- if(H5P_register_real(pclass, H5D_XFER_BKGR_BUF_TYPE_NAME, H5D_XFER_BKGR_BUF_TYPE_SIZE, &def_bkgr_buf_type, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5D_XFER_BKGR_BUF_TYPE_NAME, H5D_XFER_BKGR_BUF_TYPE_SIZE, &H5D_def_bkgr_buf_type_g,
+ NULL, NULL, NULL, H5D_XFER_BKGR_BUF_TYPE_ENC, H5D_XFER_BKGR_BUF_TYPE_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the B-Tree node splitting ratios property */
- if(H5P_register_real(pclass, H5D_XFER_BTREE_SPLIT_RATIO_NAME, H5D_XFER_BTREE_SPLIT_RATIO_SIZE, def_btree_split_ratio, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5D_XFER_BTREE_SPLIT_RATIO_NAME, H5D_XFER_BTREE_SPLIT_RATIO_SIZE, H5D_def_btree_split_ratio_g,
+ NULL, NULL, NULL, H5D_XFER_BTREE_SPLIT_RATIO_ENC, H5D_XFER_BTREE_SPLIT_RATIO_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the vlen allocation function property */
- if(H5P_register_real(pclass, H5D_XFER_VLEN_ALLOC_NAME, H5D_XFER_VLEN_ALLOC_SIZE, &def_vlen_alloc, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5D_XFER_VLEN_ALLOC_NAME, H5D_XFER_VLEN_ALLOC_SIZE, &H5D_def_vlen_alloc_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the vlen allocation information property */
- if(H5P_register_real(pclass, H5D_XFER_VLEN_ALLOC_INFO_NAME, H5D_XFER_VLEN_ALLOC_INFO_SIZE, &def_vlen_alloc_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5D_XFER_VLEN_ALLOC_INFO_NAME, H5D_XFER_VLEN_ALLOC_INFO_SIZE, &H5D_def_vlen_alloc_info_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the vlen free function property */
- if(H5P_register_real(pclass, H5D_XFER_VLEN_FREE_NAME, H5D_XFER_VLEN_FREE_SIZE, &def_vlen_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5D_XFER_VLEN_FREE_NAME, H5D_XFER_VLEN_FREE_SIZE, &H5D_def_vlen_free_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the vlen free information property */
- if(H5P_register_real(pclass, H5D_XFER_VLEN_FREE_INFO_NAME, H5D_XFER_VLEN_FREE_INFO_SIZE, &def_vlen_free_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5D_XFER_VLEN_FREE_INFO_NAME, H5D_XFER_VLEN_FREE_INFO_SIZE, &H5D_def_vlen_free_info_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the vector size property */
- if(H5P_register_real(pclass, H5D_XFER_HYPER_VECTOR_SIZE_NAME, H5D_XFER_HYPER_VECTOR_SIZE_SIZE, &def_hyp_vec_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5D_XFER_HYPER_VECTOR_SIZE_NAME, H5D_XFER_HYPER_VECTOR_SIZE_SIZE, &H5D_def_hyp_vec_size_g,
+ NULL, NULL, NULL, H5D_XFER_HYPER_VECTOR_SIZE_ENC, H5D_XFER_HYPER_VECTOR_SIZE_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-#ifdef H5_HAVE_PARALLEL
/* Register the I/O transfer mode properties */
- if(H5P_register_real(pclass, H5D_XFER_IO_XFER_MODE_NAME, H5D_XFER_IO_XFER_MODE_SIZE, &def_io_xfer_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5D_XFER_IO_XFER_MODE_NAME, H5D_XFER_IO_XFER_MODE_SIZE, &H5D_def_io_xfer_mode_g,
+ NULL, NULL, NULL, H5D_XFER_IO_XFER_MODE_ENC, H5D_XFER_IO_XFER_MODE_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- if(H5P_register_real(pclass, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE, &def_mpio_collective_opt_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE, &H5D_def_mpio_collective_opt_mode_g,
+ NULL, NULL, NULL, H5D_XFER_MPIO_COLLECTIVE_OPT_ENC, H5D_XFER_MPIO_COLLECTIVE_OPT_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, H5D_XFER_MPIO_CHUNK_OPT_HARD_SIZE, &def_mpio_chunk_opt_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, H5D_XFER_MPIO_CHUNK_OPT_HARD_SIZE, &H5D_def_mpio_chunk_opt_mode_g,
+ NULL, NULL, NULL, H5D_XFER_MPIO_CHUNK_OPT_HARD_ENC, H5D_XFER_MPIO_CHUNK_OPT_HARD_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, H5D_XFER_MPIO_CHUNK_OPT_NUM_SIZE, &def_mpio_chunk_opt_num, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, H5D_XFER_MPIO_CHUNK_OPT_NUM_SIZE, &H5D_def_mpio_chunk_opt_num_g,
+ NULL, NULL, NULL, H5D_XFER_MPIO_CHUNK_OPT_NUM_ENC, H5D_XFER_MPIO_CHUNK_OPT_NUM_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, H5D_XFER_MPIO_CHUNK_OPT_RATIO_SIZE, &def_mpio_chunk_opt_ratio, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, H5D_XFER_MPIO_CHUNK_OPT_RATIO_SIZE, &H5D_def_mpio_chunk_opt_ratio_g,
+ NULL, NULL, NULL, H5D_XFER_MPIO_CHUNK_OPT_RATIO_ENC, H5D_XFER_MPIO_CHUNK_OPT_RATIO_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the chunk optimization mode property. */
- if(H5P_register_real(pclass, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_SIZE, &def_mpio_actual_chunk_opt_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_SIZE, &H5D_def_mpio_actual_chunk_opt_mode_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the actual I/O mode property. */
- if(H5P_register_real(pclass, H5D_MPIO_ACTUAL_IO_MODE_NAME, H5D_MPIO_ACTUAL_IO_MODE_SIZE, &def_mpio_actual_io_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5D_MPIO_ACTUAL_IO_MODE_NAME, H5D_MPIO_ACTUAL_IO_MODE_SIZE, &H5D_def_mpio_actual_io_mode_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the local cause of broken collective I/O */
- if(H5P_register_real(pclass, H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &def_mpio_no_collective_cause, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &H5D_def_mpio_no_collective_cause_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the global cause of broken collective I/O */
- if(H5P_register_real(pclass, H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &def_mpio_no_collective_cause, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &H5D_def_mpio_no_collective_cause_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+#ifdef H5_HAVE_PARALLEL
/* Register the MPI memory type property */
- if(H5P_register_real(pclass, H5FD_MPI_XFER_MEM_MPI_TYPE_NAME, H5FD_MPI_XFER_MEM_MPI_TYPE_SIZE,
- &btype, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5FD_MPI_XFER_MEM_MPI_TYPE_NAME, H5FD_MPI_XFER_MEM_MPI_TYPE_SIZE, &H5D_def_btype_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the MPI file type property */
- if(H5P_register_real(pclass, H5FD_MPI_XFER_FILE_MPI_TYPE_NAME, H5FD_MPI_XFER_FILE_MPI_TYPE_SIZE,
- &ftype, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5FD_MPI_XFER_FILE_MPI_TYPE_NAME, H5FD_MPI_XFER_FILE_MPI_TYPE_SIZE, &H5D_def_ftype_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
#endif /* H5_HAVE_PARALLEL */
/* Register the EDC property */
- if(H5P_register_real(pclass, H5D_XFER_EDC_NAME, H5D_XFER_EDC_SIZE, &enable_edc, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5D_XFER_EDC_NAME, H5D_XFER_EDC_SIZE, &H5D_def_enable_edc_g,
+ NULL, NULL, NULL, H5D_XFER_EDC_ENC, H5D_XFER_EDC_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the filter callback property */
- if(H5P_register_real(pclass, H5D_XFER_FILTER_CB_NAME, H5D_XFER_FILTER_CB_SIZE, &filter_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5D_XFER_FILTER_CB_NAME, H5D_XFER_FILTER_CB_SIZE, &H5D_def_filter_cb_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the type conversion callback property */
- if(H5P_register_real(pclass, H5D_XFER_CONV_CB_NAME, H5D_XFER_CONV_CB_SIZE, &conv_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5D_XFER_CONV_CB_NAME, H5D_XFER_CONV_CB_SIZE, &H5D_def_conv_cb_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the data transform property */
- if(H5P_register_real(pclass, H5D_XFER_XFORM_NAME, H5D_XFER_XFORM_SIZE, &def_xfer_xform, NULL, NULL, NULL, H5D_XFER_XFORM_DEL, H5D_XFER_XFORM_COPY, H5D_XFER_XFORM_CMP, H5D_XFER_XFORM_CLOSE) < 0)
+ if(H5P_register_real(pclass, H5D_XFER_XFORM_NAME, H5D_XFER_XFORM_SIZE, &H5D_def_xfer_xform_g,
+ NULL, NULL, NULL, H5D_XFER_XFORM_ENC, H5D_XFER_XFORM_DEC,
+ H5D_XFER_XFORM_DEL, H5D_XFER_XFORM_COPY, H5D_XFER_XFORM_CMP, H5D_XFER_XFORM_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
@@ -331,10 +429,300 @@ done:
} /* end H5P__dxfr_reg_prop() */
+/*-------------------------------------------------------------------------
+ * Function: H5P__dxfr_bkgr_buf_type_enc
+ *
+ * Purpose: Callback routine which is called whenever the background
+ * buffer type property in the dataset transfer property list
+ * is encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 3, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dxfr_bkgr_buf_type_enc(const void *value, void **_pp, size_t *size)
+{
+ const H5T_bkg_t *bkgr_buf_type = (const H5T_bkg_t *)value; /* Create local alias for values */
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(bkgr_buf_type);
+ HDassert(size);
+
+ if(NULL != *pp)
+ /* Encode background buffer type */
+ *(*pp)++ = (uint8_t)*bkgr_buf_type;
+
+ /* Size of background buffer type */
+ (*size)++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__dxfr_bkgr_buf_type_enc() */
/*-------------------------------------------------------------------------
- * Function: H5P_dxfr_xform_del
+ * Function: H5P__dxfr_bkgr_buf_type_dec
+ *
+ * Purpose: Callback routine which is called whenever the background
+ * buffer type property in the dataset transfer property list
+ * is decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 3, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dxfr_bkgr_buf_type_dec(const void **_pp, void *_value)
+{
+ H5T_bkg_t *bkgr_buf_type = (H5T_bkg_t *)_value; /* Background buffer type */
+ const uint8_t **pp = (const uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(bkgr_buf_type);
+
+ /* Decode background buffer type */
+ *bkgr_buf_type = (H5T_bkg_t)*(*pp)++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__dxfr_bkgr_buf_type_dec() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dxfr_btree_split_ratio_enc
+ *
+ * Purpose: Callback routine which is called whenever the B-tree split
+ * ratio property in the dataset transfer property list
+ * is encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 3, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dxfr_btree_split_ratio_enc(const void *value, void **_pp, size_t *size)
+{
+ const double *btree_split_ratio = (const double *)value; /* Create local alias for values */
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(btree_split_ratio);
+ HDassert(size);
+
+ if(NULL != *pp) {
+ /* Encode the size of a double*/
+ *(*pp)++ = (uint8_t)sizeof(double);
+
+ /* Encode the left split value */
+ H5_ENCODE_DOUBLE(*pp, *(const double *)btree_split_ratio)
+ btree_split_ratio++;
+
+ /* Encode the middle split value */
+ H5_ENCODE_DOUBLE(*pp, *(const double *)btree_split_ratio)
+ btree_split_ratio++;
+
+ /* Encode the right split value */
+ H5_ENCODE_DOUBLE(*pp, *(const double *)btree_split_ratio)
+ } /* end if */
+
+ /* Size of B-tree split ratio values */
+ *size += 1 + (3 * sizeof(double));
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__dxfr_btree_split_ratio_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dxfr_btree_split_ratio_dec
+ *
+ * Purpose: Callback routine which is called whenever the B-tree split
+ * ratio property in the dataset transfer property list
+ * is decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 3, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dxfr_btree_split_ratio_dec(const void **_pp, void *_value)
+{
+ double *btree_split_ratio = (double *)_value; /* B-tree split ratio */
+ unsigned enc_size; /* Size of encoded property */
+ const uint8_t **pp = (const uint8_t **)_pp;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(btree_split_ratio);
+
+ /* Decode the size */
+ enc_size = *(*pp)++;
+ if(enc_size != sizeof(double))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "double value can't be decoded")
+
+ /* Decode the left, middle & left B-tree split ratios */
+ H5_DECODE_DOUBLE(*pp, btree_split_ratio[0])
+ H5_DECODE_DOUBLE(*pp, btree_split_ratio[1])
+ H5_DECODE_DOUBLE(*pp, btree_split_ratio[2])
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__dxfr_btree_split_ratio_dec() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dxfr_xform_enc
+ *
+ * Purpose: Callback routine which is called whenever the data transform
+ * property in the dataset transfer property list
+ * is encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Monday, August 6, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dxfr_xform_enc(const void *value, void **_pp, size_t *size)
+{
+ const H5Z_data_xform_t *data_xform_prop = *(const H5Z_data_xform_t * const *)value; /* Create local alias for values */
+ const char *pexp = NULL; /* Pointer to transform expression */
+ size_t len = 0; /* Length of transform expression */
+ uint8_t **pp = (uint8_t **)_pp;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
+ HDassert(size);
+
+ /* Check for data transform set */
+ if(NULL != data_xform_prop) {
+ /* Get the transform expression */
+ if(NULL == (pexp = H5Z_xform_extract_xform_str(data_xform_prop)))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "failed to retrieve transform expression")
+
+ /* Get the transform string expression size */
+ len = HDstrlen(pexp) + 1;
+ } /* end if */
+
+ if(NULL != *pp) {
+ uint64_t enc_value;
+ unsigned enc_size;
+
+ /* encode the length of the prefix */
+ enc_value = (uint64_t)len;
+ enc_size = H5V_limit_enc_size(enc_value);
+ HDassert(enc_size < 256);
+ *(*pp)++ = (uint8_t)enc_size;
+ UINT64ENCODE_VAR(*pp, enc_value, enc_size);
+
+ if(NULL != data_xform_prop) {
+ /* Sanity check */
+ HDassert(pexp);
+
+ /* Copy the expression into the buffer */
+ HDmemcpy(*pp, (const uint8_t *)pexp, len);
+ *pp += len;
+ *pp[0] = '\0';
+ } /* end if */
+ } /* end if */
+
+ /* Size of encoded data transform */
+ *size += (1 + H5V_limit_enc_size((uint64_t)len));
+ if(NULL != pexp)
+ *size += len;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__dxfr_xform_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dxfr_xform_dec
+ *
+ * Purpose: Callback routine which is called whenever the data transform
+ * property in the dataset transfer property list
+ * is decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Monday, August 6, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dxfr_xform_dec(const void **_pp, void *_value)
+{
+ H5Z_data_xform_t **data_xform_prop = (H5Z_data_xform_t **)_value; /* New data xform property */
+ size_t len; /* Length of encoded string */
+ const uint8_t **pp = (const uint8_t **)_pp;
+ unsigned enc_size;
+ uint64_t enc_value;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(data_xform_prop);
+ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
+
+ /* Decode the length of xform expression */
+ enc_size = *(*pp)++;
+ HDassert(enc_size < 256);
+ UINT64DECODE_VAR(*pp, enc_value, enc_size);
+ len = (size_t)enc_value;
+
+ if(0 != len) {
+ if(NULL == (*data_xform_prop = H5Z_xform_create((const char *)*pp)))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create data transform info")
+ *pp += len;
+ } /* end if */
+ else
+ *data_xform_prop = H5D_XFER_XFORM_DEF;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__dxfr_xform_dec() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dxfr_xform_del
*
* Purpose: Frees memory allocated by H5P_dxfr_xform_set
*
@@ -1301,6 +1689,225 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_hyper_vector_size() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dxfr_io_xfer_mode_enc
+ *
+ * Purpose: Callback routine which is called whenever the I/O transfer
+ * mode property in the dataset transfer property list
+ * is encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 3, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dxfr_io_xfer_mode_enc(const void *value, void **_pp, size_t *size)
+{
+ const H5FD_mpio_xfer_t *xfer_mode = (const H5FD_mpio_xfer_t *)value; /* Create local alias for values */
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(xfer_mode);
+ HDassert(size);
+
+ if(NULL != *pp)
+ /* Encode I/O transfer mode */
+ *(*pp)++ = (uint8_t)*xfer_mode;
+
+ /* Size of I/O transfer mode */
+ (*size)++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__dxfr_io_xfer_mode_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dxfr_io_xfer_mode_dec
+ *
+ * Purpose: Callback routine which is called whenever the I/O transfer
+ * mode property in the dataset transfer property list
+ * is decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 3, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dxfr_io_xfer_mode_dec(const void **_pp, void *_value)
+{
+ H5FD_mpio_xfer_t *xfer_mode = (H5FD_mpio_xfer_t *)_value; /* I/O transfer mode */
+ const uint8_t **pp = (const uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(xfer_mode);
+
+ /* Decode I/O transfer mode */
+ *xfer_mode = (H5FD_mpio_xfer_t)*(*pp)++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__dxfr_io_xfer_mode_dec() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dxfr_mpio_collective_opt_enc
+ *
+ * Purpose: Callback routine which is called whenever the MPI-I/O
+ * collective optimization property in the dataset transfer
+ * property list is encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 3, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dxfr_mpio_collective_opt_enc(const void *value, void **_pp, size_t *size)
+{
+ const H5FD_mpio_collective_opt_t *coll_opt = (const H5FD_mpio_collective_opt_t *)value; /* Create local alias for values */
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(coll_opt);
+ HDassert(size);
+
+ if(NULL != *pp)
+ /* Encode MPI-I/O collective optimization property */
+ *(*pp)++ = (uint8_t)*coll_opt;
+
+ /* Size of MPI-I/O collective optimization property */
+ (*size)++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__dxfr_mpio_collective_opt_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dxfr_mpio_collective_opt_dec
+ *
+ * Purpose: Callback routine which is called whenever the MPI-I/O
+ * collective optimization property in the dataset transfer
+ * property list is decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 3, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dxfr_mpio_collective_opt_dec(const void **_pp, void *_value)
+{
+ H5FD_mpio_collective_opt_t *coll_opt = (H5FD_mpio_collective_opt_t *)_value; /* MPI-I/O collective optimization mode */
+ const uint8_t **pp = (const uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(coll_opt);
+
+ /* Decode MPI-I/O collective optimization mode */
+ *coll_opt = (H5FD_mpio_collective_opt_t)*(*pp)++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__dxfr_mpio_collective_opt_dec() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dxfr_mpio_chunk_opt_hard_enc
+ *
+ * Purpose: Callback routine which is called whenever the MPI-I/O
+ * chunk optimization property in the dataset transfer
+ * property list is encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 3, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dxfr_mpio_chunk_opt_hard_enc(const void *value, void **_pp, size_t *size)
+{
+ const H5FD_mpio_chunk_opt_t *chunk_opt = (const H5FD_mpio_chunk_opt_t *)value; /* Create local alias for values */
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(chunk_opt);
+ HDassert(size);
+
+ if(NULL != *pp)
+ /* Encode MPI-I/O chunk optimization property */
+ *(*pp)++ = (uint8_t)*chunk_opt;
+
+ /* Size of MPI-I/O chunk optimization property */
+ (*size)++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__dxfr_mpio_chunk_opt_hard_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dxfr_mpio_chunk_opt_hard_enc
+ *
+ * Purpose: Callback routine which is called whenever the MPI-I/O
+ * chunk collective optimization property in the dataset transfer
+ * property list is decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 3, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dxfr_mpio_chunk_opt_hard_dec(const void **_pp, void *_value)
+{
+ H5FD_mpio_chunk_opt_t *chunk_opt = (H5FD_mpio_chunk_opt_t *)_value; /* MPI-I/O chunk optimization mode */
+ const uint8_t **pp = (const uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(chunk_opt);
+
+ /* Decode MPI-I/O chunk optimization mode */
+ *chunk_opt = (H5FD_mpio_chunk_opt_t)*(*pp)++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__dxfr_mpio_chunk_opt_hard_dec() */
+
#ifdef H5_HAVE_PARALLEL
/*-------------------------------------------------------------------------
@@ -1391,7 +1998,7 @@ H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_ca
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*Dn*Dn", plist_id, local_no_collective_cause,
+ H5TRACE3("e", "i*Iu*Iu", plist_id, local_no_collective_cause,
global_no_collective_cause);
/* Get the plist structure */
@@ -1413,3 +2020,76 @@ done:
#endif /* H5_HAVE_PARALLEL */
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dxfr_edc_enc
+ *
+ * Purpose: Callback routine which is called whenever the error detect
+ * property in the dataset transfer property list
+ * is encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 3, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dxfr_edc_enc(const void *value, void **_pp, size_t *size)
+{
+ const H5Z_EDC_t *check = (const H5Z_EDC_t *)value; /* Create local alias for values */
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(check);
+ HDassert(size);
+
+ if(NULL != *pp)
+ /* Encode EDC property */
+ *(*pp)++ = (uint8_t)*check;
+
+ /* Size of EDC property */
+ (*size)++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__dxfr_edc_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dxfr_edc_dec
+ *
+ * Purpose: Callback routine which is called whenever the error detect
+ * property in the dataset transfer property list
+ * is decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 3, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dxfr_edc_dec(const void **_pp, void *_value)
+{
+ H5Z_EDC_t *check = (H5Z_EDC_t *)_value; /* EDC property */
+ const uint8_t **pp = (const uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(check);
+
+ /* Decode EDC property */
+ *check = (H5Z_EDC_t)*(*pp)++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__dxfr_edc_dec() */
+
diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c
new file mode 100644
index 0000000..ff148b0
--- /dev/null
+++ b/src/H5Pencdec.c
@@ -0,0 +1,813 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ *
+ * Purpose: Generic Property Functions
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#define H5P_PACKAGE /*suppress error about including H5Ppkg */
+
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5P_init_encdec_interface
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Ppkg.h" /* Property lists */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+/* Version # of encoded property lists */
+#define H5P_ENCODE_VERS 0
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/* Typedef for iterator when encoding a property list */
+typedef struct {
+ hbool_t encode; /* Whether the property list should be encoded */
+ size_t *enc_size_ptr; /* Pointer to size of encoded buffer */
+ void **pp; /* Pointer to encoding buffer pointer */
+} H5P_enc_iter_ud_t;
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+
+/*--------------------------------------------------------------------------
+NAME
+ H5P_init_encdec_interface -- Initialize interface-specific information
+USAGE
+ herr_t H5P_init_encdec_interface()
+RETURNS
+ Non-negative on success/Negative on failure
+DESCRIPTION
+ Initializes any interface-specific data or routines. (Just calls
+ H5P_init() currently).
+
+--------------------------------------------------------------------------*/
+static herr_t
+H5P_init_encdec_interface(void)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ FUNC_LEAVE_NOAPI(H5P_init())
+} /* H5P_init_encdec_interface() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__encode_size_t
+ *
+ * Purpose: Generic encoding callback routine for 'size_t' properties.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Sunday, July 29, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P__encode_size_t(const void *value, void **_pp, size_t *size)
+{
+ uint64_t enc_value = (uint64_t)*(const size_t *)value; /* Property value to encode */
+ uint8_t **pp = (uint8_t **)_pp;
+ unsigned enc_size = H5V_limit_enc_size(enc_value); /* Size of encoded property */
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity checks */
+ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
+ HDassert(enc_size < 256);
+ HDassert(size);
+
+ if(NULL != *pp) {
+ /* Encode the size */
+ *(*pp)++ = (uint8_t)enc_size;
+
+ /* Encode the value */
+ UINT64ENCODE_VAR(*pp, enc_value, enc_size);
+ } /* end if */
+
+ /* Set size needed for encoding */
+ *size += (1 + enc_size);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__encode_size_t() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__encode_hsize_t
+ *
+ * Purpose: Generic encoding callback routine for 'hsize_t' properties.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * August 07, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P__encode_hsize_t(const void *value, void **_pp, size_t *size)
+{
+ uint64_t enc_value = (uint64_t)*(const hsize_t *)value; /* Property value to encode */
+ unsigned enc_size = H5V_limit_enc_size(enc_value); /* Size of encoded property */
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity checks */
+ HDcompile_assert(sizeof(hsize_t) <= sizeof(uint64_t));
+ HDassert(enc_size < 256);
+ HDassert(size);
+
+ if(NULL != *pp) {
+ *(*pp)++ = (uint8_t)enc_size;
+
+ /* Encode the value */
+ UINT64ENCODE_VAR(*pp, enc_value, enc_size);
+ } /* end if */
+
+ /* Set size needed for encoding */
+ *size += (1 + enc_size);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__encode_hsize_t() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__encode_unsigned
+ *
+ * Purpose: Generic encoding callback routine for 'unsigned' properties.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Sunday, July 29, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P__encode_unsigned(const void *value, void **_pp, size_t *size)
+{
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity checks */
+ HDassert(value);
+ HDassert(size);
+
+ if(NULL != *pp) {
+ /* Encode the size */
+ *(*pp)++ = (uint8_t)sizeof(unsigned);
+
+ /* Encode the value */
+ H5_ENCODE_UNSIGNED(*pp, *(const unsigned *)value)
+ } /* end if */
+
+ /* Set size needed for encoding */
+ *size += (1 + sizeof(unsigned));
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__encode_unsigned() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__encode_uint8_t
+ *
+ * Purpose: Generic encoding callback routine for 'uint8_t' properties.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * August 07, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P__encode_uint8_t(const void *value, void **_pp, size_t *size)
+{
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity checks */
+ HDassert(value);
+ HDassert(size);
+
+ if(NULL != *pp) {
+ /* Encode the value */
+ *(*pp)++ = *(const uint8_t *)value;
+ } /* end if */
+
+ /* Set size needed for encoding */
+ *size += 1;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__encode_uint8_t() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__encode_hbool_t
+ *
+ * Purpose: Generic encoding callback routine for 'hbool_t' properties.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * August 15, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P__encode_hbool_t(const void *value, void **_pp, size_t *size)
+{
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity checks */
+ HDassert(value);
+ HDassert(size);
+
+ if(NULL != *pp)
+ /* Encode the value */
+ *(*pp)++ = (uint8_t)*(const hbool_t *)value;
+
+ /* Set size needed for encoding */
+ *size += 1;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__encode_hbool_t() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__encode_double
+ *
+ * Purpose: Generic encoding callback routine for 'double' properties.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Sunday, July 29, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P__encode_double(const void *value, void **_pp, size_t *size)
+{
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity checks */
+ HDassert(value);
+ HDassert(size);
+
+ if(NULL != *pp) {
+ /* Encode the size */
+ *(*pp)++ = (uint8_t)sizeof(double);
+
+ /* Encode the value */
+ H5_ENCODE_DOUBLE(*pp, *(const double *)value)
+ } /* end if */
+
+ /* Set size needed for encoding */
+ *size += (1 + sizeof(double));
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__encode_double() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5P__encode_cb
+ PURPOSE
+ Internal callback routine when iterating over properties while encoding
+ a property list.
+ USAGE
+ int H5P__encode_cb(item, key, udata)
+ H5P_genprop_t *prop; IN: Pointer to the property
+ void *udata; IN/OUT: Pointer to iteration data from user
+ RETURNS
+ Success: H5_ITER_CONT
+ Fail: H5_ITER_ERROR
+ DESCRIPTION
+ This routine encodes a property in a property list
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static int
+H5P__encode_cb(H5P_genprop_t *prop, void *_udata)
+{
+ H5P_enc_iter_ud_t *udata = (H5P_enc_iter_ud_t *)_udata; /* Pointer to user data */
+ int ret_value = H5_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(prop);
+ HDassert(udata);
+
+ /* Check if this property can be encoded */
+ if(prop->encode) {
+ size_t prop_name_len; /* Length of property's name */
+ size_t prop_value_len; /* Encoded size of property's value */
+
+ /* Encode (or not, if the 'encode' flag is off) the property's name */
+ prop_name_len = HDstrlen(prop->name) + 1;
+ if(udata->encode) {
+ HDstrncpy((char *)*(udata->pp), prop->name, prop_name_len);
+ *(uint8_t **)(udata->pp) += prop_name_len;
+ } /* end if */
+ *(udata->enc_size_ptr) += prop_name_len;
+
+ /* Encode (or not, if *(udata->pp) is NULL) the property value */
+ prop_value_len = 0;
+ if((prop->encode)(prop->value, udata->pp, &prop_value_len) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, H5_ITER_ERROR, "property encoding routine failed")
+ *(udata->enc_size_ptr) += prop_value_len;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__encode_cb() */
+
+
+/*-------------------------------------------------------------------------
+ NAME
+ H5P__encode
+ PURPOSE
+ Internal routine to encode a property list into a binary buffer.
+ USAGE
+ herr_t H5P__encode(plist, enc_all_prop, buf, nalloc)
+ const H5P_genplist_t *plist; IN: Property list to encode
+ hbool_t enc_all_prop; IN: Whether to encode all properties (TRUE),
+ or just non-default (i.e. changed) properties (FALSE).
+ uint8_t *buf; OUT: buffer to hold the encoded plist
+ size_t *nalloc; IN/OUT: size of buffer needed to encode plist
+ RETURNS
+ Returns non-negative on success, negative on failure.
+ DESCRIPTION
+ Encodes a property list into a binary buffer. If the buffer is NULL, then
+ the call will set the size needed to encode the plist in nalloc. Otherwise
+ the routine will encode the plist in buf.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop, void *buf,
+ size_t *nalloc)
+{
+ H5P_enc_iter_ud_t udata; /* User data for property iteration callback */
+ uint8_t *p = (uint8_t *)buf; /* Temporary pointer to encoding buffer */
+ int idx; /* Index of property to start at */
+ size_t encode_size = 0; /* Size of buffer needed to encode properties */
+ hbool_t encode = TRUE; /* Whether the property list should be encoded */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ if(NULL == nalloc)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad allocation size pointer")
+
+ /* If the buffer is NULL, then this call to H5P__encode will return how much
+ * space is needed to encode a property.
+ */
+ if(NULL == p)
+ encode = FALSE;
+
+ /* Encode property list description info */
+ if(encode) {
+ /* Version # of property list encoding */
+ *p++ = (uint8_t)H5P_ENCODE_VERS;
+
+ /* Type of property list */
+ *p++ = (uint8_t)plist->pclass->type;
+ } /* end if */
+ encode_size += 2;
+
+ /* Initialize user data for iteration callback */
+ udata.encode = encode;
+ udata.enc_size_ptr = &encode_size;
+ udata.pp = (void **)&p;
+
+ /* Iterate over all properties in property list, encoding them */
+ idx = 0;
+ if(H5P_iterate_plist(plist, enc_all_prop, &idx, H5P__encode_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADITER, FAIL, "can't iterate over properties")
+
+ /* Encode a terminator for list of properties */
+ if(encode)
+ *p++ = 0;
+ encode_size++;
+
+ /* Set the size of the buffer needed/used to encode the property list */
+ *nalloc = encode_size;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__encode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__decode_size_t
+ *
+ * Purpose: Generic decoding callback routine for 'size_t' properties.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, August 2, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P__decode_size_t(const void **_pp, void *_value)
+{
+ size_t *value = (size_t *)_value; /* Property value to return */
+ const uint8_t **pp = (const uint8_t **)_pp;
+ uint64_t enc_value; /* Decoded property value */
+ unsigned enc_size; /* Size of encoded property */
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity check */
+ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(value);
+
+ /* Decode the size */
+ enc_size = *(*pp)++;
+ HDassert(enc_size < 256);
+
+ /* Decode the value */
+ UINT64DECODE_VAR(*pp, enc_value, enc_size);
+ H5_ASSIGN_OVERFLOW(*value, enc_value, uint64_t, size_t);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__decode_size_t() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__decode_hsize_t
+ *
+ * Purpose: Generic decoding callback routine for 'hsize_t' properties.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * August 07, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P__decode_hsize_t(const void **_pp, void *_value)
+{
+ hsize_t *value = (hsize_t *)_value; /* Property value to return */
+ const uint8_t **pp = (const uint8_t **)_pp;
+ uint64_t enc_value; /* Decoded property value */
+ unsigned enc_size; /* Size of encoded property */
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity check */
+ HDcompile_assert(sizeof(hsize_t) <= sizeof(uint64_t));
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(value);
+
+ /* Decode the size */
+ enc_size = *(*pp)++;
+ HDassert(enc_size < 256);
+
+ /* Decode the value */
+ UINT64DECODE_VAR(*pp, enc_value, enc_size);
+ H5_ASSIGN_OVERFLOW(*value, enc_value, uint64_t, hsize_t);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__decode_hsize_t() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__decode_unsigned
+ *
+ * Purpose: Generic decoding callback routine for 'unsigned' properties.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, August 2, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P__decode_unsigned(const void **_pp, void *_value)
+{
+ unsigned *value = (unsigned *)_value; /* Property value to return */
+ const uint8_t **pp = (const uint8_t **)_pp;
+ unsigned enc_size; /* Size of encoded property */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(value);
+
+ /* Decode the size */
+ enc_size = *(*pp)++;
+ if(enc_size != sizeof(unsigned))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded")
+
+ H5_DECODE_UNSIGNED(*pp, *value)
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__decode_unsigned() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__decode_uint8_t
+ *
+ * Purpose: Generic decoding callback routine for 'uint8_t' properties.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, August 2, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P__decode_uint8_t(const void **_pp, void *_value)
+{
+ uint8_t *value = (uint8_t *)_value; /* Property value to return */
+ const uint8_t **pp = (const uint8_t **)_pp;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(value);
+
+ /* Decode the value */
+ *value = *(*pp)++;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__decode_uint8_t() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__decode_hbool_t
+ *
+ * Purpose: Generic decoding callback routine for 'hbool_t' properties.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, August 15, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P__decode_hbool_t(const void **_pp, void *_value)
+{
+ hbool_t *value = (hbool_t *)_value; /* Property value to return */
+ const uint8_t **pp = (const uint8_t **)_pp;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(value);
+
+ /* Decode the value */
+ *value = (hbool_t)*(*pp)++;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__decode_hbool_t() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__decode_double
+ *
+ * Purpose: Generic decoding callback routine for 'double' properties.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, August 2, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P__decode_double(const void **_pp, void *_value)
+{
+ double *value = (double *)_value; /* Property value to return */
+ const uint8_t **pp = (const uint8_t **)_pp;
+ unsigned enc_size; /* Size of encoded property */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(value);
+
+ /* Decode the size */
+ enc_size = *(*pp)++;
+ if(enc_size != sizeof(double))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "double value can't be decoded")
+
+ H5_DECODE_DOUBLE(*pp, *value)
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__decode_double() */
+
+
+/*-------------------------------------------------------------------------
+ NAME
+ H5P__decode
+ PURPOSE
+ Internal routine to decode a property list from a binary buffer.
+ USAGE
+ H5P_genplist_t *H5P__decode(buf)
+ const void *buf; IN: buffer that holds the encoded plist
+ RETURNS
+ Returns non-negative ID of new property list object on success, negative
+ on failure.
+ DESCRIPTION
+ Decodes a property list from a binary buffer. The contents of the buffer
+ contain the values for the correponding properties of the plist. The decode
+ callback of a certain property decodes its value from the buffer and sets it
+ in the property list.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ Properties in the property list that are not encoded in the serialized
+ form retain their default value.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+hid_t
+H5P__decode(const void *buf)
+{
+ H5P_genplist_t *plist; /* Property list to decode into */
+ void *value_buf = NULL; /* Pointer to buffer to use when decoding values */
+ const uint8_t *p = (const uint8_t *)buf; /* Current pointer into buffer */
+ H5P_plist_type_t type; /* Type of encoded property list */
+ hid_t plist_id = -1; /* ID of new property list */
+ size_t value_buf_size = 0; /* Size of current value buffer */
+ uint8_t vers; /* Version of encoded property list */
+ hid_t ret_value; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ if(NULL == p)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "decode buffer is NULL")
+
+ /* Get the version number of the encoded property list */
+ vers = (uint8_t)*p++;
+ if((uint8_t)H5P_ENCODE_VERS != vers)
+ HGOTO_ERROR(H5E_PLIST, H5E_VERSION, FAIL, "bad version # of encoded information, expected %u, got %u", (unsigned)H5P_ENCODE_VERS, (unsigned)vers)
+
+ /* Get the type of the property list */
+ type = (H5P_plist_type_t)*p++;
+ if(type <= H5P_TYPE_USER || type > H5P_TYPE_LINK_ACCESS)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "bad type of encoded information: %u", (unsigned)type)
+
+ /* Create new property list of the specified type */
+ if((plist_id = H5P__new_plist_of_type(type)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_VERSION, FAIL, "can't create property list of type: %u\n", (unsigned)type);
+
+ /* Get the property list object */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property class")
+
+ /* Loop over encoded properties, deserializing their values */
+ while(p) {
+ H5P_genprop_t *prop; /* Pointer to property with same name */
+ const char *name; /* Pointer to property list name */
+
+ /* Check for end of serialized list of properties */
+ if(0 == *p)
+ break;
+
+ /* Get property list name */
+ name = (const char *)p;
+ p += HDstrlen(name) + 1;
+
+ /* Find property with name */
+ if(NULL == (prop = H5P__find_prop_plist(plist, name)))
+ HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist: '%s'", name)
+
+ /* Check if we should increase the size of the value buffer */
+ if(prop->size > value_buf_size) {
+ if(NULL == (value_buf = H5MM_realloc(value_buf, prop->size)))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "decoding buffer allocation failed")
+ value_buf_size = prop->size;
+ } /* end if */
+
+ /* Decode serialized value */
+ if(prop->decode) {
+ if((prop->decode)((const void **)&p, value_buf) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "property decoding routine failed, property: '%s'", name)
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "no decode callback for property: '%s', name")
+
+ /* Set the value for the property */
+ if(H5P_set(plist, name, value_buf) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value for property: '%s'", name)
+ } /* end while */
+
+ /* Set return value */
+ ret_value = plist_id;
+
+done:
+ /* Release resources */
+ if(value_buf)
+ value_buf = H5MM_xfree(value_buf);
+
+ /* Cleanup on error */
+ if(ret_value < 0) {
+ if(plist_id > 0 && H5I_dec_ref(plist_id) < 0)
+ HDONE_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "unable to close partially initialized property list")
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__decode() */
+
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 889cdc6..4faed4f 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -59,36 +59,57 @@
/* Definitions for the initial metadata cache resize configuration */
#define H5F_ACS_META_CACHE_INIT_CONFIG_SIZE sizeof(H5AC_cache_config_t)
#define H5F_ACS_META_CACHE_INIT_CONFIG_DEF H5AC__DEFAULT_CACHE_CONFIG
+#define H5F_ACS_META_CACHE_INIT_CONFIG_ENC H5P__facc_cache_config_enc
+#define H5F_ACS_META_CACHE_INIT_CONFIG_DEC H5P__facc_cache_config_dec
+#define H5F_ACS_META_CACHE_INIT_CONFIG_CMP H5P__facc_cache_config_cmp
/* Definitions for size of raw data chunk cache(slots) */
#define H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE sizeof(size_t)
#define H5F_ACS_DATA_CACHE_NUM_SLOTS_DEF 521
+#define H5F_ACS_DATA_CACHE_NUM_SLOTS_ENC H5P__encode_size_t
+#define H5F_ACS_DATA_CACHE_NUM_SLOTS_DEC H5P__decode_size_t
/* Definition for size of raw data chunk cache(bytes) */
#define H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE sizeof(size_t)
#define H5F_ACS_DATA_CACHE_BYTE_SIZE_DEF (1024*1024)
+#define H5F_ACS_DATA_CACHE_BYTE_SIZE_ENC H5P__encode_size_t
+#define H5F_ACS_DATA_CACHE_BYTE_SIZE_DEC H5P__decode_size_t
/* Definition for preemption read chunks first */
#define H5F_ACS_PREEMPT_READ_CHUNKS_SIZE sizeof(double)
#define H5F_ACS_PREEMPT_READ_CHUNKS_DEF 0.75f
+#define H5F_ACS_PREEMPT_READ_CHUNKS_ENC H5P__encode_double
+#define H5F_ACS_PREEMPT_READ_CHUNKS_DEC H5P__decode_double
/* Definition for threshold for alignment */
#define H5F_ACS_ALIGN_THRHD_SIZE sizeof(hsize_t)
#define H5F_ACS_ALIGN_THRHD_DEF 1
+#define H5F_ACS_ALIGN_THRHD_ENC H5P__encode_hsize_t
+#define H5F_ACS_ALIGN_THRHD_DEC H5P__decode_hsize_t
/* Definition for alignment */
#define H5F_ACS_ALIGN_SIZE sizeof(hsize_t)
#define H5F_ACS_ALIGN_DEF 1
+#define H5F_ACS_ALIGN_ENC H5P__encode_hsize_t
+#define H5F_ACS_ALIGN_DEC H5P__decode_hsize_t
/* Definition for minimum metadata allocation block size (when
aggregating metadata allocations. */
#define H5F_ACS_META_BLOCK_SIZE_SIZE sizeof(hsize_t)
#define H5F_ACS_META_BLOCK_SIZE_DEF 2048
+#define H5F_ACS_META_BLOCK_SIZE_ENC H5P__encode_hsize_t
+#define H5F_ACS_META_BLOCK_SIZE_DEC H5P__decode_hsize_t
/* Definition for maximum sieve buffer size (when data sieving
is allowed by file driver */
#define H5F_ACS_SIEVE_BUF_SIZE_SIZE sizeof(size_t)
#define H5F_ACS_SIEVE_BUF_SIZE_DEF (64*1024)
+#define H5F_ACS_SIEVE_BUF_SIZE_ENC H5P__encode_size_t
+#define H5F_ACS_SIEVE_BUF_SIZE_DEC H5P__decode_size_t
/* Definition for minimum "small data" allocation block size (when
aggregating "small" raw data allocations. */
#define H5F_ACS_SDATA_BLOCK_SIZE_SIZE sizeof(hsize_t)
#define H5F_ACS_SDATA_BLOCK_SIZE_DEF 2048
+#define H5F_ACS_SDATA_BLOCK_SIZE_ENC H5P__encode_hsize_t
+#define H5F_ACS_SDATA_BLOCK_SIZE_DEC H5P__decode_hsize_t
/* Definition for garbage-collect references */
#define H5F_ACS_GARBG_COLCT_REF_SIZE sizeof(unsigned)
#define H5F_ACS_GARBG_COLCT_REF_DEF 0
+#define H5F_ACS_GARBG_COLCT_REF_ENC H5P__encode_unsigned
+#define H5F_ACS_GARBG_COLCT_REF_DEC H5P__decode_unsigned
/* Definition for file driver ID */
#define H5F_ACS_FILE_DRV_ID_SIZE sizeof(hid_t)
#define H5F_ACS_FILE_DRV_ID_DEF H5_DEFAULT_VFD
@@ -98,9 +119,13 @@
/* Definition for file close degree */
#define H5F_CLOSE_DEGREE_SIZE sizeof(H5F_close_degree_t)
#define H5F_CLOSE_DEGREE_DEF H5F_CLOSE_DEFAULT
+#define H5F_CLOSE_DEGREE_ENC H5P__facc_fclose_degree_enc
+#define H5F_CLOSE_DEGREE_DEC H5P__facc_fclose_degree_dec
/* Definition for offset position in file for family file driver */
#define H5F_ACS_FAMILY_OFFSET_SIZE sizeof(hsize_t)
#define H5F_ACS_FAMILY_OFFSET_DEF 0
+#define H5F_ACS_FAMILY_OFFSET_ENC H5P__encode_hsize_t
+#define H5F_ACS_FAMILY_OFFSET_DEC H5P__decode_hsize_t
/* Definition for new member size of family driver. It's private
* property only used by h5repart */
#define H5F_ACS_FAMILY_NEWSIZE_SIZE sizeof(hsize_t)
@@ -112,9 +137,13 @@
/* Definition for data type in multi file driver */
#define H5F_ACS_MULTI_TYPE_SIZE sizeof(H5FD_mem_t)
#define H5F_ACS_MULTI_TYPE_DEF H5FD_MEM_DEFAULT
+#define H5F_ACS_MULTI_TYPE_ENC H5P__facc_multi_type_enc
+#define H5F_ACS_MULTI_TYPE_DEC H5P__facc_multi_type_dec
/* Definition for 'use latest format version' flag */
#define H5F_ACS_LATEST_FORMAT_SIZE sizeof(hbool_t)
#define H5F_ACS_LATEST_FORMAT_DEF FALSE
+#define H5F_ACS_LATEST_FORMAT_ENC H5P__encode_hbool_t
+#define H5F_ACS_LATEST_FORMAT_DEC H5P__decode_hbool_t
/* Definition for whether to query the file descriptor from the core VFD
* instead of the memory address. (Private to library)
*/
@@ -123,6 +152,8 @@
/* Definition for external file cache size */
#define H5F_ACS_EFC_SIZE_SIZE sizeof(unsigned)
#define H5F_ACS_EFC_SIZE_DEF 0
+#define H5F_ACS_EFC_SIZE_ENC H5P__encode_unsigned
+#define H5F_ACS_EFC_SIZE_DEC H5P__decode_unsigned
/* Definition of pointer to initial file image info */
#define H5F_ACS_FILE_IMAGE_INFO_SIZE sizeof(H5FD_file_image_info_t)
#define H5F_ACS_FILE_IMAGE_INFO_DEF H5FD_DEFAULT_FILE_IMAGE_INFO
@@ -155,6 +186,15 @@ static herr_t H5P_file_image_info_del(hid_t prop_id, const char *name, size_t si
static herr_t H5P_file_image_info_copy(const char *name, size_t size, void *value);
static herr_t H5P_file_image_info_close(const char *name, size_t size, void *value);
+/* encode & decode callbacks */
+static herr_t H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size);
+static herr_t H5P__facc_cache_config_dec(const void **_pp, void *value);
+static int H5P__facc_cache_config_cmp(const void *value1, const void *value2, size_t size);
+static herr_t H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size);
+static herr_t H5P__facc_fclose_degree_dec(const void **pp, void *value);
+static herr_t H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size);
+static herr_t H5P__facc_multi_type_dec(const void **_pp, void *value);
+
/*********************/
/* Package Variables */
@@ -186,6 +226,28 @@ const H5P_libclass_t H5P_CLS_FACC[1] = {{
/* Local Variables */
/*******************/
+/* Property value defaults */
+static const H5AC_cache_config_t H5F_def_mdc_initCacheCfg_g = H5F_ACS_META_CACHE_INIT_CONFIG_DEF; /* Default metadata cache settings */
+static const size_t H5F_def_rdcc_nslots_g = H5F_ACS_DATA_CACHE_NUM_SLOTS_DEF; /* Default raw data chunk cache # of slots */
+static const size_t H5F_def_rdcc_nbytes_g = H5F_ACS_DATA_CACHE_BYTE_SIZE_DEF; /* Default raw data chunk cache # of bytes */
+static const double H5F_def_rdcc_w0_g = H5F_ACS_PREEMPT_READ_CHUNKS_DEF; /* Default raw data chunk cache dirty ratio */
+static const hsize_t H5F_def_threshold_g = H5F_ACS_ALIGN_THRHD_DEF; /* Default allocation alignment threshold */
+static const hsize_t H5F_def_alignment_g = H5F_ACS_ALIGN_DEF; /* Default allocation alignment value */
+static const hsize_t H5F_def_meta_block_size_g = H5F_ACS_META_BLOCK_SIZE_DEF; /* Default metadata allocation block size */
+static const size_t H5F_def_sieve_buf_size_g = H5F_ACS_SIEVE_BUF_SIZE_DEF; /* Default raw data I/O sieve buffer size */
+static const hsize_t H5F_def_sdata_block_size_g = H5F_ACS_SDATA_BLOCK_SIZE_DEF; /* Default small data allocation block size */
+static const unsigned H5F_def_gc_ref_g = H5F_ACS_GARBG_COLCT_REF_DEF; /* Default garbage collection for references setting */
+static const void *H5F_def_driver_info_g = H5F_ACS_FILE_DRV_INFO_DEF; /* Default VFL driver info */
+static const H5F_close_degree_t H5F_def_close_degree_g = H5F_CLOSE_DEGREE_DEF; /* Default file close degree */
+static const hsize_t H5F_def_family_offset_g = H5F_ACS_FAMILY_OFFSET_DEF; /* Default offset for family VFD */
+static const hsize_t H5F_def_family_newsize_g = H5F_ACS_FAMILY_NEWSIZE_DEF; /* Default size of new files for family VFD */
+static const hbool_t H5F_def_family_to_sec2_g = H5F_ACS_FAMILY_TO_SEC2_DEF; /* Default ?? for family VFD */
+static const H5FD_mem_t H5F_def_mem_type_g = H5F_ACS_MULTI_TYPE_DEF; /* Default file space type for multi VFD */
+static const hbool_t H5F_def_latest_format_g = H5F_ACS_LATEST_FORMAT_DEF; /* Default setting for "use the latest version of the format" flag */
+static const hbool_t H5F_def_want_posix_fd_g = H5F_ACS_WANT_POSIX_FD_DEF; /* Default setting for retrieving 'handle' from core VFD */
+static const unsigned H5F_def_efc_size_g = H5F_ACS_EFC_SIZE_DEF; /* Default external file cache size */
+static const H5FD_file_image_info_t H5F_def_file_image_info_g = H5F_ACS_FILE_IMAGE_INFO_DEF; /* Default file image info and callbacks */
+
/*-------------------------------------------------------------------------
@@ -202,114 +264,137 @@ const H5P_libclass_t H5P_CLS_FACC[1] = {{
static herr_t
H5P_facc_reg_prop(H5P_genclass_t *pclass)
{
- H5AC_cache_config_t mdc_initCacheCfg = H5F_ACS_META_CACHE_INIT_CONFIG_DEF; /* Default metadata cache settings */
- size_t rdcc_nslots = H5F_ACS_DATA_CACHE_NUM_SLOTS_DEF; /* Default raw data chunk cache # of slots */
- size_t rdcc_nbytes = H5F_ACS_DATA_CACHE_BYTE_SIZE_DEF; /* Default raw data chunk cache # of bytes */
- double rdcc_w0 = H5F_ACS_PREEMPT_READ_CHUNKS_DEF; /* Default raw data chunk cache dirty ratio */
- hsize_t threshold = H5F_ACS_ALIGN_THRHD_DEF; /* Default allocation alignment threshold */
- hsize_t alignment = H5F_ACS_ALIGN_DEF; /* Default allocation alignment value */
- hsize_t meta_block_size = H5F_ACS_META_BLOCK_SIZE_DEF; /* Default metadata allocation block size */
- size_t sieve_buf_size = H5F_ACS_SIEVE_BUF_SIZE_DEF; /* Default raw data I/O sieve buffer size */
- hsize_t sdata_block_size = H5F_ACS_SDATA_BLOCK_SIZE_DEF; /* Default small data allocation block size */
- unsigned gc_ref = H5F_ACS_GARBG_COLCT_REF_DEF; /* Default garbage collection for references setting */
- hid_t driver_id = H5F_ACS_FILE_DRV_ID_DEF; /* Default VFL driver ID */
- void *driver_info = H5F_ACS_FILE_DRV_INFO_DEF; /* Default VFL driver info */
- H5F_close_degree_t close_degree = H5F_CLOSE_DEGREE_DEF; /* Default file close degree */
- hsize_t family_offset = H5F_ACS_FAMILY_OFFSET_DEF; /* Default offset for family VFD */
- hsize_t family_newsize = H5F_ACS_FAMILY_NEWSIZE_DEF; /* Default size of new files for family VFD */
- hbool_t family_to_sec2 = H5F_ACS_FAMILY_TO_SEC2_DEF; /* Default ?? for family VFD */
- H5FD_mem_t mem_type = H5F_ACS_MULTI_TYPE_DEF; /* Default file space type for multi VFD */
- hbool_t latest_format = H5F_ACS_LATEST_FORMAT_DEF; /* Default setting for "use the latest version of the format" flag */
- hbool_t want_posix_fd = H5F_ACS_WANT_POSIX_FD_DEF; /* Default setting for retrieving 'handle' from core VFD */
- unsigned efc_size = H5F_ACS_EFC_SIZE_DEF; /* Default external file cache size */
- H5FD_file_image_info_t file_image_info = H5F_ACS_FILE_IMAGE_INFO_DEF; /* Default file image info and callbacks */
+ const hid_t def_driver_id = H5F_ACS_FILE_DRV_ID_DEF; /* Default VFL driver ID (initialized from a variable) */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Register the initial metadata cache resize configuration */
- if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &mdc_initCacheCfg, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &H5F_def_mdc_initCacheCfg_g,
+ NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_CONFIG_DEC,
+ NULL, NULL, H5F_ACS_META_CACHE_INIT_CONFIG_CMP, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the size of raw data chunk cache (elements) */
- if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &H5F_def_rdcc_nslots_g,
+ NULL, NULL, NULL, H5F_ACS_DATA_CACHE_NUM_SLOTS_ENC, H5F_ACS_DATA_CACHE_NUM_SLOTS_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the size of raw data chunk cache(bytes) */
- if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &H5F_def_rdcc_nbytes_g,
+ NULL, NULL, NULL, H5F_ACS_DATA_CACHE_BYTE_SIZE_ENC, H5F_ACS_DATA_CACHE_BYTE_SIZE_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the preemption for reading chunks */
- if(H5P_register_real(pclass, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &H5F_def_rdcc_w0_g,
+ NULL, NULL, NULL, H5F_ACS_PREEMPT_READ_CHUNKS_ENC, H5F_ACS_PREEMPT_READ_CHUNKS_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the threshold for alignment */
- if(H5P_register_real(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &threshold, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &H5F_def_threshold_g,
+ NULL, NULL, NULL, H5F_ACS_ALIGN_THRHD_ENC, H5F_ACS_ALIGN_THRHD_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the alignment */
- if(H5P_register_real(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &alignment, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &H5F_def_alignment_g,
+ NULL, NULL, NULL, H5F_ACS_ALIGN_ENC, H5F_ACS_ALIGN_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the minimum metadata allocation block size */
- if(H5P_register_real(pclass, H5F_ACS_META_BLOCK_SIZE_NAME, H5F_ACS_META_BLOCK_SIZE_SIZE, &meta_block_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_ACS_META_BLOCK_SIZE_NAME, H5F_ACS_META_BLOCK_SIZE_SIZE, &H5F_def_meta_block_size_g,
+ NULL, NULL, NULL, H5F_ACS_META_BLOCK_SIZE_ENC, H5F_ACS_META_BLOCK_SIZE_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the maximum sieve buffer size */
- if(H5P_register_real(pclass, H5F_ACS_SIEVE_BUF_SIZE_NAME, H5F_ACS_SIEVE_BUF_SIZE_SIZE, &sieve_buf_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_ACS_SIEVE_BUF_SIZE_NAME, H5F_ACS_SIEVE_BUF_SIZE_SIZE, &H5F_def_sieve_buf_size_g,
+ NULL, NULL, NULL, H5F_ACS_SIEVE_BUF_SIZE_ENC, H5F_ACS_SIEVE_BUF_SIZE_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the minimum "small data" allocation block size */
- if(H5P_register_real(pclass, H5F_ACS_SDATA_BLOCK_SIZE_NAME, H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &sdata_block_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_ACS_SDATA_BLOCK_SIZE_NAME, H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &H5F_def_sdata_block_size_g,
+ NULL, NULL, NULL, H5F_ACS_SDATA_BLOCK_SIZE_ENC, H5F_ACS_SDATA_BLOCK_SIZE_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the garbage collection reference */
- if(H5P_register_real(pclass, H5F_ACS_GARBG_COLCT_REF_NAME, H5F_ACS_GARBG_COLCT_REF_SIZE, &gc_ref, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_ACS_GARBG_COLCT_REF_NAME, H5F_ACS_GARBG_COLCT_REF_SIZE, &H5F_def_gc_ref_g,
+ NULL, NULL, NULL, H5F_ACS_GARBG_COLCT_REF_ENC, H5F_ACS_GARBG_COLCT_REF_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file driver ID */
- if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_ID_NAME, H5F_ACS_FILE_DRV_ID_SIZE, &driver_id, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_ID_NAME, H5F_ACS_FILE_DRV_ID_SIZE, &def_driver_id,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file driver info */
- if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_INFO_NAME, H5F_ACS_FILE_DRV_INFO_SIZE, &driver_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_INFO_NAME, H5F_ACS_FILE_DRV_INFO_SIZE, &H5F_def_driver_info_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file close degree */
- if(H5P_register_real(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &close_degree, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &H5F_def_close_degree_g,
+ NULL, NULL, NULL, H5F_CLOSE_DEGREE_ENC, H5F_CLOSE_DEGREE_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the offset of family driver info */
- if(H5P_register_real(pclass, H5F_ACS_FAMILY_OFFSET_NAME, H5F_ACS_FAMILY_OFFSET_SIZE, &family_offset, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_ACS_FAMILY_OFFSET_NAME, H5F_ACS_FAMILY_OFFSET_SIZE, &H5F_def_family_offset_g,
+ NULL, NULL, NULL, H5F_ACS_FAMILY_OFFSET_ENC, H5F_ACS_FAMILY_OFFSET_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the private property of new family file size. It's used by h5repart only. */
- if(H5P_register_real(pclass, H5F_ACS_FAMILY_NEWSIZE_NAME, H5F_ACS_FAMILY_NEWSIZE_SIZE, &family_newsize, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5F_ACS_FAMILY_NEWSIZE_NAME, H5F_ACS_FAMILY_NEWSIZE_SIZE, &H5F_def_family_newsize_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the private property of whether convert family to sec2 driver. It's used by h5repart only. */
- if(H5P_register_real(pclass, H5F_ACS_FAMILY_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &family_to_sec2, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5F_ACS_FAMILY_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &H5F_def_family_to_sec2_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the data type of multi driver info */
- if(H5P_register_real(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &mem_type, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &H5F_def_mem_type_g,
+ NULL, NULL, NULL, H5F_ACS_MULTI_TYPE_ENC, H5F_ACS_MULTI_TYPE_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the 'use the latest version of the format' flag */
- if(H5P_register_real(pclass, H5F_ACS_LATEST_FORMAT_NAME, H5F_ACS_LATEST_FORMAT_SIZE, &latest_format, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_ACS_LATEST_FORMAT_NAME, H5F_ACS_LATEST_FORMAT_SIZE, &H5F_def_latest_format_g,
+ NULL, NULL, NULL, H5F_ACS_LATEST_FORMAT_ENC, H5F_ACS_LATEST_FORMAT_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the private property of whether to retrieve the file descriptor from the core VFD */
/* (used internally to the library only) */
- if(H5P_register_real(pclass, H5F_ACS_WANT_POSIX_FD_NAME, H5F_ACS_WANT_POSIX_FD_SIZE, &want_posix_fd, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5F_ACS_WANT_POSIX_FD_NAME, H5F_ACS_WANT_POSIX_FD_SIZE, &H5F_def_want_posix_fd_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the external file cache size */
- if(H5P_register_real(pclass, H5F_ACS_EFC_SIZE_NAME, H5F_ACS_EFC_SIZE_SIZE, &efc_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_ACS_EFC_SIZE_NAME, H5F_ACS_EFC_SIZE_SIZE, &H5F_def_efc_size_g,
+ NULL, NULL, NULL, H5F_ACS_EFC_SIZE_ENC, H5F_ACS_EFC_SIZE_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the initial file image info */
- if(H5P_register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &file_image_info, NULL, NULL, NULL, H5F_ACS_FILE_IMAGE_INFO_DEL, H5F_ACS_FILE_IMAGE_INFO_COPY, NULL, H5F_ACS_FILE_IMAGE_INFO_CLOSE) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &H5F_def_file_image_info_g,
+ NULL, NULL, NULL, NULL, NULL,
+ H5F_ACS_FILE_IMAGE_INFO_DEL, H5F_ACS_FILE_IMAGE_INFO_COPY, NULL, H5F_ACS_FILE_IMAGE_INFO_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
@@ -2347,3 +2432,551 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_file_image_info_close() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__facc_cache_config_cmp
+ *
+ * Purpose: Compare two cache configurations.
+ *
+ * Return: positive if VALUE1 is greater than VALUE2, negative if VALUE2 is
+ * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal.
+ *
+ * Programmer: Mohamad Chaarawi
+ * September 24, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5P__facc_cache_config_cmp(const void *_config1, const void *_config2, size_t UNUSED size)
+{
+ const H5AC_cache_config_t *config1 = (const H5AC_cache_config_t *)_config1; /* Create local aliases for values */
+ const H5AC_cache_config_t *config2 = (const H5AC_cache_config_t *)_config2; /* Create local aliases for values */
+ int ret_value = 0; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check for a property being set */
+ if(config1 == NULL && config2 != NULL) HGOTO_DONE(-1);
+ if(config1 != NULL && config2 == NULL) HGOTO_DONE(1);
+
+ if(config1->version < config2->version) HGOTO_DONE(-1);
+ if(config1->version > config2->version) HGOTO_DONE(1);
+
+ if(config1->rpt_fcn_enabled < config2->rpt_fcn_enabled) HGOTO_DONE(-1);
+ if(config1->rpt_fcn_enabled > config2->rpt_fcn_enabled) HGOTO_DONE(1);
+
+ if(config1->open_trace_file < config2->open_trace_file) HGOTO_DONE(-1);
+ if(config1->open_trace_file > config2->open_trace_file) HGOTO_DONE(1);
+
+ if(config1->close_trace_file < config2->close_trace_file) HGOTO_DONE(-1);
+ if(config1->close_trace_file > config2->close_trace_file) HGOTO_DONE(1);
+
+ if((ret_value = HDstrncmp(config1->trace_file_name, config2->trace_file_name,
+ H5AC__MAX_TRACE_FILE_NAME_LEN + 1)) != 0)
+ HGOTO_DONE(ret_value);
+
+ if(config1->evictions_enabled < config2->evictions_enabled) HGOTO_DONE(-1);
+ if(config1->evictions_enabled > config2->evictions_enabled) HGOTO_DONE(1);
+
+ if(config1->set_initial_size < config2->set_initial_size) HGOTO_DONE(-1);
+ if(config1->set_initial_size > config2->set_initial_size) HGOTO_DONE(1);
+
+ if(config1->initial_size < config2->initial_size) HGOTO_DONE(-1);
+ if(config1->initial_size > config2->initial_size) HGOTO_DONE(1);
+
+ if(config1->min_clean_fraction < config2->min_clean_fraction) HGOTO_DONE(-1);
+ if(config1->min_clean_fraction > config2->min_clean_fraction) HGOTO_DONE(1);
+
+ if(config1->max_size < config2->max_size) HGOTO_DONE(-1);
+ if(config1->max_size > config2->max_size) HGOTO_DONE(1);
+
+ if(config1->min_size < config2->min_size) HGOTO_DONE(-1);
+ if(config1->min_size > config2->min_size) HGOTO_DONE(1);
+
+ if(config1->epoch_length < config2->epoch_length) HGOTO_DONE(-1);
+ if(config1->epoch_length > config2->epoch_length) HGOTO_DONE(1);
+
+ if(config1->incr_mode < config2->incr_mode) HGOTO_DONE(-1);
+ if(config1->incr_mode > config2->incr_mode) HGOTO_DONE(1);
+
+ if(config1->lower_hr_threshold < config2->lower_hr_threshold) HGOTO_DONE(-1);
+ if(config1->lower_hr_threshold > config2->lower_hr_threshold) HGOTO_DONE(1);
+
+ if(config1->increment < config2->increment) HGOTO_DONE(-1);
+ if(config1->increment > config2->increment) HGOTO_DONE(1);
+
+ if(config1->apply_max_increment < config2->apply_max_increment) HGOTO_DONE(-1);
+ if(config1->apply_max_increment > config2->apply_max_increment) HGOTO_DONE(1);
+
+ if(config1->max_increment < config2->max_increment) HGOTO_DONE(-1);
+ if(config1->max_increment > config2->max_increment) HGOTO_DONE(1);
+
+ if(config1->flash_incr_mode < config2->flash_incr_mode) HGOTO_DONE(-1);
+ if(config1->flash_incr_mode > config2->flash_incr_mode) HGOTO_DONE(1);
+
+ if(config1->flash_multiple < config2->flash_multiple) HGOTO_DONE(-1);
+ if(config1->flash_multiple > config2->flash_multiple) HGOTO_DONE(1);
+
+ if(config1->flash_threshold < config2->flash_threshold) HGOTO_DONE(-1);
+ if(config1->flash_threshold > config2->flash_threshold) HGOTO_DONE(1);
+
+ if(config1->decr_mode < config2->decr_mode) HGOTO_DONE(-1);
+ if(config1->decr_mode > config2->decr_mode) HGOTO_DONE(1);
+
+ if(config1->upper_hr_threshold < config2->upper_hr_threshold) HGOTO_DONE(-1);
+ if(config1->upper_hr_threshold > config2->upper_hr_threshold) HGOTO_DONE(1);
+
+ if(config1->decrement < config2->decrement) HGOTO_DONE(-1);
+ if(config1->decrement > config2->decrement) HGOTO_DONE(1);
+
+ if(config1->apply_max_decrement < config2->apply_max_decrement) HGOTO_DONE(-1);
+ if(config1->apply_max_decrement > config2->apply_max_decrement) HGOTO_DONE(1);
+
+ if(config1->max_decrement < config2->max_decrement) HGOTO_DONE(-1);
+ if(config1->max_decrement > config2->max_decrement) HGOTO_DONE(1);
+
+ if(config1->epochs_before_eviction < config2->epochs_before_eviction) HGOTO_DONE(-1);
+ if(config1->epochs_before_eviction > config2->epochs_before_eviction) HGOTO_DONE(1);
+
+ if(config1->apply_empty_reserve < config2->apply_empty_reserve) HGOTO_DONE(-1);
+ if(config1->apply_empty_reserve > config2->apply_empty_reserve) HGOTO_DONE(1);
+
+ if(config1->empty_reserve < config2->empty_reserve) HGOTO_DONE(-1);
+ if(config1->empty_reserve > config2->empty_reserve) HGOTO_DONE(1);
+
+ if(config1->dirty_bytes_threshold < config2->dirty_bytes_threshold) HGOTO_DONE(-1);
+ if(config1->dirty_bytes_threshold > config2->dirty_bytes_threshold) HGOTO_DONE(1);
+
+ if(config1->metadata_write_strategy < config2->metadata_write_strategy) HGOTO_DONE(-1);
+ if(config1->metadata_write_strategy > config2->metadata_write_strategy) HGOTO_DONE(1);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__facc_cache_config_cmp() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__facc_cache_config_enc
+ *
+ * Purpose: Callback routine which is called whenever the default
+ * cache config property in the file creation property list is
+ * encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * August 09, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size)
+{
+ const H5AC_cache_config_t *config = (const H5AC_cache_config_t *)value; /* Create local aliases for values */
+ uint8_t **pp = (uint8_t **)_pp;
+ unsigned enc_size; /* Size of encoded property */
+ uint64_t enc_value; /* Property to encode */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(value);
+ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
+
+ if(NULL != *pp) {
+ /* Encode type sizes (as a safety check) */
+ *(*pp)++ = (uint8_t)sizeof(unsigned);
+ *(*pp)++ = (uint8_t)sizeof(double);
+
+ /* int */
+ INT32ENCODE(*pp, (int32_t)config->version);
+
+ H5_ENCODE_UNSIGNED(*pp, config->rpt_fcn_enabled);
+
+ H5_ENCODE_UNSIGNED(*pp, config->open_trace_file);
+
+ H5_ENCODE_UNSIGNED(*pp, config->close_trace_file);
+
+ HDmemcpy(*pp, (const uint8_t *)(config->trace_file_name), H5AC__MAX_TRACE_FILE_NAME_LEN + 1);
+ *pp += H5AC__MAX_TRACE_FILE_NAME_LEN + 1;
+
+ H5_ENCODE_UNSIGNED(*pp, config->evictions_enabled);
+
+ H5_ENCODE_UNSIGNED(*pp, config->set_initial_size);
+
+ enc_value = (uint64_t)config->initial_size;
+ enc_size = H5V_limit_enc_size(enc_value);
+ HDassert(enc_size < 256);
+ *(*pp)++ = (uint8_t)enc_size;
+ UINT64ENCODE_VAR(*pp, enc_value, enc_size);
+
+ H5_ENCODE_DOUBLE(*pp, config->min_clean_fraction);
+
+ enc_value = (uint64_t)config->max_size;
+ enc_size = H5V_limit_enc_size(enc_value);
+ HDassert(enc_size < 256);
+ *(*pp)++ = (uint8_t)enc_size;
+ UINT64ENCODE_VAR(*pp, enc_value, enc_size);
+
+ enc_value = (uint64_t)config->min_size;
+ enc_size = H5V_limit_enc_size(enc_value);
+ HDassert(enc_size < 256);
+ *(*pp)++ = (uint8_t)enc_size;
+ UINT64ENCODE_VAR(*pp, enc_value, enc_size);
+
+ /* long int */
+ INT64ENCODE(*pp, (int64_t)config->epoch_length);
+
+ /* enum */
+ *(*pp)++ = (uint8_t)config->incr_mode;
+
+ H5_ENCODE_DOUBLE(*pp, config->lower_hr_threshold);
+
+ H5_ENCODE_DOUBLE(*pp, config->increment);
+
+ H5_ENCODE_UNSIGNED(*pp, config->apply_max_increment);
+
+ enc_value = (uint64_t)config->max_increment;
+ enc_size = H5V_limit_enc_size(enc_value);
+ HDassert(enc_size < 256);
+ *(*pp)++ = (uint8_t)enc_size;
+ UINT64ENCODE_VAR(*pp, enc_value, enc_size);
+
+ /* enum */
+ *(*pp)++ = (uint8_t)config->flash_incr_mode;
+
+ H5_ENCODE_DOUBLE(*pp, config->flash_multiple);
+
+ H5_ENCODE_DOUBLE(*pp, config->flash_threshold);
+
+ /* enum */
+ *(*pp)++ = (uint8_t)config->decr_mode;
+
+ H5_ENCODE_DOUBLE(*pp, config->upper_hr_threshold);
+
+ H5_ENCODE_DOUBLE(*pp, config->decrement);
+
+ H5_ENCODE_UNSIGNED(*pp, config->apply_max_decrement);
+
+ enc_value = (uint64_t)config->max_decrement;
+ enc_size = H5V_limit_enc_size(enc_value);
+ HDassert(enc_size < 256);
+ *(*pp)++ = (uint8_t)enc_size;
+ UINT64ENCODE_VAR(*pp, enc_value, enc_size);
+
+ /* int */
+ INT32ENCODE(*pp, (int32_t)config->epochs_before_eviction);
+
+ H5_ENCODE_UNSIGNED(*pp, config->apply_empty_reserve);
+
+ H5_ENCODE_DOUBLE(*pp, config->empty_reserve);
+
+ /* int */
+ INT32ENCODE(*pp, (int32_t)config->dirty_bytes_threshold);
+
+ /* int */
+ INT32ENCODE(*pp, (int32_t)config->metadata_write_strategy);
+ } /* end if */
+
+ /* Compute encoded size of variably-encoded values */
+ enc_value = (uint64_t)config->initial_size;
+ *size += 1 + H5V_limit_enc_size(enc_value);
+ enc_value = (uint64_t)config->max_size;
+ *size += 1 + H5V_limit_enc_size(enc_value);
+ enc_value = (uint64_t)config->min_size;
+ *size += 1 + H5V_limit_enc_size(enc_value);
+ enc_value = (uint64_t)config->max_increment;
+ *size += 1 + H5V_limit_enc_size(enc_value);
+ enc_value = (uint64_t)config->max_decrement;
+ *size += 1 + H5V_limit_enc_size(enc_value);
+
+ /* Compute encoded size of fixed-size values */
+ *size += (5 + (sizeof(unsigned) * 8) + (sizeof(double) * 8) +
+ (sizeof(int32_t) * 4) + sizeof(int64_t) +
+ H5AC__MAX_TRACE_FILE_NAME_LEN + 1);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__facc_cache_config_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__facc_cache_config_dec
+ *
+ * Purpose: Callback routine which is called whenever the default
+ * cache config property in the file creation property list is
+ * decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * August 09, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__facc_cache_config_dec(const void **_pp, void *_value)
+{
+ H5AC_cache_config_t *config = (H5AC_cache_config_t *)_value;
+ const uint8_t **pp = (const uint8_t **)_pp;
+ unsigned enc_size;
+ uint64_t enc_value;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(config);
+ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
+
+ /* Set property to default value */
+ HDmemcpy(config, &H5F_def_mdc_initCacheCfg_g, sizeof(H5AC_cache_config_t));
+
+ /* Decode type sizes */
+ enc_size = *(*pp)++;
+ if(enc_size != sizeof(unsigned))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded")
+ enc_size = *(*pp)++;
+ if(enc_size != sizeof(double))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "double value can't be decoded")
+
+ /* int */
+ INT32DECODE(*pp, config->version);
+
+ H5_DECODE_UNSIGNED(*pp, config->rpt_fcn_enabled);
+
+ H5_DECODE_UNSIGNED(*pp, config->open_trace_file);
+
+ H5_DECODE_UNSIGNED(*pp, config->close_trace_file);
+
+ HDstrcpy(config->trace_file_name, (const char *)(*pp));
+ *pp += H5AC__MAX_TRACE_FILE_NAME_LEN + 1;
+
+ H5_DECODE_UNSIGNED(*pp, config->evictions_enabled);
+
+ H5_DECODE_UNSIGNED(*pp, config->set_initial_size);
+
+ enc_size = *(*pp)++;
+ HDassert(enc_size < 256);
+ UINT64DECODE_VAR(*pp, enc_value, enc_size);
+ config->initial_size = (size_t)enc_value;
+
+ H5_DECODE_DOUBLE(*pp, config->min_clean_fraction);
+
+ enc_size = *(*pp)++;
+ HDassert(enc_size < 256);
+ UINT64DECODE_VAR(*pp, enc_value, enc_size);
+ config->max_size = (size_t)enc_value;
+
+ enc_size = *(*pp)++;
+ HDassert(enc_size < 256);
+ UINT64DECODE_VAR(*pp, enc_value, enc_size);
+ config->min_size = (size_t)enc_value;
+
+ /* long int */
+ {
+ int64_t temp;
+ INT64DECODE(*pp, temp);
+ config->epoch_length = (long int)temp;
+ }
+ /* enum */
+ config->incr_mode = (enum H5C_cache_incr_mode)*(*pp)++;
+
+ H5_DECODE_DOUBLE(*pp, config->lower_hr_threshold);
+
+ H5_DECODE_DOUBLE(*pp, config->increment);
+
+ H5_DECODE_UNSIGNED(*pp, config->apply_max_increment);
+
+ enc_size = *(*pp)++;
+ HDassert(enc_size < 256);
+ UINT64DECODE_VAR(*pp, enc_value, enc_size);
+ config->max_increment = (size_t)enc_value;
+
+ /* enum */
+ config->flash_incr_mode = (enum H5C_cache_flash_incr_mode)*(*pp)++;
+
+ H5_DECODE_DOUBLE(*pp, config->flash_multiple);
+
+ H5_DECODE_DOUBLE(*pp, config->flash_threshold);
+
+ /* enum */
+ config->decr_mode = (enum H5C_cache_decr_mode)*(*pp)++;
+
+ H5_DECODE_DOUBLE(*pp, config->upper_hr_threshold);
+
+ H5_DECODE_DOUBLE(*pp, config->decrement);
+
+ H5_DECODE_UNSIGNED(*pp, config->apply_max_decrement);
+
+ enc_size = *(*pp)++;
+ HDassert(enc_size < 256);
+ UINT64DECODE_VAR(*pp, enc_value, enc_size);
+ config->max_decrement = (size_t)enc_value;
+
+ /* int */
+ INT32DECODE(*pp, config->epochs_before_eviction);
+
+ H5_DECODE_UNSIGNED(*pp, config->apply_empty_reserve);
+
+ H5_DECODE_DOUBLE(*pp, config->empty_reserve);
+
+ /* int */
+ INT32DECODE(*pp, config->dirty_bytes_threshold);
+
+ /* int */
+ INT32DECODE(*pp, config->metadata_write_strategy);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__facc_cache_config_dec() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__facc_fclose_degree_enc
+ *
+ * Purpose: Callback routine which is called whenever the file close
+ * degree property in the file access property list
+ * is encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, August 15, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size)
+{
+ const H5F_close_degree_t *fclose_degree = (const H5F_close_degree_t *)value; /* Create local alias for values */
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(fclose_degree);
+ HDassert(size);
+
+ if(NULL != *pp)
+ /* Encode file close degree */
+ *(*pp)++ = (uint8_t)*fclose_degree;
+
+ /* Size of file close degree */
+ (*size)++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__facc_fclose_degree_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__facc_fclose_degree_dec
+ *
+ * Purpose: Callback routine which is called whenever the file close
+ * degree property in the file access property list
+ * is decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, August 15, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__facc_fclose_degree_dec(const void **_pp, void *_value)
+{
+ H5F_close_degree_t *fclose_degree = (H5F_close_degree_t *)_value; /* File close degree */
+ const uint8_t **pp = (const uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(fclose_degree);
+
+ /* Decode file close degree */
+ *fclose_degree = (H5F_close_degree_t)*(*pp)++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__facc_fclose_degree_dec() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__facc_multi_type_enc
+ *
+ * Purpose: Callback routine which is called whenever the multi VFD
+ * memory type property in the file access property list
+ * is encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, August 15, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size)
+{
+ const H5FD_mem_t *type = (const H5FD_mem_t *)value; /* Create local alias for values */
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(type);
+ HDassert(size);
+
+ if(NULL != *pp)
+ /* Encode file close degree */
+ *(*pp)++ = (uint8_t)*type;
+
+ /* Size of multi VFD memory type */
+ (*size)++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__facc_multi_type_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__facc_multi_type_dec
+ *
+ * Purpose: Callback routine which is called whenever the multi VFD
+ * memory type property in the file access property list
+ * is decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, August 15, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__facc_multi_type_dec(const void **_pp, void *_value)
+{
+ H5FD_mem_t *type = (H5FD_mem_t *)_value; /* File close degree */
+ const uint8_t **pp = (const uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(type);
+
+ /* Decode multi VFD memory type */
+ *type = (H5FD_mem_t)*(*pp)++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__facc_multi_type_dec() */
+
diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c
index 21d45df..3eb9c5b 100644
--- a/src/H5Pfcpl.c
+++ b/src/H5Pfcpl.c
@@ -49,37 +49,61 @@
/* Definitions for the size of the file user block in bytes */
#define H5F_CRT_USER_BLOCK_SIZE sizeof(hsize_t)
#define H5F_CRT_USER_BLOCK_DEF 0
+#define H5F_CRT_USER_BLOCK_ENC H5P__encode_hsize_t
+#define H5F_CRT_USER_BLOCK_DEC H5P__decode_hsize_t
/* Definitions for the 1/2 rank for symbol table leaf nodes */
#define H5F_CRT_SYM_LEAF_SIZE sizeof(unsigned)
+#define H5F_CRT_SYM_LEAF_ENC H5P__encode_unsigned
+#define H5F_CRT_SYM_LEAF_DEC H5P__decode_unsigned
/* Definitions for the 1/2 rank for btree internal nodes */
#define H5F_CRT_BTREE_RANK_SIZE sizeof(unsigned[H5B_NUM_BTREE_ID])
#define H5F_CRT_BTREE_RANK_DEF {HDF5_BTREE_SNODE_IK_DEF,HDF5_BTREE_CHUNK_IK_DEF}
+#define H5F_CRT_BTREE_RANK_ENC H5P__fcrt_btree_rank_enc
+#define H5F_CRT_BTREE_RANK_DEC H5P__fcrt_btree_rank_dec
/* Definitions for byte number in an address */
#define H5F_CRT_ADDR_BYTE_NUM_SIZE sizeof(uint8_t)
#define H5F_CRT_ADDR_BYTE_NUM_DEF H5F_OBJ_ADDR_SIZE
+#define H5F_CRT_ADDR_BYTE_NUM_ENC H5P__encode_uint8_t
+#define H5F_CRT_ADDR_BYTE_NUM_DEC H5P__decode_uint8_t
/* Definitions for byte number for object size */
#define H5F_CRT_OBJ_BYTE_NUM_SIZE sizeof(uint8_t)
#define H5F_CRT_OBJ_BYTE_NUM_DEF H5F_OBJ_SIZE_SIZE
+#define H5F_CRT_OBJ_BYTE_NUM_ENC H5P__encode_uint8_t
+#define H5F_CRT_OBJ_BYTE_NUM_DEC H5P__decode_uint8_t
/* Definitions for version number of the superblock */
#define H5F_CRT_SUPER_VERS_SIZE sizeof(unsigned)
#define H5F_CRT_SUPER_VERS_DEF HDF5_SUPERBLOCK_VERSION_DEF
/* Definitions for shared object header messages */
#define H5F_CRT_SHMSG_NINDEXES_SIZE sizeof(unsigned)
#define H5F_CRT_SHMSG_NINDEXES_DEF (0)
+#define H5F_CRT_SHMSG_NINDEXES_ENC H5P__encode_unsigned
+#define H5F_CRT_SHMSG_NINDEXES_DEC H5P__decode_unsigned
#define H5F_CRT_SHMSG_INDEX_TYPES_SIZE sizeof(unsigned[H5O_SHMESG_MAX_NINDEXES])
#define H5F_CRT_SHMSG_INDEX_TYPES_DEF {0,0,0,0,0,0}
+#define H5F_CRT_SHMSG_INDEX_TYPES_ENC H5P__fcrt_shmsg_index_types_enc
+#define H5F_CRT_SHMSG_INDEX_TYPES_DEC H5P__fcrt_shmsg_index_types_dec
#define H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE sizeof(unsigned[H5O_SHMESG_MAX_NINDEXES])
#define H5F_CRT_SHMSG_INDEX_MINSIZE_DEF {250,250,250,250,250,250}
+#define H5F_CRT_SHMSG_INDEX_MINSIZE_ENC H5P__fcrt_shmsg_index_minsize_enc
+#define H5F_CRT_SHMSG_INDEX_MINSIZE_DEC H5P__fcrt_shmsg_index_minsize_dec
/* Definitions for shared object header list/btree phase change cutoffs */
#define H5F_CRT_SHMSG_LIST_MAX_SIZE sizeof(unsigned)
#define H5F_CRT_SHMSG_LIST_MAX_DEF (50)
+#define H5F_CRT_SHMSG_LIST_MAX_ENC H5P__encode_unsigned
+#define H5F_CRT_SHMSG_LIST_MAX_DEC H5P__decode_unsigned
#define H5F_CRT_SHMSG_BTREE_MIN_SIZE sizeof(unsigned)
#define H5F_CRT_SHMSG_BTREE_MIN_DEF (40)
+#define H5F_CRT_SHMSG_BTREE_MIN_ENC H5P__encode_unsigned
+#define H5F_CRT_SHMSG_BTREE_MIN_DEC H5P__decode_unsigned
/* Definitions for file space handling strategy */
#define H5F_CRT_FILE_SPACE_STRATEGY_SIZE sizeof(unsigned)
#define H5F_CRT_FILE_SPACE_STRATEGY_DEF H5F_FILE_SPACE_STRATEGY_DEF
+#define H5F_CRT_FILE_SPACE_STRATEGY_ENC H5P__encode_unsigned
+#define H5F_CRT_FILE_SPACE_STRATEGY_DEC H5P__decode_unsigned
#define H5F_CRT_FREE_SPACE_THRESHOLD_SIZE sizeof(hsize_t)
#define H5F_CRT_FREE_SPACE_THRESHOLD_DEF H5F_FREE_SPACE_THRESHOLD_DEF
+#define H5F_CRT_FREE_SPACE_THRESHOLD_ENC H5P__encode_hsize_t
+#define H5F_CRT_FREE_SPACE_THRESHOLD_DEC H5P__decode_hsize_t
/******************/
@@ -99,6 +123,14 @@
/* Property class callbacks */
static herr_t H5P_fcrt_reg_prop(H5P_genclass_t *pclass);
+/* property callbacks */
+static herr_t H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size);
+static herr_t H5P__fcrt_btree_rank_dec(const void **_pp, void *value);
+static herr_t H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, size_t *size);
+static herr_t H5P__fcrt_shmsg_index_types_dec(const void **_pp, void *value);
+static herr_t H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size);
+static herr_t H5P__fcrt_shmsg_index_minsize_dec(const void **_pp, void *value);
+
/*********************/
/* Package Variables */
@@ -130,6 +162,21 @@ const H5P_libclass_t H5P_CLS_FCRT[1] = {{
/* Local Variables */
/*******************/
+/* Property value defaults */
+static const hsize_t H5F_def_userblock_size_g = H5F_CRT_USER_BLOCK_DEF; /* Default userblock size */
+static const unsigned H5F_def_sym_leaf_k_g = H5F_CRT_SYM_LEAF_DEF; /* Default size for symbol table leaf nodes */
+static const unsigned H5F_def_btree_k_g[H5B_NUM_BTREE_ID] = H5F_CRT_BTREE_RANK_DEF; /* Default 'K' values for B-trees in file */
+static const uint8_t H5F_def_sizeof_addr_g = H5F_CRT_ADDR_BYTE_NUM_DEF; /* Default size of addresses in the file */
+static const uint8_t H5F_def_sizeof_size_g = H5F_CRT_OBJ_BYTE_NUM_DEF; /* Default size of sizes in the file */
+static const unsigned H5F_def_superblock_ver_g = H5F_CRT_SUPER_VERS_DEF; /* Default superblock version # */
+static const unsigned H5F_def_num_sohm_indexes_g = H5F_CRT_SHMSG_NINDEXES_DEF;
+static const unsigned H5F_def_sohm_index_flags_g[H5O_SHMESG_MAX_NINDEXES] = H5F_CRT_SHMSG_INDEX_TYPES_DEF;
+static const unsigned H5F_def_sohm_index_minsizes_g[H5O_SHMESG_MAX_NINDEXES] = H5F_CRT_SHMSG_INDEX_MINSIZE_DEF;
+static const unsigned H5F_def_sohm_list_max_g = H5F_CRT_SHMSG_LIST_MAX_DEF;
+static const unsigned H5F_def_sohm_btree_min_g = H5F_CRT_SHMSG_BTREE_MIN_DEF;
+static const unsigned H5F_def_file_space_strategy_g = H5F_CRT_FILE_SPACE_STRATEGY_DEF;
+static const hsize_t H5F_def_free_space_threshold_g = H5F_CRT_FREE_SPACE_THRESHOLD_DEF;
+
/*-------------------------------------------------------------------------
@@ -146,67 +193,80 @@ const H5P_libclass_t H5P_CLS_FCRT[1] = {{
static herr_t
H5P_fcrt_reg_prop(H5P_genclass_t *pclass)
{
- hsize_t userblock_size = H5F_CRT_USER_BLOCK_DEF; /* Default userblock size */
- unsigned sym_leaf_k = H5F_CRT_SYM_LEAF_DEF; /* Default size for symbol table leaf nodes */
- unsigned btree_k[H5B_NUM_BTREE_ID] = H5F_CRT_BTREE_RANK_DEF; /* Default 'K' values for B-trees in file */
- uint8_t sizeof_addr = H5F_CRT_ADDR_BYTE_NUM_DEF; /* Default size of addresses in the file */
- uint8_t sizeof_size = H5F_CRT_OBJ_BYTE_NUM_DEF; /* Default size of sizes in the file */
- unsigned superblock_ver = H5F_CRT_SUPER_VERS_DEF; /* Default superblock version # */
- unsigned num_sohm_indexes = H5F_CRT_SHMSG_NINDEXES_DEF;
- unsigned sohm_index_flags[H5O_SHMESG_MAX_NINDEXES] = H5F_CRT_SHMSG_INDEX_TYPES_DEF;
- unsigned sohm_index_minsizes[H5O_SHMESG_MAX_NINDEXES] = H5F_CRT_SHMSG_INDEX_MINSIZE_DEF;
- unsigned sohm_list_max = H5F_CRT_SHMSG_LIST_MAX_DEF;
- unsigned sohm_btree_min = H5F_CRT_SHMSG_BTREE_MIN_DEF;
- unsigned file_space_strategy = H5F_CRT_FILE_SPACE_STRATEGY_DEF;
- hsize_t free_space_threshold = H5F_CRT_FREE_SPACE_THRESHOLD_DEF;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Register the user block size */
- if(H5P_register_real(pclass, H5F_CRT_USER_BLOCK_NAME, H5F_CRT_USER_BLOCK_SIZE, &userblock_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_CRT_USER_BLOCK_NAME, H5F_CRT_USER_BLOCK_SIZE, &H5F_def_userblock_size_g,
+ NULL, NULL, NULL, H5F_CRT_USER_BLOCK_ENC, H5F_CRT_USER_BLOCK_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the 1/2 rank for symbol table leaf nodes */
- if(H5P_register_real(pclass, H5F_CRT_SYM_LEAF_NAME, H5F_CRT_SYM_LEAF_SIZE, &sym_leaf_k, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_CRT_SYM_LEAF_NAME, H5F_CRT_SYM_LEAF_SIZE, &H5F_def_sym_leaf_k_g,
+ NULL, NULL, NULL, H5F_CRT_SYM_LEAF_ENC, H5F_CRT_SYM_LEAF_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the 1/2 rank for btree internal nodes */
- if(H5P_register_real(pclass, H5F_CRT_BTREE_RANK_NAME, H5F_CRT_BTREE_RANK_SIZE, btree_k, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_CRT_BTREE_RANK_NAME, H5F_CRT_BTREE_RANK_SIZE, H5F_def_btree_k_g,
+ NULL, NULL, NULL, H5F_CRT_BTREE_RANK_ENC, H5F_CRT_BTREE_RANK_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the byte number for an address */
- if(H5P_register_real(pclass, H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &sizeof_addr, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &H5F_def_sizeof_addr_g,
+ NULL, NULL, NULL, H5F_CRT_ADDR_BYTE_NUM_ENC, H5F_CRT_ADDR_BYTE_NUM_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the byte number for object size */
- if(H5P_register_real(pclass, H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE, &sizeof_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE, &H5F_def_sizeof_size_g,
+ NULL, NULL, NULL, H5F_CRT_OBJ_BYTE_NUM_ENC, H5F_CRT_OBJ_BYTE_NUM_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the superblock version number */
- if(H5P_register_real(pclass, H5F_CRT_SUPER_VERS_NAME, H5F_CRT_SUPER_VERS_SIZE, &superblock_ver, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5F_CRT_SUPER_VERS_NAME, H5F_CRT_SUPER_VERS_SIZE, &H5F_def_superblock_ver_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the shared OH message information */
- if(H5P_register_real(pclass,H5F_CRT_SHMSG_NINDEXES_NAME, H5F_CRT_SHMSG_NINDEXES_SIZE, &num_sohm_indexes,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register_real(pclass, H5F_CRT_SHMSG_NINDEXES_NAME, H5F_CRT_SHMSG_NINDEXES_SIZE, &H5F_def_num_sohm_indexes_g,
+ NULL, NULL, NULL, H5F_CRT_SHMSG_NINDEXES_ENC, H5F_CRT_SHMSG_NINDEXES_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- if(H5P_register_real(pclass,H5F_CRT_SHMSG_INDEX_TYPES_NAME, H5F_CRT_SHMSG_INDEX_TYPES_SIZE, &sohm_index_flags,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register_real(pclass, H5F_CRT_SHMSG_INDEX_TYPES_NAME, H5F_CRT_SHMSG_INDEX_TYPES_SIZE, &H5F_def_sohm_index_flags_g,
+ NULL, NULL, NULL, H5F_CRT_SHMSG_INDEX_TYPES_ENC, H5F_CRT_SHMSG_INDEX_TYPES_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- if(H5P_register_real(pclass,H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE, &sohm_index_minsizes,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register_real(pclass, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE, &H5F_def_sohm_index_minsizes_g,
+ NULL, NULL, NULL, H5F_CRT_SHMSG_INDEX_MINSIZE_ENC, H5F_CRT_SHMSG_INDEX_MINSIZE_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the shared OH cutoff size information */
- if(H5P_register_real(pclass,H5F_CRT_SHMSG_LIST_MAX_NAME, H5F_CRT_SHMSG_LIST_MAX_SIZE, &sohm_list_max,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register_real(pclass, H5F_CRT_SHMSG_LIST_MAX_NAME, H5F_CRT_SHMSG_LIST_MAX_SIZE, &H5F_def_sohm_list_max_g,
+ NULL, NULL, NULL, H5F_CRT_SHMSG_LIST_MAX_ENC, H5F_CRT_SHMSG_LIST_MAX_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- if(H5P_register_real(pclass,H5F_CRT_SHMSG_BTREE_MIN_NAME, H5F_CRT_SHMSG_BTREE_MIN_SIZE, &sohm_btree_min,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register_real(pclass, H5F_CRT_SHMSG_BTREE_MIN_NAME, H5F_CRT_SHMSG_BTREE_MIN_SIZE, &H5F_def_sohm_btree_min_g,
+ NULL, NULL, NULL, H5F_CRT_SHMSG_BTREE_MIN_ENC, H5F_CRT_SHMSG_BTREE_MIN_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file space handling strategy */
- if(H5P_register_real(pclass, H5F_CRT_FILE_SPACE_STRATEGY_NAME, H5F_CRT_FILE_SPACE_STRATEGY_SIZE, &file_space_strategy, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_CRT_FILE_SPACE_STRATEGY_NAME, H5F_CRT_FILE_SPACE_STRATEGY_SIZE, &H5F_def_file_space_strategy_g,
+ NULL, NULL, NULL, H5F_CRT_FILE_SPACE_STRATEGY_ENC, H5F_CRT_FILE_SPACE_STRATEGY_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the free space section threshold */
- if(H5P_register_real(pclass, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, H5F_CRT_FREE_SPACE_THRESHOLD_SIZE, &free_space_threshold, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, H5F_CRT_FREE_SPACE_THRESHOLD_SIZE, &H5F_def_free_space_threshold_g,
+ NULL, NULL, NULL, H5F_CRT_FREE_SPACE_THRESHOLD_ENC, H5F_CRT_FREE_SPACE_THRESHOLD_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
@@ -615,6 +675,97 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5P__fcrt_btree_rank_enc
+ *
+ * Purpose: Callback routine which is called whenever the index storage
+ * btree in file creation property list is encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * August 7, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size)
+{
+ const unsigned *btree_k = (const unsigned *)value; /* Create local alias for values */
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(btree_k);
+ HDassert(size);
+
+ if(NULL != *pp) {
+ unsigned u; /* Local index variable */
+
+ /* Encode the size of an unsigned*/
+ *(*pp)++ = (uint8_t)sizeof(unsigned);
+
+ /* Encode all the btree */
+ for(u = 0 ; u < H5B_NUM_BTREE_ID; u++) {
+ /* Encode the left split value */
+ H5_ENCODE_UNSIGNED(*pp, *(const unsigned *)btree_k)
+ btree_k++;
+ } /* end for */
+ } /* end if */
+
+ /* Size of type flags values */
+ *size += 1 + (H5B_NUM_BTREE_ID * sizeof(unsigned));
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__fcrt_btree_rank_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__fcrt_btree_rank_dec
+ *
+ * Purpose: Callback routine which is called whenever the index storage
+ * btree in file creation property list is decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * August 7, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__fcrt_btree_rank_dec(const void **_pp, void *_value)
+{
+ unsigned *btree_k = (unsigned *)_value;
+ const uint8_t **pp = (const uint8_t **)_pp;
+ unsigned enc_size; /* Size of encoded property */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(btree_k);
+
+ /* Decode the size */
+ enc_size = *(*pp)++;
+ if(enc_size != sizeof(unsigned))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded")
+
+ /* Decode all the type flags */
+ for(u = 0 ; u < H5B_NUM_BTREE_ID; u++)
+ H5_DECODE_UNSIGNED(*pp, btree_k[u])
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__fcrt_btree_rank_dec() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Pset_shared_mesg_nindexes
*
* Purpose: Set the number of Shared Object Header Message (SOHM)
@@ -814,6 +965,192 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5P__fcrt_shmsg_index_types_enc
+ *
+ * Purpose: Callback routine which is called whenever the shared
+ * message indec types in file creation property list
+ * is encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * August 7, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, size_t *size)
+{
+ const unsigned *type_flags = (const unsigned *)value; /* Create local alias for values */
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(type_flags);
+ HDassert(size);
+
+ if(NULL != *pp) {
+ unsigned u; /* Local index variable */
+
+ /* Encode the size of a double*/
+ *(*pp)++ = (uint8_t)sizeof(unsigned);
+
+ /* Encode all the type flags */
+ for(u = 0; u < H5O_SHMESG_MAX_NINDEXES; u++) {
+ /* Encode the left split value */
+ H5_ENCODE_UNSIGNED(*pp, *(const unsigned *)type_flags)
+ type_flags++;
+ } /* end for */
+ } /* end if */
+
+ /* Size of type flags values */
+ *size += 1 + (H5O_SHMESG_MAX_NINDEXES * sizeof(unsigned));
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__fcrt_shmsg_index_types_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__fcrt_shmsg_index_types_dec
+ *
+ * Purpose: Callback routine which is called whenever the shared
+ * message indec types in file creation property list
+ * is decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * August 7, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__fcrt_shmsg_index_types_dec(const void **_pp, void *_value)
+{
+ unsigned *type_flags = (unsigned *)_value;
+ const uint8_t **pp = (const uint8_t **)_pp;
+ unsigned enc_size; /* Size of encoded property */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(type_flags);
+
+ /* Decode the size */
+ enc_size = *(*pp)++;
+ if(enc_size != sizeof(unsigned))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded")
+
+ /* Decode all the type flags */
+ for(u = 0; u < H5O_SHMESG_MAX_NINDEXES; u++)
+ H5_DECODE_UNSIGNED(*pp, type_flags[u])
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__fcrt_shmsg_index_types_dec() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__fcrt_shmsg_index_minsize_enc
+ *
+ * Purpose: Callback routine which is called whenever the shared
+ * message index minsize in file creation property list
+ * is encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * August 7, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size)
+{
+ const unsigned *minsizes = (const unsigned *)value; /* Create local alias for values */
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(minsizes);
+ HDassert(size);
+
+ if(NULL != *pp) {
+ unsigned u; /* Local index variable */
+
+ /* Encode the size of a double*/
+ *(*pp)++ = (uint8_t)sizeof(unsigned);
+
+ /* Encode all the minsize values */
+ for(u = 0 ; u < H5O_SHMESG_MAX_NINDEXES; u++) {
+ /* Encode the left split value */
+ H5_ENCODE_UNSIGNED(*pp, *(const unsigned *)minsizes)
+ minsizes++;
+ } /* end for */
+ } /* end if */
+
+ /* Size of type flags values */
+ *size += 1 + (H5O_SHMESG_MAX_NINDEXES * sizeof(unsigned));
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__fcrt_shmsg_index_minsize_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__fcrt_shmsg_index_minsize_dec
+ *
+ * Purpose: Callback routine which is called whenever the shared
+ * message indec minsize in file creation property list
+ * is decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * August 7, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__fcrt_shmsg_index_minsize_dec(const void **_pp, void *_value)
+{
+ unsigned *minsizes = (unsigned *)_value;
+ const uint8_t **pp = (const uint8_t **)_pp;
+ unsigned enc_size; /* Size of encoded property */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(minsizes);
+
+ /* Decode the size */
+ enc_size = *(*pp)++;
+ if(enc_size != sizeof(unsigned))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded")
+
+ /* Decode all the minsize values */
+ for(u = 0 ; u < H5O_SHMESG_MAX_NINDEXES; u++)
+ H5_DECODE_UNSIGNED(*pp, minsizes[u])
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__fcrt_shmsg_index_minsize_dec() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Pset_shared_mesg_phase_change
*
* Purpose: Sets the cutoff values for indexes storing shared object
diff --git a/src/H5Pfmpl.c b/src/H5Pfmpl.c
index 0158bf1..1c4d3f4 100644
--- a/src/H5Pfmpl.c
+++ b/src/H5Pfmpl.c
@@ -93,6 +93,14 @@ const H5P_libclass_t H5P_CLS_FMNT[1] = {{
/*****************************/
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Property value defaults */
+static const hbool_t H5F_def_local_g = H5F_MNT_SYM_LOCAL_DEF; /* Whether symlinks are local to file */
+
+
/*-------------------------------------------------------------------------
* Function: H5P_fmnt_reg_prop
@@ -108,14 +116,14 @@ const H5P_libclass_t H5P_CLS_FMNT[1] = {{
static herr_t
H5P_fmnt_reg_prop(H5P_genclass_t *pclass)
{
- hbool_t local = H5F_MNT_SYM_LOCAL_DEF; /* Whether symlinks are local to file */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Register property of whether symlinks is local to file */
- if(H5P_register_real(pclass, H5F_MNT_SYM_LOCAL_NAME, H5F_MNT_SYM_LOCAL_SIZE, &local, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ if(H5P_register_real(pclass, H5F_MNT_SYM_LOCAL_NAME, H5F_MNT_SYM_LOCAL_SIZE, &H5F_def_local_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c
index 394cf8b..0210700 100644
--- a/src/H5Pgcpl.c
+++ b/src/H5Pgcpl.c
@@ -42,6 +42,12 @@
/* Local Macros */
/****************/
+/* ========= Group Creation properties ============ */
+#define H5G_CRT_GROUP_INFO_ENC H5P__gcrt_group_info_enc
+#define H5G_CRT_GROUP_INFO_DEC H5P__gcrt_group_info_dec
+#define H5G_CRT_LINK_INFO_ENC H5P__gcrt_link_info_enc
+#define H5G_CRT_LINK_INFO_DEC H5P__gcrt_link_info_dec
+
/******************/
/* Local Typedefs */
@@ -60,6 +66,12 @@
/* Property class callbacks */
static herr_t H5P__gcrt_reg_prop(H5P_genclass_t *pclass);
+/* Property callbacks */
+static herr_t H5P__gcrt_group_info_enc(const void *value, void **_pp, size_t *size);
+static herr_t H5P__gcrt_group_info_dec(const void **_pp, void *value);
+static herr_t H5P__gcrt_link_info_enc(const void *value, void **_pp, size_t *size);
+static herr_t H5P__gcrt_link_info_dec(const void **_pp, void *value);
+
/*********************/
/* Package Variables */
@@ -91,6 +103,10 @@ const H5P_libclass_t H5P_CLS_GCRT[1] = {{
/* Local Variables */
/*******************/
+/* Property value defaults */
+static const H5O_ginfo_t H5G_def_ginfo_g = H5G_CRT_GROUP_INFO_DEF; /* Default group info settings */
+static const H5O_linfo_t H5G_def_linfo_g = H5G_CRT_LINK_INFO_DEF; /* Default link info settings */
+
/*-------------------------------------------------------------------------
@@ -107,18 +123,20 @@ const H5P_libclass_t H5P_CLS_GCRT[1] = {{
static herr_t
H5P__gcrt_reg_prop(H5P_genclass_t *pclass)
{
- H5O_ginfo_t ginfo = H5G_CRT_GROUP_INFO_DEF; /* Default group info settings */
- H5O_linfo_t linfo = H5G_CRT_LINK_INFO_DEF; /* Default link info settings */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Register group info property */
- if(H5P_register_real(pclass, H5G_CRT_GROUP_INFO_NAME, H5G_CRT_GROUP_INFO_SIZE, &ginfo, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5G_CRT_GROUP_INFO_NAME, H5G_CRT_GROUP_INFO_SIZE, &H5G_def_ginfo_g,
+ NULL, NULL, NULL, H5G_CRT_GROUP_INFO_ENC, H5G_CRT_GROUP_INFO_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register link info property */
- if(H5P_register_real(pclass, H5G_CRT_LINK_INFO_NAME, H5G_CRT_LINK_INFO_SIZE, &linfo, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5G_CRT_LINK_INFO_NAME, H5G_CRT_LINK_INFO_SIZE, &H5G_def_linfo_g,
+ NULL, NULL, NULL, H5G_CRT_LINK_INFO_ENC, H5G_CRT_LINK_INFO_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
@@ -506,3 +524,176 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_link_creation_order() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__gcrt_group_info_enc
+ *
+ * Purpose: Callback routine which is called whenever the group
+ * property in the dataset access property list is
+ * encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Monday, October 10, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__gcrt_group_info_enc(const void *value, void **_pp, size_t *size)
+{
+ const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *)value; /* Create local aliases for values */
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ if(NULL != *pp) {
+ UINT32ENCODE(*pp, ginfo->lheap_size_hint)
+ UINT16ENCODE(*pp, ginfo->max_compact)
+ UINT16ENCODE(*pp, ginfo->min_dense)
+ UINT16ENCODE(*pp, ginfo->est_num_entries)
+ UINT16ENCODE(*pp, ginfo->est_name_len)
+ } /* end if */
+
+ *size += sizeof(uint16_t) * 4 + sizeof(uint32_t);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__gcrt_group_info_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__gcrt_group_info_dec
+ *
+ * Purpose: Callback routine which is called whenever the group info
+ * property in the dataset access property list is
+ * decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Monday, October 10, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__gcrt_group_info_dec(const void **_pp, void *_value)
+{
+ H5O_ginfo_t *ginfo = (H5O_ginfo_t *)_value; /* Group info settings */
+ const uint8_t **pp = (const uint8_t **)_pp;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Set property to default value */
+ *ginfo = H5G_def_ginfo_g;
+
+ UINT32DECODE(*pp, ginfo->lheap_size_hint)
+ UINT16DECODE(*pp, ginfo->max_compact)
+ UINT16DECODE(*pp, ginfo->min_dense)
+ UINT16DECODE(*pp, ginfo->est_num_entries)
+ UINT16DECODE(*pp, ginfo->est_name_len)
+
+ /* Update fields */
+ if(ginfo->max_compact != H5G_CRT_GINFO_MAX_COMPACT ||
+ ginfo->min_dense != H5G_CRT_GINFO_MIN_DENSE)
+ ginfo->store_link_phase_change = TRUE;
+ else
+ ginfo->store_link_phase_change = FALSE;
+
+ if(ginfo->est_num_entries != H5G_CRT_GINFO_EST_NUM_ENTRIES ||
+ ginfo->est_name_len != H5G_CRT_GINFO_EST_NAME_LEN)
+ ginfo->store_est_entry_info = TRUE;
+ else
+ ginfo->store_est_entry_info = FALSE;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__gcrt_group_info_dec() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__gcrt_link_info_enc
+ *
+ * Purpose: Callback routine which is called whenever the link
+ * property in the dataset access property list is
+ * encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Monday, October 10, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__gcrt_link_info_enc(const void *value, void **_pp, size_t *size)
+{
+ const H5O_linfo_t *linfo = (const H5O_linfo_t *)value; /* Create local aliases for values */
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ if(NULL != *pp) {
+ unsigned crt_order_flags = 0;
+
+ crt_order_flags |= linfo->track_corder ? H5P_CRT_ORDER_TRACKED : 0;
+ crt_order_flags |= linfo->index_corder ? H5P_CRT_ORDER_INDEXED : 0;
+
+ /* Encode the size of unsigned*/
+ *(*pp)++ = (uint8_t)sizeof(unsigned);
+
+ /* Encode the value */
+ H5_ENCODE_UNSIGNED(*pp, crt_order_flags)
+ } /* end if */
+
+ *size += (1 + sizeof(unsigned));
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__gcrt_link_info_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__gcrt_link_info_dec
+ *
+ * Purpose: Callback routine which is called whenever the link info
+ * property in the dataset access property list is
+ * decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Monday, October 10, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__gcrt_link_info_dec(const void **_pp, void *_value)
+{
+ H5O_linfo_t *linfo = (H5O_linfo_t *)_value; /* Link info settings */
+ const uint8_t **pp = (const uint8_t **)_pp;
+ unsigned crt_order_flags;
+ unsigned enc_size;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ enc_size = *(*pp)++;
+ if(enc_size != sizeof(unsigned))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded")
+
+ /* Set property to default value */
+ *linfo = H5G_def_linfo_g;
+
+ H5_DECODE_UNSIGNED(*pp, crt_order_flags)
+
+ /* Update fields */
+ linfo->track_corder = (hbool_t)((crt_order_flags & H5P_CRT_ORDER_TRACKED) ? TRUE : FALSE);
+ linfo->index_corder = (hbool_t)((crt_order_flags & H5P_CRT_ORDER_INDEXED) ? TRUE : FALSE);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__gcrt_link_info_dec() */
+
diff --git a/src/H5Pint.c b/src/H5Pint.c
index 57fe001..88c3247 100644
--- a/src/H5Pint.c
+++ b/src/H5Pint.c
@@ -970,7 +970,7 @@ done:
Internal routine to create a new property
USAGE
H5P_genprop_t *H5P_create_prop(name,size,type,value,prp_create,prp_set,
- prp_get,prp_delete,prp_close)
+ prp_get,prp_delete,prp_close, prp_encode, prp_decode)
const char *name; IN: Name of property to register
size_t size; IN: Size of property in bytes
H5P_prop_within_t type; IN: Type of object the property will be inserted into
@@ -979,6 +979,8 @@ done:
creation callback
H5P_prp_set_func_t prp_set; IN: Function pointer to property set callback
H5P_prp_get_func_t prp_get; IN: Function pointer to property get callback
+ H5P_prp_encode_func_t prp_encode; IN: Function pointer to property encode
+ H5P_prp_decode_func_t prp_decode; IN: Function pointer to property decode
H5P_prp_delete_func_t prp_delete; IN: Function pointer to property delete callback
H5P_prp_copy_func_t prp_copy; IN: Function pointer to property copy callback
H5P_prp_compare_func_t prp_cmp; IN: Function pointer to property compare callback
@@ -996,9 +998,10 @@ done:
--------------------------------------------------------------------------*/
static H5P_genprop_t *
H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type,
- const void *value,
- H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set,
- H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete,
+ const void *value, H5P_prp_create_func_t prp_create,
+ H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
+ H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode,
+ H5P_prp_delete_func_t prp_delete,
H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp,
H5P_prp_close_func_t prp_close)
{
@@ -1034,6 +1037,8 @@ H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type,
prop->create = prp_create;
prop->set = prp_set;
prop->get = prp_get;
+ prop->encode = prp_encode;
+ prop->decode = prp_decode;
prop->del = prp_delete;
prop->copy = prp_copy;
/* Use custom comparison routine if available, otherwise default to memcmp() */
@@ -1782,7 +1787,8 @@ done:
PURPOSE
Internal routine to register a new property in a property list class.
USAGE
- herr_t H5P_register_real(class, name, size, default, prp_create, prp_set, prp_get, prp_close)
+ herr_t H5P_register_real(class, name, size, default, prp_create, prp_set,
+ prp_get, prp_close, prp_encode, prp_decode)
H5P_genclass_t *class; IN: Property list class to modify
const char *name; IN: Name of property to register
size_t size; IN: Size of property in bytes
@@ -1792,6 +1798,8 @@ done:
creation callback
H5P_prp_set_func_t prp_set; IN: Function pointer to property set callback
H5P_prp_get_func_t prp_get; IN: Function pointer to property get callback
+ H5P_prp_encode_func_t prp_encode; IN: Function pointer to property encode
+ H5P_prp_decode_func_t prp_decode; IN: Function pointer to property decode
H5P_prp_delete_func_t prp_delete; IN: Function pointer to property delete callback
H5P_prp_copy_func_t prp_copy; IN: Function pointer to property copy callback
H5P_prp_compare_func_t prp_cmp; IN: Function pointer to property compare callback
@@ -1911,6 +1919,33 @@ done:
'close' routine returns a negative value, the property list close
routine returns an error value but the property list is still closed.
+ The 'encode' callback is called when a property list with this
+ property is being encoded. H5P_prp_encode_func_t is defined as:
+ typedef herr_t (*H5P_prp_encode_func_t)(void *f, size_t *size,
+ void *value, void *plist, uint8_t **buf);
+ where the parameters to the callback function are:
+ void *f; IN: A fake file structure used to encode.
+ size_t *size; IN/OUT: The size of the buffer to encode the property.
+ void *value; IN: The value of the property being encoded.
+ void *plist; IN: The property list structure.
+ uint8_t **buf; OUT: The buffer that holds the encoded property;
+ The 'encode' routine returns the size needed to encode the property value
+ if the buffer passed in is NULL or the size is zero. Otherwise it encodes
+ the property value into binary in buf.
+
+ The 'decode' callback is called when a property list with this
+ property is being decoded. H5P_prp_encode_func_t is defined as:
+ typedef herr_t (*H5P_prp_encode_func_t)(void *f, size_t *size,
+ void *value, void *plist, uint8_t **buf);
+ where the parameters to the callback function are:
+ void *f; IN: A fake file structure used to decode.
+ size_t *size; IN: UNUSED
+ void *value; IN: UNUSED
+ void *plist; IN: The property list structure.
+ uint8_t **buf; IN: The buffer that holds the binary encoded property;
+ The 'decode' routine decodes the binary buffer passed in and transforms it into
+ corresponding property values that are set in the property list passed in.
+
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
The 'set' callback function may be useful to range check the value being
@@ -1932,8 +1967,10 @@ done:
--------------------------------------------------------------------------*/
herr_t
H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size,
- const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set,
- H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete,
+ const void *def_value, H5P_prp_create_func_t prp_create,
+ H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
+ H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode,
+ H5P_prp_delete_func_t prp_delete,
H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp,
H5P_prp_close_func_t prp_close)
{
@@ -1953,7 +1990,9 @@ H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size,
HGOTO_ERROR(H5E_PLIST, H5E_EXISTS, FAIL, "property already exists")
/* Create property object from parameters */
- if(NULL == (new_prop = H5P_create_prop(name, size, H5P_PROP_WITHIN_CLASS, def_value, prp_create, prp_set, prp_get, prp_delete, prp_copy, prp_cmp, prp_close)))
+ if(NULL == (new_prop = H5P_create_prop(name, size, H5P_PROP_WITHIN_CLASS,
+ def_value, prp_create, prp_set, prp_get, prp_encode, prp_decode,
+ prp_delete, prp_copy, prp_cmp, prp_close)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property")
/* Insert property into property list class */
@@ -1991,6 +2030,8 @@ done:
creation callback
H5P_prp_set_func_t prp_set; IN: Function pointer to property set callback
H5P_prp_get_func_t prp_get; IN: Function pointer to property get callback
+ H5P_prp_encode_func_t prp_encode; IN: Function pointer to property encode
+ H5P_prp_decode_func_t prp_decode; IN: Function pointer to property decode
H5P_prp_delete_func_t prp_delete; IN: Function pointer to property delete callback
H5P_prp_copy_func_t prp_copy; IN: Function pointer to property copy callback
H5P_prp_compare_func_t prp_cmp; IN: Function pointer to property compare callback
@@ -2056,6 +2097,33 @@ done:
negative value, the property value is returned and the property list get
routine returns an error value.
+ The 'encode' callback is called when a property list with this
+ property is being encoded. H5P_prp_encode_func_t is defined as:
+ typedef herr_t (*H5P_prp_encode_func_t)(void *f, size_t *size,
+ void *value, void *plist, uint8_t **buf);
+ where the parameters to the callback function are:
+ void *f; IN: A fake file structure used to encode.
+ size_t *size; IN/OUT: The size of the buffer to encode the property.
+ void *value; IN: The value of the property being encoded.
+ void *plist; IN: The property list structure.
+ uint8_t **buf; OUT: The buffer that holds the encoded property;
+ The 'encode' routine returns the size needed to encode the property value
+ if the buffer passed in is NULL or the size is zero. Otherwise it encodes
+ the property value into binary in buf.
+
+ The 'decode' callback is called when a property list with this
+ property is being decoded. H5P_prp_encode_func_t is defined as:
+ typedef herr_t (*H5P_prp_encode_func_t)(void *f, size_t *size,
+ void *value, void *plist, uint8_t **buf);
+ where the parameters to the callback function are:
+ void *f; IN: A fake file structure used to decode.
+ size_t *size; IN: UNUSED
+ void *value; IN: UNUSED
+ void *plist; IN: The property list structure.
+ uint8_t **buf; IN: The buffer that holds the binary encoded property;
+ The 'decode' routine decodes the binary buffer passed in and transforms it into
+ corresponding property values that are set in the property list passed in.
+
The 'delete' callback is called when a property is deleted from a
property list. H5P_prp_del_func_t is defined as:
typedef herr_t (*H5P_prp_del_func_t)(hid_t prop_id, const char *name,
@@ -2131,8 +2199,10 @@ done:
--------------------------------------------------------------------------*/
herr_t
H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size,
- const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set,
- H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete,
+ const void *def_value, H5P_prp_create_func_t prp_create,
+ H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
+ H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode,
+ H5P_prp_delete_func_t prp_delete,
H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp,
H5P_prp_close_func_t prp_close)
{
@@ -2186,7 +2256,8 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size,
} /* end if */
/* Really register the property in the class */
- if(H5P_register_real(pclass, name, size, def_value, prp_create, prp_set, prp_get, prp_delete, prp_copy, prp_cmp, prp_close) < 0)
+ if(H5P_register_real(pclass, name, size, def_value, prp_create, prp_set, prp_get,
+ prp_encode, prp_decode, prp_delete, prp_copy, prp_cmp, prp_close) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "can't register property")
/* Update pointer to pointer to class, if a new one was generated */
@@ -2208,13 +2279,16 @@ done:
PURPOSE
Internal routine to insert a new property in a property list.
USAGE
- herr_t H5P_insert(plist, name, size, value, prp_set, prp_get, prp_close)
+ herr_t H5P_insert(plist, name, size, value, prp_set, prp_get, prp_close,
+ prp_encode, prp_decode)
H5P_genplist_t *plist; IN: Property list to add property to
const char *name; IN: Name of property to add
size_t size; IN: Size of property in bytes
void *value; IN: Pointer to the value for the property
H5P_prp_set_func_t prp_set; IN: Function pointer to property set callback
H5P_prp_get_func_t prp_get; IN: Function pointer to property get callback
+ H5P_prp_encode_func_t prp_encode; IN: Function pointer to property encode
+ H5P_prp_decode_func_t prp_decode; IN: Function pointer to property decode
H5P_prp_delete_func_t prp_delete; IN: Function pointer to property delete callback
H5P_prp_copy_func_t prp_copy; IN: Function pointer to property copy callback
H5P_prp_compare_func_t prp_cmp; IN: Function pointer to property compare callback
@@ -2264,6 +2338,33 @@ done:
negative value, the property value is returned and the property list get
routine returns an error value.
+ The 'encode' callback is called when a property list with this
+ property is being encoded. H5P_prp_encode_func_t is defined as:
+ typedef herr_t (*H5P_prp_encode_func_t)(void *f, size_t *size,
+ void *value, void *plist, uint8_t **buf);
+ where the parameters to the callback function are:
+ void *f; IN: A fake file structure used to encode.
+ size_t *size; IN/OUT: The size of the buffer to encode the property.
+ void *value; IN: The value of the property being encoded.
+ void *plist; IN: The property list structure.
+ uint8_t **buf; OUT: The buffer that holds the encoded property;
+ The 'encode' routine returns the size needed to encode the property value
+ if the buffer passed in is NULL or the size is zero. Otherwise it encodes
+ the property value into binary in buf.
+
+ The 'decode' callback is called when a property list with this
+ property is being decoded. H5P_prp_encode_func_t is defined as:
+ typedef herr_t (*H5P_prp_encode_func_t)(void *f, size_t *size,
+ void *value, void *plist, uint8_t **buf);
+ where the parameters to the callback function are:
+ void *f; IN: A fake file structure used to decode.
+ size_t *size; IN: UNUSED
+ void *value; IN: UNUSED
+ void *plist; IN: The property list structure.
+ uint8_t **buf; IN: The buffer that holds the binary encoded property;
+ The 'decode' routine decodes the binary buffer passed in and transforms it into
+ corresponding property values that are set in the property list passed in.
+
The 'delete' callback is called when a property is deleted from a
property list. H5P_prp_del_func_t is defined as:
typedef herr_t (*H5P_prp_del_func_t)(hid_t prop_id, const char *name,
@@ -2344,6 +2445,7 @@ done:
herr_t
H5P_insert(H5P_genplist_t *plist, const char *name, size_t size,
void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
+ H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode,
H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy,
H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close)
{
@@ -2391,7 +2493,9 @@ H5P_insert(H5P_genplist_t *plist, const char *name, size_t size,
/* Ok to add to property list */
/* Create property object from parameters */
- if(NULL == (new_prop = H5P_create_prop(name, size, H5P_PROP_WITHIN_LIST, value, NULL, prp_set, prp_get, prp_delete, prp_copy, prp_cmp, prp_close)))
+ if(NULL == (new_prop = H5P_create_prop(name, size, H5P_PROP_WITHIN_LIST, value, NULL,
+ prp_set, prp_get, prp_encode, prp_decode, prp_delete, prp_copy,
+ prp_cmp, prp_close)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "Can't create property")
/* Insert property into property list class */
@@ -2950,6 +3054,16 @@ H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2)
if(prop1->get != NULL && prop2->get == NULL) HGOTO_DONE(1);
if(prop1->get != prop2->get) HGOTO_DONE(-1);
+ /* Check if they both have the same 'encode' callback */
+ if(prop1->encode == NULL && prop2->encode != NULL) HGOTO_DONE(-1);
+ if(prop1->encode != NULL && prop2->encode == NULL) HGOTO_DONE(1);
+ if(prop1->encode != prop2->encode) HGOTO_DONE(-1);
+
+ /* Check if they both have the same 'decode' callback */
+ if(prop1->decode == NULL && prop2->decode != NULL) HGOTO_DONE(-1);
+ if(prop1->decode != NULL && prop2->decode == NULL) HGOTO_DONE(1);
+ if(prop1->decode != prop2->decode) HGOTO_DONE(-1);
+
/* Check if they both have the same 'delete' callback */
if(prop1->del == NULL && prop2->del != NULL) HGOTO_DONE(-1);
if(prop1->del != NULL && prop2->del == NULL) HGOTO_DONE(1);
@@ -4270,7 +4384,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name)
/* Create property object from parameters */
if(NULL == (new_prop = H5P_create_prop(prop->name, prop->size, H5P_PROP_WITHIN_LIST, prop->value,
- prop->create, prop->set, prop->get,
+ prop->create, prop->set, prop->get, prop->encode, prop->decode,
prop->del, prop->copy, prop->cmp, prop->close)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property")
@@ -4362,7 +4476,7 @@ H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name)
/* Register the property into the destination */
orig_dst_pclass = dst_pclass;
if(H5P_register(&dst_pclass, name, prop->size, prop->value, prop->create, prop->set, prop->get,
- prop->del, prop->copy, prop->cmp, prop->close) < 0)
+ prop->encode, prop->decode, prop->del, prop->copy, prop->cmp, prop->close) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property")
/* Check if the property class changed and needs to be substituted in the ID */
@@ -4871,3 +4985,121 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5P_close_class() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__new_plist_of_type
+ *
+ * Purpose: Create a new property list, of a given type
+ *
+ * Return: Success: ID of new property list
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, August 2, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5P__new_plist_of_type(H5P_plist_type_t type)
+{
+ H5P_genclass_t *pclass; /* Class of property list to create */
+ hid_t class_id; /* ID of class to create */
+ hid_t ret_value; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity checks */
+ HDcompile_assert(H5P_TYPE_LINK_ACCESS == (H5P_TYPE_MAX_TYPE - 1));
+ HDassert(type >= H5P_TYPE_USER && type <= H5P_TYPE_LINK_ACCESS);
+
+ /* Check arguments */
+ if(type == H5P_TYPE_USER)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't create user property list");
+ if(type == H5P_TYPE_ROOT)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "shouldn't be creating root class property list");
+
+ /* Instantiate a property list of the proper type */
+ switch(type) {
+ case H5P_TYPE_OBJECT_CREATE:
+ class_id = H5P_CLS_OBJECT_CREATE_g;
+ break;
+
+ case H5P_TYPE_FILE_CREATE:
+ class_id = H5P_CLS_FILE_CREATE_g;
+ break;
+
+ case H5P_TYPE_FILE_ACCESS:
+ class_id = H5P_CLS_FILE_ACCESS_g;
+ break;
+
+ case H5P_TYPE_DATASET_CREATE:
+ class_id = H5P_CLS_DATASET_CREATE_g;
+ break;
+
+ case H5P_TYPE_DATASET_ACCESS:
+ class_id = H5P_CLS_DATASET_ACCESS_g;
+ break;
+
+ case H5P_TYPE_DATASET_XFER:
+ class_id = H5P_CLS_DATASET_XFER_g;
+ break;
+
+ case H5P_TYPE_FILE_MOUNT:
+ class_id = H5P_CLS_FILE_MOUNT_g;
+ break;
+
+ case H5P_TYPE_GROUP_CREATE:
+ class_id = H5P_CLS_GROUP_CREATE_g;
+ break;
+
+ case H5P_TYPE_GROUP_ACCESS:
+ class_id = H5P_CLS_GROUP_ACCESS_g;
+ break;
+
+ case H5P_TYPE_DATATYPE_CREATE:
+ class_id = H5P_CLS_DATATYPE_CREATE_g;
+ break;
+
+ case H5P_TYPE_DATATYPE_ACCESS:
+ class_id = H5P_CLS_DATATYPE_ACCESS_g;
+ break;
+
+ case H5P_TYPE_STRING_CREATE:
+ class_id = H5P_CLS_STRING_CREATE_g;
+ break;
+
+ case H5P_TYPE_ATTRIBUTE_CREATE:
+ class_id = H5P_CLS_ATTRIBUTE_CREATE_g;
+ break;
+
+ case H5P_TYPE_OBJECT_COPY:
+ class_id = H5P_CLS_OBJECT_COPY_g;
+ break;
+
+ case H5P_TYPE_LINK_CREATE:
+ class_id = H5P_CLS_LINK_CREATE_g;
+ break;
+
+ case H5P_TYPE_LINK_ACCESS:
+ class_id = H5P_CLS_LINK_ACCESS_g;
+ break;
+
+ case H5P_TYPE_USER: /* shut compiler warnings up */
+ case H5P_TYPE_ROOT:
+ case H5P_TYPE_MAX_TYPE:
+ default:
+ HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "invalid property list type: %u\n", (unsigned)type);
+ } /* end switch */
+
+ /* Get the class object */
+ if(NULL == (pclass = (H5P_genclass_t *)H5I_object(class_id)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property class")
+
+ /* Create the new property list */
+ if((ret_value = H5P_create_id(pclass, TRUE)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__new_plist_of_type() */
+
diff --git a/src/H5Plapl.c b/src/H5Plapl.c
index 0697130..aa02546 100644
--- a/src/H5Plapl.c
+++ b/src/H5Plapl.c
@@ -48,10 +48,15 @@
/* Definitions for number of soft links to traverse */
#define H5L_ACS_NLINKS_SIZE sizeof(size_t)
#define H5L_ACS_NLINKS_DEF H5L_NUM_LINKS /*max symlinks to follow per lookup */
+#define H5L_ACS_NLINKS_ENC H5P__encode_size_t
+#define H5L_ACS_NLINKS_DEC H5P__decode_size_t
+
/* Definitions for external link prefix */
#define H5L_ACS_ELINK_PREFIX_SIZE sizeof(char *)
#define H5L_ACS_ELINK_PREFIX_DEF NULL /*default is no prefix */
+#define H5L_ACS_ELINK_PREFIX_ENC H5P_lacc_elink_pref_enc
+#define H5L_ACS_ELINK_PREFIX_DEC H5P_lacc_elink_pref_dec
#define H5L_ACS_ELINK_PREFIX_DEL H5P_lacc_elink_pref_del
#define H5L_ACS_ELINK_PREFIX_COPY H5P_lacc_elink_pref_copy
#define H5L_ACS_ELINK_PREFIX_CMP H5P_lacc_elink_pref_cmp
@@ -60,6 +65,8 @@
/* Definitions for setting fapl of external link access */
#define H5L_ACS_ELINK_FAPL_SIZE sizeof(hid_t)
#define H5L_ACS_ELINK_FAPL_DEF H5P_DEFAULT
+#define H5L_ACS_ELINK_FAPL_ENC H5P_lacc_elink_fapl_enc
+#define H5L_ACS_ELINK_FAPL_DEC H5P_lacc_elink_fapl_dec
#define H5L_ACS_ELINK_FAPL_DEL H5P_lacc_elink_fapl_del
#define H5L_ACS_ELINK_FAPL_COPY H5P_lacc_elink_fapl_copy
#define H5L_ACS_ELINK_FAPL_CMP H5P_lacc_elink_fapl_cmp
@@ -68,6 +75,8 @@
/* Definitions for file access flags for external link traversal */
#define H5L_ACS_ELINK_FLAGS_SIZE sizeof(unsigned)
#define H5L_ACS_ELINK_FLAGS_DEF H5F_ACC_DEFAULT
+#define H5L_ACS_ELINK_FLAGS_ENC H5P__encode_unsigned
+#define H5L_ACS_ELINK_FLAGS_DEC H5P__decode_unsigned
/* Definitions for callback function for external link traversal */
#define H5L_ACS_ELINK_CB_SIZE sizeof(H5L_elink_cb_t)
@@ -92,10 +101,14 @@
static herr_t H5P_lacc_reg_prop(H5P_genclass_t *pclass);
/* Property list callbacks */
+static herr_t H5P_lacc_elink_pref_enc(const void *value, void **_pp, size_t *size);
+static herr_t H5P_lacc_elink_pref_dec(const void **_pp, void *value);
static herr_t H5P_lacc_elink_pref_del(hid_t prop_id, const char* name, size_t size, void* value);
static herr_t H5P_lacc_elink_pref_copy(const char* name, size_t size, void* value);
static int H5P_lacc_elink_pref_cmp(const void *value1, const void *value2, size_t size);
static herr_t H5P_lacc_elink_pref_close(const char* name, size_t size, void* value);
+static herr_t H5P_lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size);
+static herr_t H5P_lacc_elink_fapl_dec(const void **_pp, void *value);
static herr_t H5P_lacc_elink_fapl_del(hid_t prop_id, const char* name, size_t size, void* value);
static herr_t H5P_lacc_elink_fapl_copy(const char* name, size_t size, void* value);
static int H5P_lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t size);
@@ -132,6 +145,13 @@ const H5P_libclass_t H5P_CLS_LACC[1] = {{
/* Local Variables */
/*******************/
+/* Property value defaults */
+static const size_t H5L_def_nlinks_g = H5L_ACS_NLINKS_DEF; /* Default number of soft links to traverse */
+static const char *H5L_def_elink_prefix_g = H5L_ACS_ELINK_PREFIX_DEF; /* Default external link prefix string */
+static const hid_t H5L_def_fapl_id_g = H5L_ACS_ELINK_FAPL_DEF; /* Default fapl for external link access */
+static const unsigned H5L_def_elink_flags_g = H5L_ACS_ELINK_FLAGS_DEF; /* Default file access flags for external link traversal */
+static const H5L_elink_cb_t H5L_def_elink_cb_g = H5L_ACS_ELINK_CB_DEF; /* Default external link traversal callback */
+
/*-------------------------------------------------------------------------
@@ -153,34 +173,38 @@ const H5P_libclass_t H5P_CLS_LACC[1] = {{
static herr_t
H5P_lacc_reg_prop(H5P_genclass_t *pclass)
{
- size_t nlinks = H5L_ACS_NLINKS_DEF; /* Default number of soft links to traverse */
- char *elink_prefix = H5L_ACS_ELINK_PREFIX_DEF; /* Default external link prefix string */
- hid_t def_fapl_id = H5L_ACS_ELINK_FAPL_DEF; /* Default fapl for external link access */
- unsigned elink_flags = H5L_ACS_ELINK_FLAGS_DEF; /* Default file access flags for external link traversal */
- H5L_elink_cb_t elink_cb = H5L_ACS_ELINK_CB_DEF; /* Default external link traversal callback */
-
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Register property for number of links traversed */
- if(H5P_register_real(pclass, H5L_ACS_NLINKS_NAME, H5L_ACS_NLINKS_SIZE, &nlinks, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5L_ACS_NLINKS_NAME, H5L_ACS_NLINKS_SIZE, &H5L_def_nlinks_g,
+ NULL, NULL, NULL, H5L_ACS_NLINKS_ENC, H5L_ACS_NLINKS_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register property for external link prefix */
- if(H5P_register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &elink_prefix, NULL, NULL, NULL, H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, H5L_ACS_ELINK_PREFIX_CMP, H5L_ACS_ELINK_PREFIX_CLOSE) < 0)
+ if(H5P_register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &H5L_def_elink_prefix_g,
+ NULL, NULL, NULL, H5L_ACS_ELINK_PREFIX_ENC, H5L_ACS_ELINK_PREFIX_DEC,
+ H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, H5L_ACS_ELINK_PREFIX_CMP, H5L_ACS_ELINK_PREFIX_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register fapl for link access */
- if(H5P_register_real(pclass, H5L_ACS_ELINK_FAPL_NAME, H5L_ACS_ELINK_FAPL_SIZE, &def_fapl_id, NULL, NULL, NULL, H5L_ACS_ELINK_FAPL_DEL, H5L_ACS_ELINK_FAPL_COPY, H5L_ACS_ELINK_FAPL_CMP, H5L_ACS_ELINK_FAPL_CLOSE) < 0)
+ if(H5P_register_real(pclass, H5L_ACS_ELINK_FAPL_NAME, H5L_ACS_ELINK_FAPL_SIZE, &H5L_def_fapl_id_g,
+ NULL, NULL, NULL, H5L_ACS_ELINK_FAPL_ENC, H5L_ACS_ELINK_FAPL_DEC,
+ H5L_ACS_ELINK_FAPL_DEL, H5L_ACS_ELINK_FAPL_COPY, H5L_ACS_ELINK_FAPL_CMP, H5L_ACS_ELINK_FAPL_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register property for external link file access flags */
- if(H5P_register_real(pclass, H5L_ACS_ELINK_FLAGS_NAME, H5L_ACS_ELINK_FLAGS_SIZE, &elink_flags, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5L_ACS_ELINK_FLAGS_NAME, H5L_ACS_ELINK_FLAGS_SIZE, &H5L_def_elink_flags_g,
+ NULL, NULL, NULL, H5L_ACS_ELINK_FLAGS_ENC, H5L_ACS_ELINK_FLAGS_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register property for external link file traversal callback */
- if(H5P_register_real(pclass, H5L_ACS_ELINK_CB_NAME, H5L_ACS_ELINK_CB_SIZE, &elink_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5L_ACS_ELINK_CB_NAME, H5L_ACS_ELINK_CB_SIZE, &H5L_def_elink_cb_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
@@ -188,6 +212,120 @@ done:
} /* end H5P_lacc_reg_prop() */
+/*-------------------------------------------------------------------------
+ * Function: H5P_lacc_elink_fapl_enc
+ *
+ * Purpose: Callback routine which is called whenever the elink FAPL
+ * property in the dataset access property list is
+ * encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, August 15, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P_lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size)
+{
+ const hid_t *elink_fapl = (const hid_t *)value; /* Property to encode */
+ uint8_t **pp = (uint8_t **)_pp;
+ H5P_genplist_t *fapl_plist; /* Pointer to property list */
+ hbool_t non_default_fapl = FALSE; /* Whether the FAPL is non-default */
+ size_t enc_size = 0; /* FAPL's encoded size */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Check for non-default FAPL */
+ if(*elink_fapl != H5P_DEFAULT) {
+ if(NULL == (fapl_plist = (H5P_genplist_t *)H5P_object_verify(*elink_fapl, H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property list")
+ non_default_fapl = TRUE;
+ } /* end if */
+
+ if(NULL != *pp) {
+ /* Store whether the FAPL is non-default */
+ *(*pp)++ = (uint8_t)non_default_fapl;
+ } /* end if */
+
+ /* Encode the property list, if non-default */
+ /* (if *pp == NULL, will only compute the size) */
+ if(non_default_fapl) {
+ if(H5P__encode(fapl_plist, TRUE, *pp, &enc_size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode property list")
+ if(*pp)
+ *pp += enc_size;
+ } /* end if */
+
+ *size += (1 + enc_size); /* Non-default flag, plus encoded property list size */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_lacc_elink_fapl_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P_lacc_elink_fapl_dec
+ *
+ * Purpose: Callback routine which is called whenever the elink FAPL
+ * property in the dataset access property list is
+ * decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, August 15, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P_lacc_elink_fapl_dec(const void **_pp, void *_value)
+{
+ hid_t *elink_fapl = (hid_t *)_value; /* The elink FAPL value */
+ const uint8_t **pp = (const uint8_t **)_pp;
+ hbool_t non_default_fapl; /* Whether the FAPL is non-default */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(elink_fapl);
+ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
+
+ /* Determine if the FAPL is non-default */
+ non_default_fapl = (hbool_t)*(*pp)++;
+
+ if(non_default_fapl) {
+ H5P_genplist_t *fapl_plist; /* Pointer to property list */
+ size_t enc_size = 0; /* Encoded size of property list */
+
+ /* Decode the property list */
+ if((*elink_fapl = H5P__decode(*pp)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "can't decode property")
+
+ /* Get the property list object */
+ if(NULL == (fapl_plist = (H5P_genplist_t *)H5P_object_verify(*elink_fapl, H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property list")
+
+ /* Compute the encoded size of the property list */
+ if(H5P__encode(fapl_plist, TRUE, NULL, &enc_size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't compute encoded property list size")
+
+ *pp += enc_size;
+ } /* end if */
+ else
+ *elink_fapl = H5P_DEFAULT;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_lacc_elink_fapl_dec() */
+
+
/*--------------------------------------------------------------------------
* Function: H5P_lacc_elink_fapl_del
*
@@ -344,6 +482,119 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5P_lacc_elink_pref_enc
+ *
+ * Purpose: Callback routine which is called whenever the elink flags
+ * property in the dataset access property list is
+ * encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Monday, October 10, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P_lacc_elink_pref_enc(const void *value, void **_pp, size_t *size)
+{
+ const char *elink_pref = *(const char * const *)value;
+ uint8_t **pp = (uint8_t **)_pp;
+ size_t len = 0;
+ uint64_t enc_value;
+ unsigned enc_size;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
+
+ /* calculate prefix length */
+ if(NULL != elink_pref)
+ len = HDstrlen(elink_pref);
+
+ enc_value = (uint64_t)len;
+ enc_size = H5V_limit_enc_size(enc_value);
+ HDassert(enc_size < 256);
+
+ if(NULL != *pp) {
+ /* encode the length of the prefix */
+ *(*pp)++ = (uint8_t)enc_size;
+ UINT64ENCODE_VAR(*pp, enc_value, enc_size);
+
+ /* encode the prefix */
+ if(NULL != elink_pref) {
+ HDmemcpy(*(char **)pp, elink_pref, len);
+ *pp += len;
+ } /* end if */
+ } /* end if */
+
+ *size += (1 + enc_size);
+ if(NULL != elink_pref)
+ *size += len;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P_lacc_elink_pref_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P_lacc_elink_pref_dec
+ *
+ * Purpose: Callback routine which is called whenever the elink prefix
+ * property in the dataset access property list is
+ * decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Monday, October 10, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P_lacc_elink_pref_dec(const void **_pp, void *_value)
+{
+ char **elink_pref = (char **)_value;
+ const uint8_t **pp = (const uint8_t **)_pp;
+ size_t len;
+ uint64_t enc_value; /* Decoded property value */
+ unsigned enc_size; /* Size of encoded property */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(elink_pref);
+ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
+
+ /* Decode the size */
+ enc_size = *(*pp)++;
+ HDassert(enc_size < 256);
+
+ /* Decode the value */
+ UINT64DECODE_VAR(*pp, enc_value, enc_size);
+ len = enc_value;
+
+ if(0 != len) {
+ /* Make a copy of the user's prefix string */
+ if(NULL == (*elink_pref = (char *)H5MM_malloc(len + 1)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix")
+ HDstrncpy(*elink_pref, *(const char **)pp, len);
+ (*elink_pref)[len] = '\0';
+
+ *pp += len;
+ } /* end if */
+ else
+ *elink_pref = NULL;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_lacc_elink_pref_dec() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5P_lacc_elink_pref_del
*
* Purpose: Frees memory used to store the external link prefix string
diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c
index b327df9..d81d55c 100644
--- a/src/H5Plcpl.c
+++ b/src/H5Plcpl.c
@@ -48,7 +48,8 @@
/* Definitions for create intermediate groups flag */
#define H5L_CRT_INTERMEDIATE_GROUP_SIZE sizeof(unsigned)
#define H5L_CRT_INTERMEDIATE_GROUP_DEF 0
-
+#define H5L_CRT_INTERMEDIATE_GROUP_ENC H5P__encode_unsigned
+#define H5L_CRT_INTERMEDIATE_GROUP_DEC H5P__decode_unsigned
/******************/
/* Local Typedefs */
@@ -98,6 +99,9 @@ const H5P_libclass_t H5P_CLS_LCRT[1] = {{
/* Local Variables */
/*******************/
+/* Property value defaults */
+static const unsigned H5L_def_intmd_group_g = H5L_CRT_INTERMEDIATE_GROUP_DEF; /* Default setting for creating intermediate groups */
+
/*-------------------------------------------------------------------------
@@ -114,13 +118,14 @@ const H5P_libclass_t H5P_CLS_LCRT[1] = {{
herr_t
H5P_lcrt_reg_prop(H5P_genclass_t *pclass)
{
- unsigned intmd_group = H5L_CRT_INTERMEDIATE_GROUP_DEF; /* Default setting for creating intermediate groups */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Register create intermediate groups property */
- if(H5P_register_real(pclass, H5L_CRT_INTERMEDIATE_GROUP_NAME, H5L_CRT_INTERMEDIATE_GROUP_SIZE, &intmd_group, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5L_CRT_INTERMEDIATE_GROUP_NAME, H5L_CRT_INTERMEDIATE_GROUP_SIZE, &H5L_def_intmd_group_g,
+ NULL, NULL, NULL, H5L_CRT_INTERMEDIATE_GROUP_ENC, H5L_CRT_INTERMEDIATE_GROUP_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c
index 5eba335..d8ddfee 100644
--- a/src/H5Pocpl.c
+++ b/src/H5Pocpl.c
@@ -37,6 +37,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object headers */
#include "H5Ppkg.h" /* Property lists */
@@ -48,12 +49,20 @@
/* ========= Object Creation properties ============ */
/* Definitions for the max. # of attributes to store compactly */
#define H5O_CRT_ATTR_MAX_COMPACT_SIZE sizeof(unsigned)
+#define H5O_CRT_ATTR_MAX_COMPACT_ENC H5P__encode_unsigned
+#define H5O_CRT_ATTR_MAX_COMPACT_DEC H5P__decode_unsigned
/* Definitions for the min. # of attributes to store densely */
#define H5O_CRT_ATTR_MIN_DENSE_SIZE sizeof(unsigned)
+#define H5O_CRT_ATTR_MIN_DENSE_ENC H5P__encode_unsigned
+#define H5O_CRT_ATTR_MIN_DENSE_DEC H5P__decode_unsigned
/* Definitions for object header flags */
#define H5O_CRT_OHDR_FLAGS_SIZE sizeof(uint8_t)
+#define H5O_CRT_OHDR_FLAGS_ENC H5P__encode_uint8_t
+#define H5O_CRT_OHDR_FLAGS_DEC H5P__decode_uint8_t
/* Definitions for filter pipeline */
#define H5O_CRT_PIPELINE_SIZE sizeof(H5O_pline_t)
+#define H5O_CRT_PIPELINE_ENC H5P__ocrt_pipeline_enc
+#define H5O_CRT_PIPELINE_DEC H5P__ocrt_pipeline_dec
#define H5O_CRT_PIPELINE_CMP H5P__ocrt_pipeline_cmp
@@ -77,6 +86,8 @@ static herr_t H5P__ocrt_copy(hid_t new_plist_t, hid_t old_plist_t, void *copy_da
static herr_t H5P__ocrt_close(hid_t dxpl_id, void *close_data);
/* Property callbacks */
+static herr_t H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size);
+static herr_t H5P__ocrt_pipeline_dec(const void **_pp, void *value);
static int H5P__ocrt_pipeline_cmp(const void *value1, const void *value2, size_t size);
@@ -111,6 +122,12 @@ const H5P_libclass_t H5P_CLS_OCRT[1] = {{
/* Local Variables */
/*******************/
+/* Property value defaults */
+static const unsigned H5O_def_attr_max_compact_g = H5O_CRT_ATTR_MAX_COMPACT_DEF; /* Default max. compact attribute storage settings */
+static const unsigned H5O_def_attr_min_dense_g = H5O_CRT_ATTR_MIN_DENSE_DEF; /* Default min. dense attribute storage settings */
+static const uint8_t H5O_def_ohdr_flags_g = H5O_CRT_OHDR_FLAGS_DEF; /* Default object header flag settings */
+static const H5O_pline_t H5O_def_pline_g = H5O_CRT_PIPELINE_DEF; /* Default I/O pipeline setting */
+
/*-------------------------------------------------------------------------
@@ -128,28 +145,32 @@ const H5P_libclass_t H5P_CLS_OCRT[1] = {{
static herr_t
H5P__ocrt_reg_prop(H5P_genclass_t *pclass)
{
- unsigned attr_max_compact = H5O_CRT_ATTR_MAX_COMPACT_DEF; /* Default max. compact attribute storage settings */
- unsigned attr_min_dense = H5O_CRT_ATTR_MIN_DENSE_DEF; /* Default min. dense attribute storage settings */
- uint8_t ohdr_flags = H5O_CRT_OHDR_FLAGS_DEF; /* Default object header flag settings */
- H5O_pline_t pline = H5O_CRT_PIPELINE_DEF; /* Default I/O pipeline setting */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Register max. compact attribute storage property */
- if(H5P_register_real(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, &attr_max_compact, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, &H5O_def_attr_max_compact_g,
+ NULL, NULL, NULL, H5O_CRT_ATTR_MAX_COMPACT_ENC, H5O_CRT_ATTR_MAX_COMPACT_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register min. dense attribute storage property */
- if(H5P_register_real(pclass, H5O_CRT_ATTR_MIN_DENSE_NAME, H5O_CRT_ATTR_MIN_DENSE_SIZE, &attr_min_dense, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5O_CRT_ATTR_MIN_DENSE_NAME, H5O_CRT_ATTR_MIN_DENSE_SIZE, &H5O_def_attr_min_dense_g,
+ NULL, NULL, NULL, H5O_CRT_ATTR_MIN_DENSE_ENC, H5O_CRT_ATTR_MIN_DENSE_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register object header flags property */
- if(H5P_register_real(pclass, H5O_CRT_OHDR_FLAGS_NAME, H5O_CRT_OHDR_FLAGS_SIZE, &ohdr_flags, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5O_CRT_OHDR_FLAGS_NAME, H5O_CRT_OHDR_FLAGS_SIZE, &H5O_def_ohdr_flags_g,
+ NULL, NULL, NULL, H5O_CRT_OHDR_FLAGS_ENC, H5O_CRT_OHDR_FLAGS_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the pipeline property */
- if(H5P_register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &pline, NULL, NULL, NULL, NULL, NULL, H5O_CRT_PIPELINE_CMP, NULL) < 0)
+ if(H5P_register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &H5O_def_pline_g,
+ NULL, NULL, NULL, H5O_CRT_PIPELINE_ENC, H5O_CRT_PIPELINE_DEC,
+ NULL, NULL, H5O_CRT_PIPELINE_CMP, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
@@ -1330,6 +1351,191 @@ H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/,
/*-------------------------------------------------------------------------
+ * Function: H5P__ocrt_pipeline_enc
+ *
+ * Purpose: Callback routine which is called whenever the pipeline
+ * property in the dataset access property list is
+ * decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Monday, October 10, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size)
+{
+ const H5O_pline_t *pline = (const H5O_pline_t *)value;
+ uint8_t **pp = (uint8_t **)_pp;
+ size_t u; /* Local index variable */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ HDassert(pline);
+ HDassert(size);
+ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
+
+ if(NULL != *pp) {
+ unsigned enc_size;
+ uint64_t enc_value;
+
+ /* Encode size of unsigned */
+ *(*pp)++ = (uint8_t)sizeof(unsigned);
+
+ /* encode nused value */
+ enc_value = (uint64_t)pline->nused;
+ enc_size = H5V_limit_enc_size(enc_value);
+ HDassert(enc_size < 256);
+ *(*pp)++ = (uint8_t)enc_size;
+ UINT64ENCODE_VAR(*pp, enc_value, enc_size);
+
+ /* encode each pipeline */
+ for(u = 0; u < pline->nused; u++) {
+ unsigned v; /* Local index variable */
+
+ /* encode filter ID */
+ INT32ENCODE(*pp, pline->filter[u].id)
+
+ /* encode filter flags */
+ H5_ENCODE_UNSIGNED(*pp, pline->filter[u].flags)
+
+ /* encode filter name if it exists */
+ if(NULL != pline->filter[u].name) {
+ /* encode TRUE indicating that it exits */
+ *(*pp)++ = (uint8_t)TRUE;
+
+ /* encode filter name */
+ HDmemcpy(*pp, (uint8_t *)(pline->filter[u].name), H5Z_COMMON_NAME_LEN);
+ *pp += H5Z_COMMON_NAME_LEN;
+ } /* end if */
+ else
+ /* encode FALSE indicating that it does not exist */
+ *(*pp)++ = (uint8_t)FALSE;
+
+ /* encode cd_nelmts */
+ enc_value = (uint64_t)pline->filter[u].cd_nelmts;
+ enc_size = H5V_limit_enc_size(enc_value);
+ HDassert(enc_size < 256);
+ *(*pp)++ = (uint8_t)enc_size;
+ UINT64ENCODE_VAR(*pp, enc_value, enc_size);
+
+ /* encode all values */
+ for(v = 0; v < pline->filter[u].cd_nelmts; v++)
+ H5_ENCODE_UNSIGNED(*pp, pline->filter[u].cd_values[v])
+ } /* end for */
+ } /* end if */
+
+ /* calculate size required for encoding */
+ *size += 1;
+ *size += (1 + H5V_limit_enc_size((uint64_t)pline->nused));
+ for(u = 0; u < pline->nused; u++) {
+ *size += (sizeof(int32_t) + sizeof(unsigned) + 1);
+ if(NULL != pline->filter[u].name)
+ *size += H5Z_COMMON_NAME_LEN;
+ *size += (1 + H5V_limit_enc_size((uint64_t)pline->filter[u].cd_nelmts));
+ *size += pline->filter[u].cd_nelmts * sizeof(unsigned);
+ } /* end for */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__ocrt_pipeline_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__ocrt_pipeline_dec
+ *
+ * Purpose: Callback routine which is called whenever the pipeline
+ * property in the dataset access property list is
+ * decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Monday, October 10, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__ocrt_pipeline_dec(const void **_pp, void *_value)
+{
+ H5O_pline_t *pline = (H5O_pline_t *)_value; /* Property to set */
+ const uint8_t **pp = (const uint8_t **)_pp;
+ size_t nused; /* Number of filters used for pipeline */
+ unsigned enc_size; /* Size of encoded value (in bytes) */
+ uint64_t enc_value; /* Value to encode */
+ size_t u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
+
+ /* Decode the size of size_t */
+ enc_size = *(*pp)++;
+ if(enc_size != sizeof(unsigned))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded")
+
+ /* decode nused */
+ enc_size = *(*pp)++;
+ HDassert(enc_size < 256);
+ UINT64DECODE_VAR(*pp, enc_value, enc_size);
+ nused = (size_t)enc_value;
+
+ /* Set property default value */
+ *pline = H5O_def_pline_g;
+
+ for(u = 0; u < nused; u++) {
+ H5Z_filter_info_t filter; /* Filter info, for pipeline */
+ uint8_t has_name; /* Flag to indicate whether filter has a name */
+ unsigned v; /* Local index variable */
+
+ /* decode filter id */
+ INT32DECODE(*pp, filter.id)
+
+ /* decode filter flags */
+ H5_DECODE_UNSIGNED(*pp, filter.flags)
+
+ /* decode value indicating if the name is encoded */
+ has_name = *(*pp)++;
+ if(has_name) {
+ /* decode name */
+ filter.name = H5MM_xstrdup((const char *)(*pp));
+ *pp += H5Z_COMMON_NAME_LEN;
+ } /* end if */
+ else
+ filter.name = NULL;
+
+ /* decode num elements */
+ enc_size = *(*pp)++;
+ HDassert(enc_size < 256);
+ UINT64DECODE_VAR(*pp, enc_value, enc_size);
+ filter.cd_nelmts = (size_t)enc_value;
+
+ if(filter.cd_nelmts) {
+ if(NULL == (filter.cd_values = (unsigned *)H5MM_malloc(sizeof(unsigned) * filter.cd_nelmts)))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for cd_values")
+ } /* end if */
+ else
+ filter.cd_values = NULL;
+
+ /* decode values */
+ for(v = 0; v < filter.cd_nelmts; v++)
+ H5_DECODE_UNSIGNED(*pp, filter.cd_values[v])
+
+ /* Add the filter to the I/O pipeline */
+ if(H5Z_append(pline, filter.id, filter.flags, filter.cd_nelmts, filter.cd_values) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline")
+ } /* end for */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5P__ocrt_pipeline_dec() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5P__ocrt_pipeline_cmp
*
* Purpose: Callback routine which is called whenever a filter pipeline
diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c
index 0ba5625..e5e5f51 100644
--- a/src/H5Pocpypl.c
+++ b/src/H5Pocpypl.c
@@ -49,9 +49,13 @@
/* Definitions for copy options */
#define H5O_CPY_OPTION_SIZE sizeof(unsigned)
#define H5O_CPY_OPTION_DEF 0
+#define H5O_CPY_OPTION_ENC H5P__encode_unsigned
+#define H5O_CPY_OPTION_DEC H5P__decode_unsigned
/* Definitions for merge committed dtype list */
#define H5O_CPY_MERGE_COMM_DT_LIST_SIZE sizeof(char *)
#define H5O_CPY_MERGE_COMM_DT_LIST_DEF NULL
+#define H5O_CPY_MERGE_COMM_DT_LIST_ENC H5P__ocpy_merge_comm_dt_list_enc
+#define H5O_CPY_MERGE_COMM_DT_LIST_DEC H5P__ocpy_merge_comm_dt_list_dec
#define H5O_CPY_MERGE_COMM_DT_LIST_COPY H5P__ocpy_merge_comm_dt_list_copy
#define H5O_CPY_MERGE_COMM_DT_LIST_CMP H5P__ocpy_merge_comm_dt_list_cmp
#define H5O_CPY_MERGE_COMM_DT_LIST_CLOSE H5P__ocpy_merge_comm_dt_list_close
@@ -81,6 +85,8 @@ static H5O_copy_dtype_merge_list_t *H5P__free_merge_comm_dtype_list(H5O_copy_dty
static herr_t H5P__ocpy_reg_prop(H5P_genclass_t *pclass);
/* Property callbacks */
+static herr_t H5P__ocpy_merge_comm_dt_list_enc(const void *value, void **_pp, size_t *size);
+static herr_t H5P__ocpy_merge_comm_dt_list_dec(const void **_pp, void *value);
static herr_t H5P__ocpy_merge_comm_dt_list_copy(const char* name, size_t size, void* value);
static int H5P__ocpy_merge_comm_dt_list_cmp(const void *value1, const void *value2, size_t size);
static herr_t H5P__ocpy_merge_comm_dt_list_close(const char* name, size_t size, void* value);
@@ -116,6 +122,11 @@ const H5P_libclass_t H5P_CLS_OCPY[1] = {{
/* Local Variables */
/*******************/
+/* Property value defaults */
+static const unsigned H5O_def_ocpy_option_g = H5O_CPY_OPTION_DEF; /* Default object copy flags */
+static const H5O_copy_dtype_merge_list_t *H5O_def_merge_comm_dtype_list_g = H5O_CPY_MERGE_COMM_DT_LIST_DEF; /* Default merge committed dtype list */
+static const H5O_mcdt_cb_info_t H5O_def_mcdt_cb_g = H5O_CPY_MCDT_SEARCH_CB_DEF; /* Default callback before searching the global list of committed datatypes at destination */
+
/* Declare a free list to manage the H5O_copy_dtype_merge_list_t struct */
H5FL_DEFINE(H5O_copy_dtype_merge_list_t);
@@ -135,23 +146,26 @@ H5FL_DEFINE(H5O_copy_dtype_merge_list_t);
static herr_t
H5P__ocpy_reg_prop(H5P_genclass_t *pclass)
{
- unsigned ocpy_option = H5O_CPY_OPTION_DEF; /* Default object copy flags */
- H5O_copy_dtype_merge_list_t *merge_comm_dtype_list = H5O_CPY_MERGE_COMM_DT_LIST_DEF; /* Default merge committed dtype list */
- H5O_mcdt_cb_info_t mcdt_cb = H5O_CPY_MCDT_SEARCH_CB_DEF; /* Default callback before searching the global list of committed datatypes at destination */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Register copy options property */
- if(H5P_register_real(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, &ocpy_option, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, &H5O_def_ocpy_option_g,
+ NULL, NULL, NULL, H5O_CPY_OPTION_ENC, H5O_CPY_OPTION_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register merge named dtype list property */
- if(H5P_register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &merge_comm_dtype_list, NULL, NULL, NULL, NULL, H5O_CPY_MERGE_COMM_DT_LIST_COPY, H5O_CPY_MERGE_COMM_DT_LIST_CMP, H5O_CPY_MERGE_COMM_DT_LIST_CLOSE) < 0)
+ if(H5P_register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &H5O_def_merge_comm_dtype_list_g,
+ NULL, NULL, NULL, H5O_CPY_MERGE_COMM_DT_LIST_ENC, H5O_CPY_MERGE_COMM_DT_LIST_DEC,
+ NULL, H5O_CPY_MERGE_COMM_DT_LIST_COPY, H5O_CPY_MERGE_COMM_DT_LIST_CMP, H5O_CPY_MERGE_COMM_DT_LIST_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register property for callback when completing the search for a matching named datatype from the named dtype list */
- if(H5P_register_real(pclass, H5O_CPY_MCDT_SEARCH_CB_NAME, H5O_CPY_MCDT_SEARCH_CB_SIZE, &mcdt_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P_register_real(pclass, H5O_CPY_MCDT_SEARCH_CB_NAME, H5O_CPY_MCDT_SEARCH_CB_SIZE, &H5O_def_mcdt_cb_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
@@ -189,6 +203,137 @@ H5P__free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list)
} /* H5P__free_merge_comm_dtype_list */
+/*-------------------------------------------------------------------------
+ * Function: H5P__ocpy_merge_comm_dt_list_enc
+ *
+ * Purpose: Callback routine which is called whenever the common
+ * datatype property in the object copy property list is
+ * decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 31, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__ocpy_merge_comm_dt_list_enc(const void *value, void **_pp, size_t *size)
+{
+ const H5O_copy_dtype_merge_list_t * const *dt_list_ptr = (const H5O_copy_dtype_merge_list_t * const *)value;
+ uint8_t **pp = (uint8_t **)_pp;
+ const H5O_copy_dtype_merge_list_t *dt_list; /* Pointer to merge named datatype list */
+ size_t len; /* Length of path component */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ HDassert(dt_list_ptr);
+ HDassert(size);
+
+ /* Iterate over merge committed dtype list */
+ dt_list = *dt_list_ptr;
+ while(dt_list) {
+ /* Get length of encoded path */
+ len = HDstrlen(dt_list->path) + 1;
+
+ /* Encode merge committed dtype list */
+ if(*pp) {
+ HDmemcpy(*(char **)pp, dt_list->path, len);
+ *pp += len;
+ } /* end if */
+
+ /* Increment the size of the buffer */
+ *size += len;
+
+ /* Advance to the next node */
+ dt_list = dt_list->next;
+ } /* end while */
+
+ /* Encode the terminator for the string sequence */
+ if(*pp)
+ *(*pp)++ = (uint8_t)'\0';
+
+ /* Account for the string sequence terminator */
+ *size += 1;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__ocpy_merge_comm_dt_list_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__ocpy_merge_comm_dt_list_dec
+ *
+ * Purpose: Callback routine which is called whenever the common
+ * datatype property in the dataset access property list is
+ * decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 31, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__ocpy_merge_comm_dt_list_dec(const void **_pp, void *_value)
+{
+ H5O_copy_dtype_merge_list_t **dt_list = (H5O_copy_dtype_merge_list_t **)_value; /* Pointer to merge named datatype list */
+ const uint8_t **pp = (const uint8_t **)_pp;
+ H5O_copy_dtype_merge_list_t *dt_list_tail = NULL, *tmp_dt_list = NULL; /* temporary merge named datatype lists */
+ size_t len; /* Length of path component */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(dt_list);
+
+ /* Decode the string sequence */
+ len = HDstrlen(*(const char **)pp);
+ while(len > 0) {
+ /* Create new node & duplicate string */
+ if(NULL == (tmp_dt_list = H5FL_CALLOC(H5O_copy_dtype_merge_list_t)))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed")
+ if(NULL == (tmp_dt_list->path = H5MM_strdup(*(const char **)pp)))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed")
+ *pp += len + 1;
+ HDassert(len == HDstrlen(tmp_dt_list->path));
+
+ /* Add copied node to dtype list */
+ if(dt_list_tail) {
+ dt_list_tail->next = tmp_dt_list;
+ dt_list_tail = tmp_dt_list;
+ } /* end if */
+ else {
+ *dt_list = tmp_dt_list;
+ dt_list_tail = tmp_dt_list;
+ } /* end else */
+ tmp_dt_list = NULL;
+
+ /* Compute length of next string */
+ len = HDstrlen(*(const char **)pp);
+ } /* end while */
+
+ /* Advance past terminator for string sequence */
+ *pp += 1;
+
+done:
+ if(ret_value < 0) {
+ *dt_list = H5P__free_merge_comm_dtype_list(*dt_list);
+ if(tmp_dt_list) {
+ tmp_dt_list->path = (char *)H5MM_xfree(tmp_dt_list->path);
+ tmp_dt_list = H5FL_FREE(H5O_copy_dtype_merge_list_t, tmp_dt_list);
+ } /* end if */
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5P__ocpy_merge_comm_dt_list_dec() */
+
+
/*--------------------------------------------------------------------------
* Function: H5P__ocpy_merge_comm_dt_list_copy
*
diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h
index c877d1b..835b766 100644
--- a/src/H5Ppkg.h
+++ b/src/H5Ppkg.h
@@ -75,6 +75,8 @@ typedef struct H5P_genprop_t {
H5P_prp_create_func_t create; /* Function to call when a property is created */
H5P_prp_set_func_t set; /* Function to call when a property value is set */
H5P_prp_get_func_t get; /* Function to call when a property value is retrieved */
+ H5P_prp_encode_func_t encode; /* Function to call when a property is encoded */
+ H5P_prp_decode_func_t decode; /* Function to call when a property is decoded */
H5P_prp_delete_func_t del; /* Function to call when a property is deleted */
H5P_prp_copy_func_t copy; /* Function to call when a property is copied */
H5P_prp_compare_func_t cmp; /* Function to call when a property is compared */
@@ -159,13 +161,17 @@ H5_DLL H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class,
H5P_cls_close_func_t cls_close, void *close_data);
H5_DLL H5P_genclass_t *H5P_copy_pclass(H5P_genclass_t *pclass);
H5_DLL herr_t H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size,
- const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set,
- H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete,
+ const void *def_value, H5P_prp_create_func_t prp_create,
+ H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
+ H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode,
+ H5P_prp_delete_func_t prp_delete,
H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp,
H5P_prp_close_func_t prp_close);
H5_DLL herr_t H5P_register(H5P_genclass_t **pclass, const char *name, size_t size,
- const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set,
- H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete,
+ const void *def_value, H5P_prp_create_func_t prp_create,
+ H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
+ H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode,
+ H5P_prp_delete_func_t prp_delete,
H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp,
H5P_prp_close_func_t prp_close);
H5_DLL herr_t H5P_add_prop(H5SL_t *props, H5P_genprop_t *prop);
@@ -195,6 +201,24 @@ H5_DLL herr_t H5P_get_filter(const H5Z_filter_info_t *filter,
unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[],
size_t namelen, char name[], unsigned *filter_config);
H5_DLL H5P_genprop_t *H5P__find_prop_plist(const H5P_genplist_t *plist, const char *name);
+H5_DLL hid_t H5P__new_plist_of_type(H5P_plist_type_t type);
+
+/* Encode/decode routines */
+H5_DLL herr_t H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop,
+ void *buf, size_t *nalloc);
+H5_DLL hid_t H5P__decode(const void *buf);
+H5_DLL herr_t H5P__encode_hsize_t(const void *value, void **_pp, size_t *size);
+H5_DLL herr_t H5P__encode_size_t(const void *value, void **_pp, size_t *size);
+H5_DLL herr_t H5P__encode_unsigned(const void *value, void **_pp, size_t *size);
+H5_DLL herr_t H5P__encode_uint8_t(const void *value, void **_pp, size_t *size);
+H5_DLL herr_t H5P__encode_hbool_t(const void *value, void **_pp, size_t *size);
+H5_DLL herr_t H5P__encode_double(const void *value, void **_pp, size_t *size);
+H5_DLL herr_t H5P__decode_hsize_t(const void **_pp, void *value);
+H5_DLL herr_t H5P__decode_size_t(const void **_pp, void *value);
+H5_DLL herr_t H5P__decode_unsigned(const void **_pp, void *value);
+H5_DLL herr_t H5P__decode_uint8_t(const void **_pp, void *value);
+H5_DLL herr_t H5P__decode_hbool_t(const void **_pp, void *value);
+H5_DLL herr_t H5P__decode_double(const void **_pp, void *value);
/* Testing functions */
#ifdef H5P_TESTING
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index c750070..6560064 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -84,6 +84,7 @@ H5_DLL herr_t H5P_get(const H5P_genplist_t *plist, const char *name, void *value
H5_DLL herr_t H5P_set(H5P_genplist_t *plist, const char *name, const void *value);
H5_DLL herr_t H5P_insert(H5P_genplist_t *plist, const char *name, size_t size,
void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
+ H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode,
H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy,
H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close);
H5_DLL herr_t H5P_remove(hid_t plist_id, H5P_genplist_t *plist, const char *name);
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 1085d75..efcba65 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -113,6 +113,8 @@ typedef herr_t (*H5P_prp_cb2_t)(hid_t prop_id, const char *name, size_t size, vo
typedef H5P_prp_cb1_t H5P_prp_create_func_t;
typedef H5P_prp_cb2_t H5P_prp_set_func_t;
typedef H5P_prp_cb2_t H5P_prp_get_func_t;
+typedef herr_t (*H5P_prp_encode_func_t)(const void *value, void **buf, size_t *size);
+typedef herr_t (*H5P_prp_decode_func_t)(const void **buf, void *value);
typedef H5P_prp_cb2_t H5P_prp_delete_func_t;
typedef H5P_prp_cb1_t H5P_prp_copy_func_t;
typedef int (*H5P_prp_compare_func_t)(const void *value1, const void *value2, size_t size);
@@ -129,8 +131,7 @@ typedef enum H5D_mpio_actual_chunk_opt_mode_t {
*/
H5D_MPIO_NO_CHUNK_OPTIMIZATION = 0,
H5D_MPIO_LINK_CHUNK,
- H5D_MPIO_MULTI_CHUNK,
- H5D_MPIO_MULTI_CHUNK_NO_OPT
+ H5D_MPIO_MULTI_CHUNK
} H5D_mpio_actual_chunk_opt_mode_t;
typedef enum H5D_mpio_actual_io_mode_t {
@@ -229,6 +230,8 @@ H5_DLL herr_t H5Pinsert2(hid_t plist_id, const char *name, size_t size,
H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close);
H5_DLL herr_t H5Pset(hid_t plist_id, const char *name, void *value);
H5_DLL htri_t H5Pexist(hid_t plist_id, const char *name);
+H5_DLL herr_t H5Pencode(hid_t plist_id, void *buf, size_t *nalloc);
+H5_DLL hid_t H5Pdecode(const void *buf);
H5_DLL herr_t H5Pget_size(hid_t id, const char *name, size_t *size);
H5_DLL herr_t H5Pget_nprops(hid_t id, size_t *nprops);
H5_DLL hid_t H5Pget_class(hid_t plist_id);
diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c
index 505e35f..bedacb0 100644
--- a/src/H5Pstrcpl.c
+++ b/src/H5Pstrcpl.c
@@ -46,6 +46,8 @@
/* Definitions for character set encoding property */
#define H5P_STRCRT_CHAR_ENCODING_SIZE sizeof(H5T_cset_t)
#define H5P_STRCRT_CHAR_ENCODING_DEF H5F_DEFAULT_CSET
+#define H5P_STRCRT_CHAR_ENCODING_ENC H5P__strcrt_char_encoding_enc
+#define H5P_STRCRT_CHAR_ENCODING_DEC H5P__strcrt_char_encoding_dec
/******************/
@@ -65,6 +67,10 @@
/* Property class callbacks */
static herr_t H5P__strcrt_reg_prop(H5P_genclass_t *pclass);
+/* encode & decode callbacks */
+static herr_t H5P__strcrt_char_encoding_enc(const void *value, void **_pp, size_t *size);
+static herr_t H5P__strcrt_char_encoding_dec(const void **_pp, void *value);
+
/*********************/
/* Package Variables */
@@ -96,6 +102,9 @@ const H5P_libclass_t H5P_CLS_STRCRT[1] = {{
/* Local Variables */
/*******************/
+/* Property value defaults */
+static const H5T_cset_t H5P_def_char_encoding_g = H5P_STRCRT_CHAR_ENCODING_DEF; /* Default character set encoding */
+
/*-------------------------------------------------------------------------
@@ -112,13 +121,14 @@ const H5P_libclass_t H5P_CLS_STRCRT[1] = {{
static herr_t
H5P__strcrt_reg_prop(H5P_genclass_t *pclass)
{
- H5T_cset_t char_encoding = H5P_STRCRT_CHAR_ENCODING_DEF; /* Default character set encoding */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Register character encoding */
- if(H5P_register_real(pclass, H5P_STRCRT_CHAR_ENCODING_NAME, H5P_STRCRT_CHAR_ENCODING_SIZE, &char_encoding, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register_real(pclass, H5P_STRCRT_CHAR_ENCODING_NAME, H5P_STRCRT_CHAR_ENCODING_SIZE, &H5P_def_char_encoding_g,
+ NULL, NULL, NULL, H5P_STRCRT_CHAR_ENCODING_ENC, H5P_STRCRT_CHAR_ENCODING_DEC,
+ NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
@@ -196,3 +206,76 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_char_encoding() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__strcrt_char_encoding_enc
+ *
+ * Purpose: Callback routine which is called whenever the character
+ * set encoding property in the string create property list
+ * is encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 31, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__strcrt_char_encoding_enc(const void *value, void **_pp, size_t *size)
+{
+ const H5T_cset_t *encoding = (const H5T_cset_t *)value; /* Create local alias for values */
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(encoding);
+ HDassert(size);
+
+ if(NULL != *pp)
+ /* Encode character set encoding */
+ *(*pp)++ = (uint8_t)*encoding;
+
+ /* Size of character set encoding */
+ (*size)++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__strcrt_char_encoding_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__strcrt_char_encoding_dec
+ *
+ * Purpose: Callback routine which is called whenever the character
+ * set encoding property in the string create property list
+ * is decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 31, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__strcrt_char_encoding_dec(const void **_pp, void *_value)
+{
+ H5T_cset_t *encoding = (H5T_cset_t *)_value; /* Character set encoding */
+ const uint8_t **pp = (const uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(encoding);
+
+ /* Decode character set encoding */
+ *encoding = (H5T_cset_t)*(*pp)++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__strcrt_char_encoding_dec() */
+
diff --git a/src/H5T.c b/src/H5T.c
index f6514f0..9006b49 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -292,8 +292,6 @@ static herr_t H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src,
static herr_t H5T_register(H5T_pers_t pers, const char *name, H5T_t *src,
H5T_t *dst, H5T_conv_t func, hid_t dxpl_id, hbool_t api_call);
static htri_t H5T_compiler_conv(H5T_t *src, H5T_t *dst);
-static herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc);
-static H5T_t *H5T_decode(const unsigned char *buf);
static herr_t H5T_set_size(H5T_t *dt, size_t size);
@@ -1062,6 +1060,8 @@ H5T_init_interface(void)
status |= H5T_register(H5T_PERS_SOFT, "struct(no-opt)", compound, compound, H5T__conv_struct, H5AC_dxpl_id, FALSE);
status |= H5T_register(H5T_PERS_SOFT, "struct(opt)", compound, compound, H5T__conv_struct_opt, H5AC_dxpl_id, FALSE);
status |= H5T_register(H5T_PERS_SOFT, "enum", enum_type, enum_type, H5T__conv_enum, H5AC_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_SOFT, "enum_i", enum_type, fixedpt, H5T__conv_enum_numeric, H5AC_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_SOFT, "enum_f", enum_type, floatpt, H5T__conv_enum_numeric, H5AC_dxpl_id, FALSE);
status |= H5T_register(H5T_PERS_SOFT, "vlen", vlen, vlen, H5T__conv_vlen, H5AC_dxpl_id, FALSE);
status |= H5T_register(H5T_PERS_SOFT, "array", array, array, H5T__conv_array, H5AC_dxpl_id, FALSE);
status |= H5T_register(H5T_PERS_SOFT, "objref", objref, objref, H5T__conv_order_opt, H5AC_dxpl_id, FALSE);
@@ -2897,7 +2897,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc)
{
size_t buf_size; /* Encoded size of datatype */
@@ -2954,7 +2954,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5T_t *
+H5T_t *
H5T_decode(const unsigned char *buf)
{
H5F_t *f = NULL; /* Fake file structure*/
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 983922f..5ecf864 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -2889,6 +2889,86 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5T__conv_enum_numeric
+ *
+ * Purpose: Converts enumerated data to a numeric type (integer or
+ * floating-point number). This function is registered into
+ * the conversion table twice in H5T_init_interface in H5T.c.
+ * Once for enum-integer conversion. Once for enum-float conversion.
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: negative
+ *
+ * Programmer: Raymond Lu
+ * 12 October 2012
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5T__conv_enum_numeric(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
+ size_t buf_stride, size_t UNUSED bkg_stride, void *_buf,
+ void UNUSED *bkg, hid_t UNUSED dxpl_id)
+{
+ H5T_t *src, *dst; /*src and dst datatypes */
+ H5T_t *src_parent; /*parent type for src */
+ hid_t src_parent_id = -1; /*ID for parent of the source */
+ H5T_path_t *tpath; /* Conversion information */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ switch(cdata->command) {
+ case H5T_CONV_INIT:
+ /*
+ * Determine if this conversion function applies to the conversion
+ * path SRC_ID->DST_ID. If not, return failure.
+ */
+ if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype")
+ if(H5T_ENUM != src->shared->type)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "source type is not a H5T_ENUM datatype")
+ if(H5T_INTEGER != dst->shared->type && H5T_FLOAT != dst->shared->type)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "destination is not an integer type")
+
+ cdata->need_bkg = H5T_BKG_NO;
+ break;
+
+ case H5T_CONV_FREE:
+ break;
+
+ case H5T_CONV_CONV:
+ if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+
+ src_parent = src->shared->parent;
+
+ if(NULL == (tpath = H5T_path_find(src_parent, dst, NULL, NULL, dxpl_id, FALSE))) {
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatype")
+ } else if(!H5T_path_noop(tpath)) {
+ if((src_parent_id = H5I_register(H5I_DATATYPE, H5T_copy(src_parent, H5T_COPY_ALL), FALSE)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion")
+
+ /* Convert the data */
+ if(H5T_convert(tpath, src_parent_id, dst_id, nelmts, buf_stride, bkg_stride, _buf, bkg, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
+ }
+ break;
+
+ default:
+ /* Some other command we don't know about yet.*/
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command")
+ } /* end switch */
+
+done:
+ /* Release the temporary datatype IDs used */
+ if(src_parent_id >= 0)
+ H5I_dec_ref(src_parent_id);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__conv_enum_numeric() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5T__conv_vlen
*
* Purpose: Converts between VL datatypes in memory and on disk.
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index b9364d6..8323e15 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -544,6 +544,10 @@ H5_DLL herr_t H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
size_t bkg_stride, void *buf, void *bkg,
hid_t dset_xfer_plist);
+H5_DLL herr_t H5T__conv_enum_numeric(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
+ size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg,
+ hid_t dset_xfer_plist);
H5_DLL herr_t H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
size_t bkg_stride, void *buf, void *bkg,
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 345924c..558afaf 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -114,6 +114,8 @@ H5_DLL H5T_class_t H5T_get_class(const H5T_t *dt, htri_t internal);
H5_DLL htri_t H5T_detect_class(const H5T_t *dt, H5T_class_t cls, hbool_t from_api);
H5_DLL size_t H5T_get_size(const H5T_t *dt);
H5_DLL int H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset);
+H5_DLL herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc);
+H5_DLL H5T_t *H5T_decode(const unsigned char *buf);
H5_DLL herr_t H5T_debug(const H5T_t *dt, FILE * stream);
H5_DLL struct H5O_loc_t *H5T_oloc(H5T_t *dt);
H5_DLL H5G_name_t *H5T_nameof(H5T_t *dt);
diff --git a/src/H5detect.c b/src/H5detect.c
index 87a4fd5..d6f6a3b 100644
--- a/src/H5detect.c
+++ b/src/H5detect.c
@@ -120,7 +120,7 @@ static void print_results(int nd, detected_t *d, int na, malign_t *m);
static void iprint(detected_t *);
static int byte_cmp(int, const void *, const void *);
static int bit_cmp(int, int *, volatile void *, volatile void *);
-static void fix_order(int, int, int, int *, const char **);
+static void fix_order(int, int, int *, const char **);
static int imp_bit(int, int *, volatile void *, volatile void *);
static unsigned long find_bias(int, int, int *, void *);
static void precision (detected_t*);
@@ -293,7 +293,7 @@ precision (detected_t *d)
#define DETECT_F(TYPE,VAR,INFO) { \
volatile TYPE _v1, _v2, _v3; \
unsigned char _buf1[sizeof(TYPE)], _buf3[sizeof(TYPE)]; \
- int _i, _j, _first = (-1), _last = (-1); \
+ int _i, _j, _last = (-1); \
char *_mesg; \
\
memset(&INFO, 0, sizeof(INFO)); \
@@ -315,15 +315,11 @@ precision (detected_t *d)
memcpy(_buf3, (const void *)&_v3, sizeof(TYPE)); \
_j = byte_cmp(sizeof(TYPE), &_buf3, &_buf1); \
if(_j >= 0) { \
- if(0 == _i || INFO.perm[_i - 1] != _j) { \
- INFO.perm[_i] = _j; \
- _last = _i; \
- if(_first < 0) \
- _first = _i; \
- } \
+ INFO.perm[_i] = _j; \
+ _last = _i; \
} \
} \
- fix_order(sizeof(TYPE), _first, _last, INFO.perm, (const char**)&_mesg); \
+ fix_order(sizeof(TYPE), _last, INFO.perm, (const char**)&_mesg); \
\
if(!strcmp(_mesg, "VAX")) \
INFO.is_vax = TRUE; \
@@ -973,11 +969,11 @@ bit_cmp(int nbytes, int *perm, volatile void *_a, volatile void *_b)
*-------------------------------------------------------------------------
*/
static void
-fix_order(int n, int first, int last, int *perm, const char **mesg)
+fix_order(int n, int last, int *perm, const char **mesg)
{
int i;
- if (first + 1 < last) {
+ if (last > 1) {
/*
* We have at least three points to consider.
*/
@@ -998,6 +994,9 @@ fix_order(int n, int first, int last, int *perm, const char **mesg)
} else {
/*
* Bi-endian machines like VAX.
+ * (NOTE: This is not an actual determination of the VAX-endianess.
+ * It could have some other endianess and fall into this
+ * case - JKM & QAK)
*/
assert(0 == n % 2);
if (mesg) *mesg = "VAX";
diff --git a/src/H5err.txt b/src/H5err.txt
index b4cb28b..ab3277f 100644
--- a/src/H5err.txt
+++ b/src/H5err.txt
@@ -48,7 +48,7 @@
MAJOR, H5E_ARGS, Invalid arguments to routine
MAJOR, H5E_RESOURCE, Resource unavailable
MAJOR, H5E_INTERNAL, Internal error (too specific to document in detail)
-MAJOR, H5E_FILE, File accessability
+MAJOR, H5E_FILE, File accessibilty
MAJOR, H5E_IO, Low-level I/O
MAJOR, H5E_FUNC, Function entry/exit
MAJOR, H5E_ATOM, Object atom
@@ -81,7 +81,7 @@ MAJOR, H5E_NONE_MAJOR, No error
# Sections (for grouping minor errors)
SECTION, ARGS, Argument errors
SECTION, RESOURCE, Resource errors
-SECTION, FILEACC, File accessability errors
+SECTION, FILEACC, File accessibilty errors
SECTION, FILE, Generic low-level file I/O errors
SECTION, FUNC, Function entry/exit interface errors
SECTION, ATOM, Object atom related errors
@@ -121,7 +121,7 @@ MINOR, RESOURCE, H5E_CANTGC, Unable to garbage collect
MINOR, RESOURCE, H5E_CANTGETSIZE, Unable to compute size
MINOR, RESOURCE, H5E_OBJOPEN, Object is already open
-# File accessability errors
+# File accessibilty errors
MINOR, FILEACC, H5E_FILEEXISTS, File already exists
MINOR, FILEACC, H5E_FILEOPEN, File already open
MINOR, FILEACC, H5E_CANTCREATE, Unable to create file
diff --git a/src/H5public.h b/src/H5public.h
index fcba406..54cd0b6 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -75,10 +75,10 @@ extern "C" {
/* Version numbers */
#define H5_VERS_MAJOR 1 /* For major interface/format changes */
#define H5_VERS_MINOR 9 /* For minor interface/format changes */
-#define H5_VERS_RELEASE 131 /* For tweaks, bug-fixes, or development */
+#define H5_VERS_RELEASE 137 /* For tweaks, bug-fixes, or development */
#define H5_VERS_SUBRELEASE "FA_a5" /* For pre-releases like snap0 */
/* Empty string for real releases. */
-#define H5_VERS_INFO "HDF5 library version: 1.9.131-FA_a5" /* Full version string */
+#define H5_VERS_INFO "HDF5 library version: 1.9.137-FA_a5" /* Full version string */
#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \
H5_VERS_RELEASE)
diff --git a/src/H5trace.c b/src/H5trace.c
index 2dab8ec..92736d4 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -612,10 +612,6 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
fprintf(out, "H5D_MPIO_MULTI_CHUNK");
break;
- case H5D_MPIO_MULTI_CHUNK_NO_OPT:
- fprintf(out, "H5D_MPIO_MULTI_CHUNK_NO_OPT");
- break;
-
default:
fprintf(out, "%ld", (long)chunk_opt_mode);
break;
diff --git a/src/Makefile.am b/src/Makefile.am
index c426581..4ec1015 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -90,7 +90,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5Ostorage.c \
H5Otest.c H5Ounknown.c \
H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c \
- H5Pdeprec.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \
+ H5Pdeprec.c H5Pdxpl.c H5Pencdec.c \
+ H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \
H5Pgcpl.c H5Pint.c \
H5Plapl.c H5Plcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c H5Ptest.c \
H5R.c H5Rdeprec.c \
diff --git a/src/Makefile.in b/src/Makefile.in
index 0b4f0b2..1393026 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -161,10 +161,10 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \
H5Orefcount.lo H5Osdspace.lo H5Oshared.lo H5Oshmesg.lo \
H5Ostab.lo H5Ostorage.lo H5Otest.lo H5Ounknown.lo H5P.lo \
H5Pacpl.lo H5Pdapl.lo H5Pdcpl.lo H5Pdeprec.lo H5Pdxpl.lo \
- H5Pfapl.lo H5Pfcpl.lo H5Pfmpl.lo H5Pgcpl.lo H5Pint.lo \
- H5Plapl.lo H5Plcpl.lo H5Pocpl.lo H5Pocpypl.lo H5Pstrcpl.lo \
- H5Ptest.lo H5R.lo H5Rdeprec.lo H5RC.lo H5RS.lo H5S.lo \
- H5Sall.lo H5Sdbg.lo H5Shyper.lo H5Smpio.lo H5Snone.lo \
+ H5Pencdec.lo H5Pfapl.lo H5Pfcpl.lo H5Pfmpl.lo H5Pgcpl.lo \
+ H5Pint.lo H5Plapl.lo H5Plcpl.lo H5Pocpl.lo H5Pocpypl.lo \
+ H5Pstrcpl.lo H5Ptest.lo H5R.lo H5Rdeprec.lo H5RC.lo H5RS.lo \
+ H5S.lo H5Sall.lo H5Sdbg.lo H5Shyper.lo H5Smpio.lo H5Snone.lo \
H5Spoint.lo H5Sselect.lo H5Stest.lo H5SL.lo H5SM.lo \
H5SMbtree2.lo H5SMcache.lo H5SMmessage.lo H5SMtest.lo H5ST.lo \
H5T.lo H5Tarray.lo H5Tbit.lo H5Tcommit.lo H5Tcompound.lo \
@@ -525,7 +525,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 121
+LT_VERS_REVISION = 127
LT_VERS_AGE = 0
H5detect_CFLAGS = -g $(AM_CFLAGS)
@@ -590,7 +590,8 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5Ostorage.c \
H5Otest.c H5Ounknown.c \
H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c \
- H5Pdeprec.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \
+ H5Pdeprec.c H5Pdxpl.c H5Pencdec.c \
+ H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \
H5Pgcpl.c H5Pint.c \
H5Plapl.c H5Plcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c H5Ptest.c \
H5R.c H5Rdeprec.c \
@@ -959,6 +960,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pdcpl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pdeprec.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pdxpl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pencdec.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pfapl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pfcpl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pfmpl.Plo@am__quote@