summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2014-04-25 19:54:57 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2014-04-25 19:54:57 (GMT)
commit4257a32de13576155efc6df64aa0282bdf074ff1 (patch)
tree4da2d29685eb8c88e804d6daed0b59830cdbbffa
parentb018ba48ced579975e60362e3acfb6afb1f1d384 (diff)
downloadhdf5-4257a32de13576155efc6df64aa0282bdf074ff1.zip
hdf5-4257a32de13576155efc6df64aa0282bdf074ff1.tar.gz
hdf5-4257a32de13576155efc6df64aa0282bdf074ff1.tar.bz2
[svn-r25109] Description:
Bring r25084, 25088, 25092, 25097 from trunk to 1.8 branch: r25084: Begin process of migrating from using property list IDs internally to the library to using the internal generic property list data structure. r25088: Introduce "file I/O info" struct, to hold file & dxpl pointers, and start propagating up through library. r25092: More migration to using H5F_io_info_t pointers and away from using property list IDs internally. Also, clean up some compiler warnings in the cache code. r25097: Make progress toward moving from DXPL IDs to property list structures within the library. Also move the signature location code from the H5F package to the H5FD package, where it's a better fit. Also, clean up some more compiler warnings along the way. Tested: Mac OSX/64 10.9.2 (amazon) w/C++, FORTRAN & parallel (h5committested on trunk)
-rw-r--r--src/H5A.c4
-rw-r--r--src/H5AC.c70
-rw-r--r--src/H5ACpkg.h2
-rw-r--r--src/H5ACprivate.h2
-rw-r--r--src/H5C.c58
-rw-r--r--src/H5Cprivate.h16
-rw-r--r--src/H5D.c9
-rw-r--r--src/H5Dint.c2
-rw-r--r--src/H5Dpublic.h4
-rw-r--r--src/H5F.c23
-rw-r--r--src/H5FD.c22
-rw-r--r--src/H5FDint.c79
-rw-r--r--src/H5FDprivate.h6
-rw-r--r--src/H5Faccum.c519
-rw-r--r--src/H5Fio.c17
-rw-r--r--src/H5Fpkg.h15
-rw-r--r--src/H5Fprivate.h51
-rw-r--r--src/H5Fsuper.c71
-rw-r--r--src/H5Fsuper_cache.c28
-rw-r--r--src/H5G.c2
-rw-r--r--src/H5MF.c13
-rw-r--r--src/H5Pacpl.c9
-rw-r--r--src/H5Pdapl.c11
-rw-r--r--src/H5Pdcpl.c11
-rw-r--r--src/H5Pdeprec.c1
-rw-r--r--src/H5Pdxpl.c9
-rw-r--r--src/H5Pfapl.c17
-rw-r--r--src/H5Pfcpl.c9
-rw-r--r--src/H5Pfmpl.c10
-rw-r--r--src/H5Pgcpl.c11
-rw-r--r--src/H5Pint.c292
-rw-r--r--src/H5Plapl.c9
-rw-r--r--src/H5Plcpl.c9
-rw-r--r--src/H5Pocpl.c7
-rw-r--r--src/H5Pocpypl.c10
-rw-r--r--src/H5Ppkg.h13
-rw-r--r--src/H5Pprivate.h42
-rw-r--r--src/H5Ppublic.h124
-rw-r--r--src/H5Pstrcpl.c8
-rw-r--r--src/H5T.c15
-rw-r--r--src/H5Tcommit.c2
-rw-r--r--src/H5Zprivate.h2
-rw-r--r--test/accum.c199
43 files changed, 1029 insertions, 804 deletions
diff --git a/src/H5A.c b/src/H5A.c
index 1b4fe08..ce7791c 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -1342,12 +1342,12 @@ H5Aget_create_plist(hid_t attr_id)
FUNC_ENTER_API(FAIL)
H5TRACE1("i", "i", attr_id);
- HDassert(H5P_LST_ATTRIBUTE_CREATE_g != -1);
+ HDassert(H5P_LST_ATTRIBUTE_CREATE_ID_g != -1);
/* Get attribute and default attribute creation property list*/
if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(H5P_LST_ATTRIBUTE_CREATE_g)))
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(H5P_LST_ATTRIBUTE_CREATE_ID_g)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get default ACPL")
/* Create the property list object to return */
diff --git a/src/H5AC.c b/src/H5AC.c
index e0891dd..91a49c5 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -114,6 +114,7 @@ static hid_t H5AC_noblock_dxpl_id=(-1);
/* Dataset transfer property list for independent metadata I/O calls */
/* (just "library internal" set - i.e. independent transfer mode) */
/* (Global variable definition, declaration is in H5ACprivate.h also) */
+H5P_genplist_t *H5AC_ind_dxpl_g = NULL;
hid_t H5AC_ind_dxpl_id=(-1);
@@ -165,8 +166,7 @@ static herr_t H5AC_log_moved_entry(const H5F_t * f,
haddr_t old_addr,
haddr_t new_addr);
-static herr_t H5AC_log_inserted_entry(H5F_t * f,
- H5AC_t * cache_ptr,
+static herr_t H5AC_log_inserted_entry(H5AC_t * cache_ptr,
H5AC_info_t * entry_ptr);
static herr_t H5AC_propagate_and_apply_candidate_list(H5F_t * f,
@@ -256,30 +256,25 @@ static herr_t
H5AC_init_interface(void)
{
#ifdef H5_HAVE_PARALLEL
- H5P_genclass_t *xfer_pclass; /* Dataset transfer property list class object */
H5P_genplist_t *xfer_plist; /* Dataset transfer property list object */
unsigned block_before_meta_write; /* "block before meta write" property value */
unsigned coll_meta_write; /* "collective metadata write" property value */
- unsigned library_internal=1; /* "library internal" property value */
- H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode property value */
- herr_t ret_value=SUCCEED; /* Return value */
+ unsigned library_internal = 1; /* "library internal" property value */
+#endif /* H5_HAVE_PARALLEL */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
+#ifdef H5_HAVE_PARALLEL
/* Sanity check */
- HDassert(H5P_CLS_DATASET_XFER_g!=(-1));
-
- /* Get the dataset transfer property list class object */
- if (NULL == (xfer_pclass = H5I_object(H5P_CLS_DATASET_XFER_g)))
- HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get property list class")
-
+ HDassert(H5P_CLS_DATASET_XFER_g != NULL);
/* Get an ID for the blocking, collective H5AC dxpl */
- if ((H5AC_dxpl_id=H5P_create_id(xfer_pclass,FALSE)) < 0)
+ if((H5AC_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list")
/* Get the property list object */
- if (NULL == (xfer_plist = H5I_object(H5AC_dxpl_id)))
+ if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_dxpl_id)))
HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object")
/* Insert 'block before metadata write' property */
@@ -299,11 +294,11 @@ H5AC_init_interface(void)
/* Get an ID for the non-blocking, collective H5AC dxpl */
- if ((H5AC_noblock_dxpl_id=H5P_create_id(xfer_pclass,FALSE)) < 0)
+ if((H5AC_noblock_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list")
/* Get the property list object */
- if (NULL == (xfer_plist = H5I_object(H5AC_noblock_dxpl_id)))
+ if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_noblock_dxpl_id)))
HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object")
/* Insert 'block before metadata write' property */
@@ -323,43 +318,45 @@ H5AC_init_interface(void)
/* Get an ID for the non-blocking, independent H5AC dxpl */
- if ((H5AC_ind_dxpl_id=H5P_create_id(xfer_pclass,FALSE)) < 0)
+ if((H5AC_ind_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list")
/* Get the property list object */
- if (NULL == (xfer_plist = H5I_object(H5AC_ind_dxpl_id)))
+ if(NULL == (H5AC_ind_dxpl_g = (H5P_genplist_t *)H5I_object(H5AC_ind_dxpl_id)))
HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object")
/* 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(H5AC_ind_dxpl_g, H5AC_BLOCK_BEFORE_META_WRITE_NAME, H5AC_BLOCK_BEFORE_META_WRITE_SIZE, &block_before_meta_write,
+ 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(H5AC_ind_dxpl_g, H5AC_LIBRARY_INTERNAL_NAME, H5AC_LIBRARY_INTERNAL_SIZE, &library_internal,
+ NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property")
/* Insert 'collective metadata write' property */
coll_meta_write = 0;
- if(H5P_insert(xfer_plist, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write,
- NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_insert(H5AC_ind_dxpl_g, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write,
+ NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property")
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-
#else /* H5_HAVE_PARALLEL */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
/* Sanity check */
- HDassert(H5P_LST_DATASET_XFER_g!=(-1));
+ HDassert(H5P_LST_DATASET_XFER_ID_g!=(-1));
H5AC_dxpl_id = H5P_DATASET_XFER_DEFAULT;
H5AC_noblock_dxpl_id = H5P_DATASET_XFER_DEFAULT;
H5AC_ind_dxpl_id = H5P_DATASET_XFER_DEFAULT;
- FUNC_LEAVE_NOAPI(SUCCEED)
+ /* Get the property list objects for the IDs */
+ if (NULL == (H5AC_ind_dxpl_g = (H5P_genplist_t *)H5I_object(H5AC_ind_dxpl_id)))
+ HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get property list object")
#endif /* H5_HAVE_PARALLEL */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5AC_init_interface() */
@@ -992,7 +989,7 @@ H5AC_insert_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t add
if(NULL != (aux_ptr = (H5AC_aux_t *)f->shared->cache->aux_ptr)) {
/* Log the new entry */
- if(H5AC_log_inserted_entry(f, f->shared->cache, (H5AC_info_t *)thing) < 0)
+ if(H5AC_log_inserted_entry(f->shared->cache, (H5AC_info_t *)thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5AC_log_inserted_entry() failed")
/* Check if we should try to flush */
@@ -1511,7 +1508,6 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
hbool_t dirtied;
hbool_t deleted;
#ifdef H5_HAVE_PARALLEL
- hbool_t size_changed = FALSE;
H5AC_aux_t * aux_ptr = NULL;
#endif /* H5_HAVE_PARALLEL */
#if H5AC__TRACE_FILE_ENABLED
@@ -1626,7 +1622,7 @@ H5AC_set_sync_point_done_callback(H5C_t * cache_ptr,
{
H5AC_aux_t * aux_ptr;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(cache_ptr && (cache_ptr->magic == H5C__H5C_T_MAGIC));
@@ -1663,7 +1659,7 @@ H5AC_set_write_done_callback(H5C_t * cache_ptr,
{
H5AC_aux_t * aux_ptr;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(cache_ptr && (cache_ptr->magic == H5C__H5C_T_MAGIC));
@@ -2511,7 +2507,6 @@ H5AC_broadcast_candidate_list(H5AC_t * cache_ptr,
int * num_entries_ptr,
haddr_t ** haddr_buf_ptr_ptr)
{
- herr_t result;
hbool_t success = FALSE;
H5AC_aux_t * aux_ptr = NULL;
haddr_t * haddr_buf_ptr = NULL;
@@ -2681,7 +2676,7 @@ H5AC_broadcast_clean_list(H5AC_t * cache_ptr)
*/
if ( aux_ptr->sync_point_done != NULL ) {
- addr_buf_ptr = H5MM_malloc((size_t)(num_entries * sizeof(haddr_t)));
+ addr_buf_ptr = H5MM_malloc((size_t)num_entries * sizeof(haddr_t));
if ( addr_buf_ptr == NULL ) {
@@ -2779,7 +2774,7 @@ done:
if(buf_ptr != NULL)
buf_ptr = (MPI_Offset *)H5MM_xfree((void *)buf_ptr);
if(addr_buf_ptr != NULL)
- addr_buf_ptr = (MPI_Offset *)H5MM_xfree((void *)addr_buf_ptr);
+ addr_buf_ptr = (haddr_t *)H5MM_xfree((void *)addr_buf_ptr);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_broadcast_clean_list() */
@@ -3513,8 +3508,7 @@ done:
*/
#ifdef H5_HAVE_PARALLEL
static herr_t
-H5AC_log_inserted_entry(H5F_t * f,
- H5AC_t * cache_ptr,
+H5AC_log_inserted_entry(H5AC_t * cache_ptr,
H5AC_info_t * entry_ptr)
{
H5AC_aux_t * aux_ptr;
diff --git a/src/H5ACpkg.h b/src/H5ACpkg.h
index 3060a70..ad768ef 100644
--- a/src/H5ACpkg.h
+++ b/src/H5ACpkg.h
@@ -70,8 +70,6 @@
#define H5AC__MAX_DIRTY_BYTES_THRESHOLD (int32_t) \
(H5C__MAX_MAX_CACHE_SIZE / 4)
-#define H5AC__DEFAULT_METADATA_WRITE_STRATEGY \
- H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED
/****************************************************************************
*
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index 2e7bcd7..aeae56d 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -34,6 +34,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Cprivate.h" /* Cache */
#include "H5Fprivate.h" /* File access */
+#include "H5Pprivate.h" /* Property lists */
#ifdef H5_METADATA_TRACE_FILE
#define H5AC__TRACE_FILE_ENABLED 1
@@ -193,6 +194,7 @@ extern hid_t H5AC_dxpl_id;
/* Dataset transfer property list for independent metadata I/O calls */
/* (just "library internal" set - i.e. independent transfer mode) */
/* (Global variable declaration, definition is in H5AC.c) */
+extern H5P_genplist_t *H5AC_ind_dxpl_g;
extern hid_t H5AC_ind_dxpl_id;
diff --git a/src/H5C.c b/src/H5C.c
index 85c00f1..fa28584 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -1090,8 +1090,8 @@ H5C_create(size_t max_cache_size,
(cache_ptr->resize_ctl).max_increment = H5C__DEF_AR_MAX_INCREMENT;
(cache_ptr->resize_ctl).flash_incr_mode = H5C_flash_incr__off;
- (cache_ptr->resize_ctl).flash_multiple = 1.0;
- (cache_ptr->resize_ctl).flash_threshold = 0.25;
+ (cache_ptr->resize_ctl).flash_multiple = 1.0f;
+ (cache_ptr->resize_ctl).flash_threshold = 0.25f;
(cache_ptr->resize_ctl).decr_mode = H5C_decr__off;
(cache_ptr->resize_ctl).upper_hr_threshold = H5C__DEF_AR_UPPER_THRESHHOLD;
@@ -2236,7 +2236,7 @@ H5C_get_cache_hit_rate(H5C_t * cache_ptr,
} else {
- *hit_rate_ptr = 0.0;
+ *hit_rate_ptr = 0.0f;
}
done:
@@ -3994,8 +3994,8 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr,
break;
case H5C_incr__threshold:
- if ( ( config_ptr->lower_hr_threshold <= 0.0 ) ||
- ( config_ptr->increment <= 1.0 ) ||
+ if ( ( config_ptr->lower_hr_threshold <= (double)0.0f ) ||
+ ( config_ptr->increment <= (double)1.0f ) ||
( ( config_ptr->apply_max_increment ) &&
( config_ptr->max_increment <= 0 ) ) ) {
@@ -4019,8 +4019,8 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr,
break;
case H5C_decr__threshold:
- if ( ( config_ptr->upper_hr_threshold >= 1.0 ) ||
- ( config_ptr->decrement >= 1.0 ) ||
+ if ( ( config_ptr->upper_hr_threshold >= (double)1.0f ) ||
+ ( config_ptr->decrement >= (double)1.0f ) ||
( ( config_ptr->apply_max_decrement ) &&
( config_ptr->max_decrement <= 0 ) ) ) {
@@ -4030,7 +4030,7 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr,
case H5C_decr__age_out:
if ( ( ( config_ptr->apply_empty_reserve ) &&
- ( config_ptr->empty_reserve >= 1.0 ) ) ||
+ ( config_ptr->empty_reserve >= (double)1.0f ) ) ||
( ( config_ptr->apply_max_decrement ) &&
( config_ptr->max_decrement <= 0 ) ) ) {
@@ -4040,10 +4040,10 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr,
case H5C_decr__age_out_with_threshold:
if ( ( ( config_ptr->apply_empty_reserve ) &&
- ( config_ptr->empty_reserve >= 1.0 ) ) ||
+ ( config_ptr->empty_reserve >= (double)1.0f ) ) ||
( ( config_ptr->apply_max_decrement ) &&
( config_ptr->max_decrement <= 0 ) ) ||
- ( config_ptr->upper_hr_threshold >= 1.0 ) ) {
+ ( config_ptr->upper_hr_threshold >= (double)1.0f ) ) {
cache_ptr->size_decrease_possible = FALSE;
}
@@ -5517,8 +5517,8 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr,
"initial_size must be in the interval [min_size, max_size]");
}
- if ( ( config_ptr->min_clean_fraction < 0.0 ) ||
- ( config_ptr->min_clean_fraction > 1.0 ) ) {
+ if ( ( config_ptr->min_clean_fraction < (double)0.0f ) ||
+ ( config_ptr->min_clean_fraction > (double)1.0f ) ) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
"min_clean_fraction must be in the interval [0.0, 1.0]");
@@ -5546,14 +5546,14 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr,
if ( config_ptr->incr_mode == H5C_incr__threshold ) {
- if ( ( config_ptr->lower_hr_threshold < 0.0 ) ||
- ( config_ptr->lower_hr_threshold > 1.0 ) ) {
+ if ( ( config_ptr->lower_hr_threshold < (double)0.0f ) ||
+ ( config_ptr->lower_hr_threshold > (double)1.0f ) ) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
"lower_hr_threshold must be in the range [0.0, 1.0]");
}
- if ( config_ptr->increment < 1.0 ) {
+ if ( config_ptr->increment < (double)1.0f ) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
"increment must be greater than or equal to 1.0");
@@ -5578,15 +5578,15 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr,
break;
case H5C_flash_incr__add_space:
- if ( ( config_ptr->flash_multiple < 0.1 ) ||
- ( config_ptr->flash_multiple > 10.0 ) ) {
+ if ( ( config_ptr->flash_multiple < (double)0.1f ) ||
+ ( config_ptr->flash_multiple > (double)10.0f ) ) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
"flash_multiple must be in the range [0.1, 10.0]");
}
- if ( ( config_ptr->flash_threshold < 0.1 ) ||
- ( config_ptr->flash_threshold > 1.0 ) ) {
+ if ( ( config_ptr->flash_threshold < (double)0.1f ) ||
+ ( config_ptr->flash_threshold > (double)1.0f ) ) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
"flash_threshold must be in the range [0.1, 1.0]");
@@ -5614,14 +5614,14 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr,
if ( config_ptr->decr_mode == H5C_decr__threshold ) {
- if ( config_ptr->upper_hr_threshold > 1.0 ) {
+ if ( config_ptr->upper_hr_threshold > (double)1.0f ) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
"upper_hr_threshold must be <= 1.0");
}
- if ( ( config_ptr->decrement > 1.0 ) ||
- ( config_ptr->decrement < 0.0 ) ) {
+ if ( ( config_ptr->decrement > (double)1.0f ) ||
+ ( config_ptr->decrement < (double)0.0f ) ) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
"decrement must be in the interval [0.0, 1.0]");
@@ -5656,8 +5656,8 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr,
}
if ( ( config_ptr->apply_empty_reserve ) &&
- ( ( config_ptr->empty_reserve > 1.0 ) ||
- ( config_ptr->empty_reserve < 0.0 ) ) ) {
+ ( ( config_ptr->empty_reserve > (double)1.0f ) ||
+ ( config_ptr->empty_reserve < (double)0.0f ) ) ) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
"empty_reserve must be in the interval [0.0, 1.0]");
@@ -5670,8 +5670,8 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr,
if ( config_ptr->decr_mode == H5C_decr__age_out_with_threshold ) {
- if ( ( config_ptr->upper_hr_threshold > 1.0 ) ||
- ( config_ptr->upper_hr_threshold < 0.0 ) ) {
+ if ( ( config_ptr->upper_hr_threshold > (double)1.0f ) ||
+ ( config_ptr->upper_hr_threshold < (double)0.0f ) ) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
"upper_hr_threshold must be in the interval [0.0, 1.0]");
@@ -5757,8 +5757,8 @@ H5C__auto_adjust_cache_size(H5F_t * f,
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
HDassert( cache_ptr->cache_accesses >=
(cache_ptr->resize_ctl).epoch_length );
- HDassert( 0.0 <= (cache_ptr->resize_ctl).min_clean_fraction );
- HDassert( (cache_ptr->resize_ctl).min_clean_fraction <= 100.0 );
+ HDassert( (double)0.0f <= (cache_ptr->resize_ctl).min_clean_fraction );
+ HDassert( (cache_ptr->resize_ctl).min_clean_fraction <= (double)100.0f );
if ( !cache_ptr->resize_enabled ) {
@@ -5773,7 +5773,7 @@ H5C__auto_adjust_cache_size(H5F_t * f,
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate.")
}
- HDassert( ( 0.0 <= hit_rate ) && ( hit_rate <= 1.0 ) );
+ HDassert( ( (double)0.0f <= hit_rate ) && ( hit_rate <= (double)1.0f ) );
switch ( (cache_ptr->resize_ctl).incr_mode )
{
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 389cf5d..44e3d4d 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -831,20 +831,20 @@ typedef struct H5C_cache_entry_t
#define H5C__MAX_EPOCH_MARKERS 10
-#define H5C__DEF_AR_UPPER_THRESHHOLD 0.9999
-#define H5C__DEF_AR_LOWER_THRESHHOLD 0.9
+#define H5C__DEF_AR_UPPER_THRESHHOLD 0.9999f
+#define H5C__DEF_AR_LOWER_THRESHHOLD 0.9f
#define H5C__DEF_AR_MAX_SIZE ((size_t)(16 * 1024 * 1024))
#define H5C__DEF_AR_INIT_SIZE ((size_t)( 1 * 1024 * 1024))
#define H5C__DEF_AR_MIN_SIZE ((size_t)( 1 * 1024 * 1024))
-#define H5C__DEF_AR_MIN_CLEAN_FRAC 0.5
-#define H5C__DEF_AR_INCREMENT 2.0
+#define H5C__DEF_AR_MIN_CLEAN_FRAC 0.5f
+#define H5C__DEF_AR_INCREMENT 2.0f
#define H5C__DEF_AR_MAX_INCREMENT ((size_t)( 2 * 1024 * 1024))
-#define H5C__DEF_AR_FLASH_MULTIPLE 1.0
-#define H5C__DEV_AR_FLASH_THRESHOLD 0.25
-#define H5C__DEF_AR_DECREMENT 0.9
+#define H5C__DEF_AR_FLASH_MULTIPLE 1.0f
+#define H5C__DEV_AR_FLASH_THRESHOLD 0.25f
+#define H5C__DEF_AR_DECREMENT 0.9f
#define H5C__DEF_AR_MAX_DECREMENT ((size_t)( 1 * 1024 * 1024))
#define H5C__DEF_AR_EPCHS_B4_EVICT 3
-#define H5C__DEF_AR_EMPTY_RESERVE 0.05
+#define H5C__DEF_AR_EMPTY_RESERVE 0.05f
#define H5C__MIN_AR_EPOCH_LENGTH 100
#define H5C__DEF_AR_EPOCH_LENGTH 50000
#define H5C__MAX_AR_EPOCH_LENGTH 1000000
diff --git a/src/H5D.c b/src/H5D.c
index 0dbda64..7173bbc 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -781,7 +781,7 @@ H5Dget_access_plist(hid_t dset_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
/* Make a copy of the default dataset access property list */
- if (NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATASET_ACCESS_g)))
+ if (NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATASET_ACCESS_ID_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
if ((new_dapl_id = H5P_copy_plist(old_plist, TRUE)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy dataset access property list")
@@ -1055,7 +1055,6 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
H5S_t *mspace = NULL; /* Memory dataspace */
char bogus; /* bogus value to pass to H5Diterate() */
H5S_t *space; /* Dataspace for iteration */
- H5P_genclass_t *pclass; /* Property class */
H5P_genplist_t *plist; /* Property list */
herr_t ret_value; /* Return value */
@@ -1092,12 +1091,8 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
if(NULL == (vlen_bufsize.vl_tbuf = H5FL_BLK_MALLOC(vlen_vl_buf, (size_t)1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available")
- /* Get the pointer to the dataset transfer class */
- if(NULL == (pclass = (H5P_genclass_t *)H5I_object(H5P_CLS_DATASET_XFER_g)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
-
/* Change to the custom memory allocation routines for reading VL data */
- if((vlen_bufsize.xfer_pid = H5P_create_id(pclass, FALSE)) < 0)
+ if((vlen_bufsize.xfer_pid = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "no dataset xfer plists available")
/* Get the property list struct */
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 97c3a1a..70f0d29 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -176,7 +176,7 @@ H5D__init_interface(void)
/* Get the default dataset creation property list values and initialize the
* default dataset with them.
*/
- if(NULL == (def_dcpl = (H5P_genplist_t *)H5I_object(H5P_LST_DATASET_CREATE_g)))
+ if(NULL == (def_dcpl = (H5P_genplist_t *)H5I_object(H5P_LST_DATASET_CREATE_ID_g)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get default dataset creation property list")
/* Get the default data storage layout */
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index 4309d64..e7ae3ae 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -30,9 +30,9 @@
/*****************/
/* Macros used to "unset" chunk cache configuration parameters */
-#define H5D_CHUNK_CACHE_NSLOTS_DEFAULT ((size_t) -1)
+#define H5D_CHUNK_CACHE_NSLOTS_DEFAULT ((size_t) -1)
#define H5D_CHUNK_CACHE_NBYTES_DEFAULT ((size_t) -1)
-#define H5D_CHUNK_CACHE_W0_DEFAULT -1.
+#define H5D_CHUNK_CACHE_W0_DEFAULT (-1.0f)
/* Property names for H5LTDdirect_chunk_write */
#define H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME "direct_chunk_flag"
diff --git a/src/H5F.c b/src/H5F.c
index 2413c73..e45882d 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -349,7 +349,7 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
HDassert(f);
/* Make a copy of the default file access property list */
- if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_g)))
+ if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
if((ret_value = H5P_copy_plist(old_plist, app_ref)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy file access property list")
@@ -861,7 +861,7 @@ H5Fis_hdf5(const char *name)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file")
/* The file is an hdf5 file if the hdf5 file signature can be found */
- if(H5F_locate_signature(file, H5AC_ind_dxpl_id, &sig_addr) < 0)
+ if(H5FD_locate_signature(file, H5AC_ind_dxpl_g, &sig_addr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature")
ret_value = (HADDR_UNDEF != sig_addr);
@@ -1076,6 +1076,8 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush)
HDassert(f->shared);
if(1 == f->shared->nrefs) {
+ H5F_io_info_t fio_info; /* I/O info for operation */
+
/* Flush at this point since the file will be closed.
* Only try to flush the file if it was opened with write access, and if
* the caller requested a flush.
@@ -1133,8 +1135,13 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush)
f->shared->root_grp = NULL;
} /* end if */
+ /* Set up I/O info for operation */
+ fio_info.f = f;
+ if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HDONE_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
+
/* Destroy other components of the file */
- if(H5F_accum_reset(f, dxpl_id, TRUE) < 0)
+ if(H5F__accum_reset(&fio_info, TRUE) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
if(H5FO_dest(f) < 0)
@@ -1744,6 +1751,7 @@ done:
herr_t
H5F_flush(H5F_t *f, hid_t dxpl_id, hbool_t closing)
{
+ H5F_io_info_t fio_info; /* I/O info for operation */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1771,8 +1779,13 @@ H5F_flush(H5F_t *f, hid_t dxpl_id, hbool_t closing)
/* Push error, but keep going*/
HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache")
+ /* Set up I/O info for operation */
+ fio_info.f = f;
+ if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HDONE_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
+
/* Flush out the metadata accumulator */
- if(H5F_accum_flush(f, dxpl_id) < 0)
+ if(H5F__accum_flush(&fio_info) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush metadata accumulator")
@@ -2760,7 +2773,7 @@ H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len)
/* read in the file image */
/* (Note compensation for base address addition in internal routine) */
- if(H5FD_read(fd_ptr, H5AC_ind_dxpl_id, H5FD_MEM_DEFAULT, 0, space_needed, buf_ptr) < 0)
+ if(H5FD_read(fd_ptr, H5AC_ind_dxpl_g, H5FD_MEM_DEFAULT, 0, space_needed, buf_ptr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "file image read request failed")
} /* end if */
diff --git a/src/H5FD.c b/src/H5FD.c
index a261818..5919403 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -1669,15 +1669,14 @@ done:
* Programmer: Robb Matzke
* Thursday, July 29, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size,
void *buf/*out*/)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t *dxpl; /* DXPL object */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "*xMtiazx", file, type, dxpl_id, addr, size, buf);
@@ -1695,9 +1694,13 @@ H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size
if(!buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null result buffer")
+ /* Get the DXPL plist object for DXPL ID */
+ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
+
/* Do the real work */
/* (Note compensating for base address addition in internal routine) */
- if(H5FD_read(file, dxpl_id, type, addr - file->base_addr, size, buf) < 0)
+ if(H5FD_read(file, dxpl, type, addr - file->base_addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file read request failed")
done:
@@ -1720,15 +1723,14 @@ done:
* Programmer: Robb Matzke
* Thursday, July 29, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size,
const void *buf)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t *dxpl; /* DXPL object */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "*xMtiaz*x", file, type, dxpl_id, addr, size, buf);
@@ -1745,9 +1747,13 @@ H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
if(!buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null buffer")
+ /* Get the DXPL plist object for DXPL ID */
+ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
+
/* The real work */
/* (Note compensating for base address addition in internal routine) */
- if(H5FD_write(file, dxpl_id, type, addr - file->base_addr, size, buf) < 0)
+ if(H5FD_write(file, dxpl, type, addr - file->base_addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file write request failed")
done:
diff --git a/src/H5FDint.c b/src/H5FDint.c
index c9e9a67..9f02a25 100644
--- a/src/H5FDint.c
+++ b/src/H5FDint.c
@@ -42,7 +42,6 @@
#include "H5Fprivate.h" /* File access */
#include "H5FDpkg.h" /* File Drivers */
#include "H5Iprivate.h" /* IDs */
-#include "H5Pprivate.h" /* Property lists */
/****************/
@@ -104,6 +103,70 @@ H5FD_int_init_interface(void)
/*-------------------------------------------------------------------------
+ * Function: H5FD_locate_signature
+ *
+ * Purpose: Finds the HDF5 superblock signature in a file. The
+ * signature can appear at address 0, or any power of two
+ * beginning with 512.
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Programmer: Robb Matzke
+ * Friday, November 7, 1997
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FD_locate_signature(H5FD_t *file, const H5P_genplist_t *dxpl, haddr_t *sig_addr)
+{
+ haddr_t addr, eoa;
+ uint8_t buf[H5F_SIGNATURE_LEN];
+ unsigned n, maxpow;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Find the least N such that 2^N is larger than the file size */
+ if(HADDR_UNDEF == (addr = H5FD_get_eof(file)) || HADDR_UNDEF == (eoa = H5FD_get_eoa(file, H5FD_MEM_SUPER)))
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to obtain EOF/EOA value")
+ for(maxpow = 0; addr; maxpow++)
+ addr >>= 1;
+ maxpow = MAX(maxpow, 9);
+
+ /*
+ * Search for the file signature at format address zero followed by
+ * powers of two larger than 9.
+ */
+ for(n = 8; n < maxpow; n++) {
+ addr = (8 == n) ? 0 : (haddr_t)1 << n;
+ if(H5FD_set_eoa(file, H5FD_MEM_SUPER, addr + H5F_SIGNATURE_LEN) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to set EOA value for file signature")
+ if(H5FD_read(file, dxpl, H5FD_MEM_SUPER, addr, (size_t)H5F_SIGNATURE_LEN, buf) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to read file signature")
+ if(!HDmemcmp(buf, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN))
+ break;
+ } /* end for */
+
+ /*
+ * If the signature was not found then reset the EOA value and return
+ * HADDR_UNDEF.
+ */
+ if(n >= maxpow) {
+ if(H5FD_set_eoa(file, H5FD_MEM_SUPER, eoa) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to reset EOA value")
+ *sig_addr = HADDR_UNDEF;
+ } /* end if */
+ else
+ /* Set return value */
+ *sig_addr = addr;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_locate_signature() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5FD_read
*
* Purpose: Private version of H5FDread()
@@ -117,7 +180,7 @@ H5FD_int_init_interface(void)
*-------------------------------------------------------------------------
*/
herr_t
-H5FD_read(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
+H5FD_read(H5FD_t *file, const H5P_genplist_t *dxpl, H5FD_mem_t type, haddr_t addr,
size_t size, void *buf/*out*/)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -125,8 +188,7 @@ H5FD_read(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
FUNC_ENTER_NOAPI(FAIL)
HDassert(file && file->cls);
- HDassert(H5I_GENPROP_LST == H5I_get_type(dxpl_id));
- HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER));
+ HDassert(TRUE == H5P_class_isa(H5P_CLASS(dxpl), H5P_CLS_DATASET_XFER_g));
HDassert(buf);
#ifndef H5_HAVE_PARALLEL
@@ -138,7 +200,7 @@ H5FD_read(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
#endif /* H5_HAVE_PARALLEL */
/* Dispatch to driver */
- if((file->cls->read)(file, type, dxpl_id, addr + file->base_addr, size, buf) < 0)
+ if((file->cls->read)(file, type, H5P_PLIST_ID(dxpl), addr + file->base_addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed")
done:
@@ -160,7 +222,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5FD_write(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
+H5FD_write(H5FD_t *file, const H5P_genplist_t *dxpl, H5FD_mem_t type, haddr_t addr,
size_t size, const void *buf)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -168,8 +230,7 @@ H5FD_write(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
FUNC_ENTER_NOAPI(FAIL)
HDassert(file && file->cls);
- HDassert(H5I_GENPROP_LST == H5I_get_type(dxpl_id));
- HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER));
+ HDassert(TRUE == H5P_class_isa(H5P_CLASS(dxpl), H5P_CLS_DATASET_XFER_g));
HDassert(buf);
#ifndef H5_HAVE_PARALLEL
@@ -181,7 +242,7 @@ H5FD_write(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
#endif /* H5_HAVE_PARALLEL */
/* Dispatch to driver */
- if((file->cls->write)(file, type, dxpl_id, addr + file->base_addr, size, buf) < 0)
+ if((file->cls->write)(file, type, H5P_PLIST_ID(dxpl), addr + file->base_addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write request failed")
done:
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index cdd2023..37aad3f 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -24,6 +24,7 @@
#include "H5FDpublic.h"
/* Private headers needed by this file */
+#include "H5Pprivate.h" /* Property lists */
/*
* The MPI drivers are needed because there are
@@ -112,6 +113,7 @@ struct H5P_genplist_t;
struct H5F_t;
H5_DLL int H5FD_term_interface(void);
+H5_DLL herr_t H5FD_locate_signature(H5FD_t *file, const H5P_genplist_t *dxpl, haddr_t *sig_addr);
H5_DLL H5FD_class_t *H5FD_get_class(hid_t id);
H5_DLL hsize_t H5FD_sb_size(H5FD_t *file);
H5_DLL herr_t H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf);
@@ -136,9 +138,9 @@ H5_DLL haddr_t H5FD_get_eof(const H5FD_t *file);
H5_DLL haddr_t H5FD_get_maxaddr(const H5FD_t *file);
H5_DLL herr_t H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags);
H5_DLL herr_t H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map);
-H5_DLL herr_t H5FD_read(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type,
+H5_DLL herr_t H5FD_read(H5FD_t *file, const H5P_genplist_t *dxpl, H5FD_mem_t type,
haddr_t addr, size_t size, void *buf/*out*/);
-H5_DLL herr_t H5FD_write(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type,
+H5_DLL herr_t H5FD_write(H5FD_t *file, const H5P_genplist_t *dxpl, H5FD_mem_t type,
haddr_t addr, size_t size, const void *buf);
H5_DLL herr_t H5FD_flush(H5FD_t *file, hid_t dxpl_id, hbool_t closing);
H5_DLL herr_t H5FD_truncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing);
diff --git a/src/H5Faccum.c b/src/H5Faccum.c
index 6855918..5d884d6 100644
--- a/src/H5Faccum.c
+++ b/src/H5Faccum.c
@@ -40,7 +40,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
#include "H5FDprivate.h" /* File drivers */
-#include "H5VMprivate.h" /* Vectors and arrays */
+#include "H5VMprivate.h" /* Vectors and arrays */
/****************/
@@ -94,7 +94,7 @@ H5FL_BLK_DEFINE_STATIC(meta_accum);
/*-------------------------------------------------------------------------
- * Function: H5F_accum_read
+ * Function: H5F__accum_read
*
* Purpose: Attempts to read some data from the metadata accumulator for
* a file into a buffer.
@@ -112,106 +112,111 @@ H5FL_BLK_DEFINE_STATIC(meta_accum);
*-------------------------------------------------------------------------
*/
herr_t
-H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
+H5F__accum_read(const H5F_io_info_t *fio_info, H5FD_mem_t type, haddr_t addr,
size_t size, void *buf/*out*/)
{
H5FD_mem_t map_type; /* Mapped memory type */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
- HDassert(f);
- HDassert(f->shared);
+ HDassert(fio_info);
+ HDassert(fio_info->f);
+ HDassert(fio_info->dxpl);
HDassert(buf);
/* Treat global heap as raw data */
map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type;
/* Check if this information is in the metadata accumulator */
- if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) {
+ if((fio_info->f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) {
+ H5F_meta_accum_t *accum; /* Alias for file's metadata accumulator */
+
+ /* Set up alias for file's metadata accumulator info */
+ accum = &fio_info->f->shared->accum;
+
if(size < H5F_ACCUM_MAX_SIZE) {
/* Sanity check */
- HDassert(!f->shared->accum.buf || (f->shared->accum.alloc_size >= f->shared->accum.size));
+ HDassert(!accum->buf || (accum->alloc_size >= accum->size));
/* Current read adjoins or overlaps with metadata accumulator */
- if(H5F_addr_overlap(addr, size, f->shared->accum.loc, f->shared->accum.size)
- || ((addr + size) == f->shared->accum.loc)
- || (f->shared->accum.loc + f->shared->accum.size) == addr) {
+ if(H5F_addr_overlap(addr, size, accum->loc, accum->size)
+ || ((addr + size) == accum->loc)
+ || (accum->loc + accum->size) == addr) {
size_t amount_before; /* Amount to read before current accumulator */
haddr_t new_addr; /* New address of the accumulator buffer */
size_t new_size; /* New size of the accumulator buffer */
/* Compute new values for accumulator */
- new_addr = MIN(addr, f->shared->accum.loc);
- new_size = (size_t)(MAX((addr + size), (f->shared->accum.loc + f->shared->accum.size))
- - new_addr);
+ new_addr = MIN(addr, accum->loc);
+ new_size = (size_t)(MAX((addr + size), (accum->loc + accum->size)) - new_addr);
/* Check if we need more buffer space */
- if(new_size > f->shared->accum.alloc_size) {
+ if(new_size > accum->alloc_size) {
size_t new_alloc_size; /* New size of accumulator */
/* Adjust the buffer size to be a power of 2 that is large enough to hold data */
new_alloc_size = (size_t)1 << (1 + H5VM_log2_gen((uint64_t)(new_size - 1)));
/* Reallocate the metadata accumulator buffer */
- if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_alloc_size)))
+ if(NULL == (accum->buf = H5FL_BLK_REALLOC(meta_accum, accum->buf, new_alloc_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
/* Note the new buffer size */
- f->shared->accum.alloc_size = new_alloc_size;
+ accum->alloc_size = new_alloc_size;
#ifdef H5_CLEAR_MEMORY
- HDmemset(f->shared->accum.buf + f->shared->accum.size, 0, (f->shared->accum.alloc_size - f->shared->accum.size));
+ HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - accum->size));
#endif /* H5_CLEAR_MEMORY */
} /* end if */
/* Read the part before the metadata accumulator */
- if(addr < f->shared->accum.loc) {
+ if(addr < accum->loc) {
/* Set the amount to read */
- H5_ASSIGN_OVERFLOW(amount_before, (f->shared->accum.loc - addr), hsize_t, size_t);
+ H5_ASSIGN_OVERFLOW(amount_before, (accum->loc - addr), hsize_t, size_t);
/* Make room for the metadata to read in */
- HDmemmove(f->shared->accum.buf + amount_before, f->shared->accum.buf, f->shared->accum.size);
+ HDmemmove(accum->buf + amount_before, accum->buf, accum->size);
/* Adjust dirty region tracking info, if present */
- if(f->shared->accum.dirty)
- f->shared->accum.dirty_off += amount_before;
+ if(accum->dirty)
+ accum->dirty_off += amount_before;
/* Dispatch to driver */
- if(H5FD_read(f->shared->lf, dxpl_id, map_type, addr, amount_before, f->shared->accum.buf) < 0)
+ if(H5FD_read(fio_info->f->shared->lf, fio_info->dxpl, map_type, addr, amount_before, accum->buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed")
} /* end if */
else
amount_before = 0;
/* Read the part after the metadata accumulator */
- if((addr + size) > (f->shared->accum.loc + f->shared->accum.size)) {
+ if((addr + size) > (accum->loc + accum->size)) {
size_t amount_after; /* Amount to read at a time */
/* Set the amount to read */
- H5_ASSIGN_OVERFLOW(amount_after, ((addr + size) - (f->shared->accum.loc + f->shared->accum.size)), hsize_t, size_t);
+ H5_ASSIGN_OVERFLOW(amount_after, ((addr + size) - (accum->loc + accum->size)), hsize_t, size_t);
/* Dispatch to driver */
- if(H5FD_read(f->shared->lf, dxpl_id, map_type, (f->shared->accum.loc + f->shared->accum.size), amount_after, (f->shared->accum.buf + f->shared->accum.size + amount_before)) < 0)
+ if(H5FD_read(fio_info->f->shared->lf, fio_info->dxpl, map_type, (accum->loc + accum->size), amount_after, (accum->buf + accum->size + amount_before)) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed")
} /* end if */
/* Copy the data out of the buffer */
- HDmemcpy(buf, f->shared->accum.buf + (addr - new_addr), size);
+ HDmemcpy(buf, accum->buf + (addr - new_addr), size);
/* Adjust the accumulator address & size */
- f->shared->accum.loc = new_addr;
- f->shared->accum.size = new_size;
+ accum->loc = new_addr;
+ accum->size = new_size;
} /* end if */
/* Current read doesn't overlap with metadata accumulator, read it from file */
else {
/* Dispatch to driver */
- if(H5FD_read(f->shared->lf, dxpl_id, map_type, addr, size, buf) < 0)
+ if(H5FD_read(fio_info->f->shared->lf, fio_info->dxpl, map_type, addr, size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed")
} /* end else */
} /* end if */
else {
/* Read the data */
- if(H5FD_read(f->shared->lf, dxpl_id, map_type, addr, size, buf) < 0)
+ if(H5FD_read(fio_info->f->shared->lf, fio_info->dxpl, map_type, addr, size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed")
/* Check for overlap w/dirty accumulator */
@@ -219,9 +224,9 @@ H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
* information in the accumulator with [some of] the information
* just read in. -QAK)
*/
- if(f->shared->accum.dirty &&
- H5F_addr_overlap(addr, size, f->shared->accum.loc + f->shared->accum.dirty_off, f->shared->accum.dirty_len)) {
- haddr_t dirty_loc = f->shared->accum.loc + f->shared->accum.dirty_off; /* File offset of dirty information */
+ if(accum->dirty &&
+ H5F_addr_overlap(addr, size, accum->loc + accum->dirty_off, accum->dirty_len)) {
+ haddr_t dirty_loc = accum->loc + accum->dirty_off; /* File offset of dirty information */
size_t buf_off; /* Offset of dirty region in buffer */
size_t dirty_off; /* Offset within dirty region */
size_t overlap_size; /* Size of overlap with dirty region */
@@ -235,36 +240,36 @@ H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
dirty_off = 0;
/* Check for read ending within dirty region */
- if(H5F_addr_lt(addr + size, dirty_loc + f->shared->accum.dirty_len))
+ if(H5F_addr_lt(addr + size, dirty_loc + accum->dirty_len))
overlap_size = (size_t)((addr + size) - buf_off);
else /* Access covers whole dirty region */
- overlap_size = f->shared->accum.dirty_len;
+ overlap_size = accum->dirty_len;
} /* end if */
else { /* Read starts after beginning of dirty region */
/* Compute dirty offset within buffer and overlap size */
buf_off = 0;
dirty_off = (size_t)(addr - dirty_loc);
- overlap_size = (size_t)((dirty_loc + f->shared->accum.dirty_len) - addr);
+ overlap_size = (size_t)((dirty_loc + accum->dirty_len) - addr);
} /* end else */
/* Copy the dirty region to buffer */
- HDmemcpy((unsigned char *)buf + buf_off, (unsigned char *)f->shared->accum.buf + f->shared->accum.dirty_off + dirty_off, overlap_size);
+ HDmemcpy((unsigned char *)buf + buf_off, (unsigned char *)accum->buf + accum->dirty_off + dirty_off, overlap_size);
} /* end if */
} /* end else */
} /* end if */
else {
/* Read the data */
- if(H5FD_read(f->shared->lf, dxpl_id, map_type, addr, size, buf) < 0)
+ if(H5FD_read(fio_info->f->shared->lf, fio_info->dxpl, map_type, addr, size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed")
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_accum_read() */
+} /* end H5F__accum_read() */
/*-------------------------------------------------------------------------
- * Function: H5F_accum_adjust
+ * Function: H5F__accum_adjust
*
* Purpose: Adjust accumulator size, if necessary
*
@@ -277,15 +282,15 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_accum_adjust(H5F_meta_accum_t *accum, H5FD_t *lf, hid_t dxpl_id,
+H5F__accum_adjust(H5F_meta_accum_t *accum, const H5F_io_info_t *fio_info,
H5F_accum_adjust_t adjust, size_t size)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(accum);
- HDassert(lf);
+ HDassert(fio_info);
HDassert(H5F_ACCUM_APPEND == adjust || H5F_ACCUM_PREPEND == adjust);
HDassert(size > 0);
HDassert(size <= H5F_ACCUM_MAX_SIZE);
@@ -343,7 +348,7 @@ H5F_accum_adjust(H5F_meta_accum_t *accum, H5FD_t *lf, hid_t dxpl_id,
/* Check if the dirty region overlaps the region to eliminate from the accumulator */
if((accum->size - shrink_size) < (accum->dirty_off + accum->dirty_len)) {
/* Write out the dirty region from the metadata accumulator, with dispatch to driver */
- if(H5FD_write(lf, dxpl_id, H5FD_MEM_DEFAULT, (accum->loc + accum->dirty_off), accum->dirty_len, (accum->buf + accum->dirty_off)) < 0)
+ if(H5FD_write(fio_info->f->shared->lf, fio_info->dxpl, H5FD_MEM_DEFAULT, (accum->loc + accum->dirty_off), accum->dirty_len, (accum->buf + accum->dirty_off)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "file write failed")
/* Reset accumulator dirty flag */
@@ -354,7 +359,7 @@ H5F_accum_adjust(H5F_meta_accum_t *accum, H5FD_t *lf, hid_t dxpl_id,
/* Check if the dirty region overlaps the region to eliminate from the accumulator */
if(shrink_size > accum->dirty_off) {
/* Write out the dirty region from the metadata accumulator, with dispatch to driver */
- if(H5FD_write(lf, dxpl_id, H5FD_MEM_DEFAULT, (accum->loc + accum->dirty_off), accum->dirty_len, (accum->buf + accum->dirty_off)) < 0)
+ if(H5FD_write(fio_info->f->shared->lf, fio_info->dxpl, H5FD_MEM_DEFAULT, (accum->loc + accum->dirty_off), accum->dirty_len, (accum->buf + accum->dirty_off)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "file write failed")
/* Reset accumulator dirty flag */
@@ -398,11 +403,11 @@ HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - (accum->size + size))
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_accum_adjust() */
+} /* end H5F__accum_adjust() */
/*-------------------------------------------------------------------------
- * Function: H5F_accum_write
+ * Function: H5F__accum_write
*
* Purpose: Attempts to write some data to the metadata accumulator for
* a file from a buffer.
@@ -416,7 +421,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_accum_write(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
+H5F__accum_write(const H5F_io_info_t *fio_info, H5FD_mem_t type, haddr_t addr,
size_t size, const void *buf)
{
H5FD_mem_t map_type; /* Mapped memory type */
@@ -424,355 +429,359 @@ H5F_accum_write(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
FUNC_ENTER_NOAPI(FAIL)
- HDassert(f);
- HDassert(f->shared);
- HDassert(H5F_INTENT(f) & H5F_ACC_RDWR);
+ HDassert(fio_info);
+ HDassert(fio_info->f);
+ HDassert(H5F_INTENT(fio_info->f) & H5F_ACC_RDWR);
+ HDassert(fio_info->dxpl);
HDassert(buf);
/* Treat global heap as raw data */
map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type;
/* Check for accumulating metadata */
- if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) {
+ if((fio_info->f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) {
+ H5F_meta_accum_t *accum; /* Alias for file's metadata accumulator */
+
+ /* Set up alias for file's metadata accumulator info */
+ accum = &fio_info->f->shared->accum;
+
if(size < H5F_ACCUM_MAX_SIZE) {
/* Sanity check */
- HDassert(!f->shared->accum.buf || (f->shared->accum.alloc_size >= f->shared->accum.size));
+ HDassert(!accum->buf || (accum->alloc_size >= accum->size));
/* Check if there is already metadata in the accumulator */
- if(f->shared->accum.size > 0) {
+ if(accum->size > 0) {
/* Check if the new metadata adjoins the beginning of the current accumulator */
- if((addr + size) == f->shared->accum.loc) {
+ if((addr + size) == accum->loc) {
/* Check if we need to adjust accumulator size */
- if(H5F_accum_adjust(&f->shared->accum, f->shared->lf, dxpl_id, H5F_ACCUM_PREPEND, size) < 0)
+ if(H5F__accum_adjust(accum, fio_info, H5F_ACCUM_PREPEND, size) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator")
/* Move the existing metadata to the proper location */
- HDmemmove(f->shared->accum.buf + size, f->shared->accum.buf, f->shared->accum.size);
+ HDmemmove(accum->buf + size, accum->buf, accum->size);
/* Copy the new metadata at the front */
- HDmemcpy(f->shared->accum.buf, buf, size);
+ HDmemcpy(accum->buf, buf, size);
/* Set the new size & location of the metadata accumulator */
- f->shared->accum.loc = addr;
- f->shared->accum.size += size;
+ accum->loc = addr;
+ accum->size += size;
/* Adjust the dirty region and mark accumulator dirty */
- if(f->shared->accum.dirty)
- f->shared->accum.dirty_len = size + f->shared->accum.dirty_off
- + f->shared->accum.dirty_len;
+ if(accum->dirty)
+ accum->dirty_len = size + accum->dirty_off + accum->dirty_len;
else {
- f->shared->accum.dirty_len = size;
- f->shared->accum.dirty = TRUE;
+ accum->dirty_len = size;
+ accum->dirty = TRUE;
} /* end else */
- f->shared->accum.dirty_off = 0;
+ accum->dirty_off = 0;
} /* end if */
/* Check if the new metadata adjoins the end of the current accumulator */
- else if(addr == (f->shared->accum.loc + f->shared->accum.size)) {
+ else if(addr == (accum->loc + accum->size)) {
/* Check if we need to adjust accumulator size */
- if(H5F_accum_adjust(&f->shared->accum, f->shared->lf, dxpl_id, H5F_ACCUM_APPEND, size) < 0)
+ if(H5F__accum_adjust(accum, fio_info, H5F_ACCUM_APPEND, size) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator")
/* Copy the new metadata to the end */
- HDmemcpy(f->shared->accum.buf + f->shared->accum.size, buf, size);
+ HDmemcpy(accum->buf + accum->size, buf, size);
/* Adjust the dirty region and mark accumulator dirty */
- if(f->shared->accum.dirty)
- f->shared->accum.dirty_len = size + (f->shared->accum.size -
- f->shared->accum.dirty_off);
+ if(accum->dirty)
+ accum->dirty_len = size + (accum->size - accum->dirty_off);
else {
- f->shared->accum.dirty_off = f->shared->accum.size;
- f->shared->accum.dirty_len = size;
- f->shared->accum.dirty = TRUE;
+ accum->dirty_off = accum->size;
+ accum->dirty_len = size;
+ accum->dirty = TRUE;
} /* end else */
/* Set the new size of the metadata accumulator */
- f->shared->accum.size += size;
+ accum->size += size;
} /* end if */
/* Check if the piece of metadata being written overlaps the metadata accumulator */
- else if(H5F_addr_overlap(addr, size, f->shared->accum.loc, f->shared->accum.size)) {
+ else if(H5F_addr_overlap(addr, size, accum->loc, accum->size)) {
size_t add_size; /* New size of the accumulator buffer */
/* Check if the new metadata is entirely within the current accumulator */
- if(addr >= f->shared->accum.loc && (addr + size) <= (f->shared->accum.loc + f->shared->accum.size)) {
- size_t dirty_off = (size_t)(addr - f->shared->accum.loc);
+ if(addr >= accum->loc && (addr + size) <= (accum->loc + accum->size)) {
+ size_t dirty_off = (size_t)(addr - accum->loc);
/* Copy the new metadata to the proper location within the accumulator */
- HDmemcpy(f->shared->accum.buf + dirty_off, buf, size);
+ HDmemcpy(accum->buf + dirty_off, buf, size);
/* Adjust the dirty region and mark accumulator dirty */
- if(f->shared->accum.dirty) {
+ if(accum->dirty) {
/* Check for new metadata starting before current dirty region */
- if(dirty_off <= f->shared->accum.dirty_off) {
- if((dirty_off + size) <= (f->shared->accum.dirty_off + f->shared->accum.dirty_len))
- f->shared->accum.dirty_len = (f->shared->accum.dirty_off + f->shared->accum.dirty_len) - dirty_off;
+ if(dirty_off <= accum->dirty_off) {
+ if((dirty_off + size) <= (accum->dirty_off + accum->dirty_len))
+ accum->dirty_len = (accum->dirty_off + accum->dirty_len) - dirty_off;
else
- f->shared->accum.dirty_len = size;
- f->shared->accum.dirty_off = dirty_off;
+ accum->dirty_len = size;
+ accum->dirty_off = dirty_off;
} /* end if */
else {
- if((dirty_off + size) <= (f->shared->accum.dirty_off + f->shared->accum.dirty_len))
- ; /* f->shared->accum.dirty_len doesn't change */
+ if((dirty_off + size) <= (accum->dirty_off + accum->dirty_len))
+ ; /* accum->dirty_len doesn't change */
else
- f->shared->accum.dirty_len = (dirty_off + size) - f->shared->accum.dirty_off;
+ accum->dirty_len = (dirty_off + size) - accum->dirty_off;
} /* end else */
} /* end if */
else {
- f->shared->accum.dirty_off = dirty_off;
- f->shared->accum.dirty_len = size;
- f->shared->accum.dirty = TRUE;
+ accum->dirty_off = dirty_off;
+ accum->dirty_len = size;
+ accum->dirty = TRUE;
} /* end else */
} /* end if */
/* Check if the new metadata overlaps the beginning of the current accumulator */
- else if(addr < f->shared->accum.loc && (addr + size) <= (f->shared->accum.loc + f->shared->accum.size)) {
+ else if(addr < accum->loc && (addr + size) <= (accum->loc + accum->size)) {
size_t old_offset; /* Offset of old data within the accumulator buffer */
/* Calculate the amount we will need to add to the accumulator size, based on the amount of overlap */
- H5_ASSIGN_OVERFLOW(add_size, (f->shared->accum.loc - addr), hsize_t, size_t);
+ H5_ASSIGN_OVERFLOW(add_size, (accum->loc - addr), hsize_t, size_t);
/* Check if we need to adjust accumulator size */
- if(H5F_accum_adjust(&f->shared->accum, f->shared->lf, dxpl_id, H5F_ACCUM_PREPEND, add_size) < 0)
+ if(H5F__accum_adjust(accum, fio_info, H5F_ACCUM_PREPEND, add_size) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator")
/* Calculate the proper offset of the existing metadata */
- H5_ASSIGN_OVERFLOW(old_offset, (addr + size) - f->shared->accum.loc, hsize_t, size_t);
+ H5_ASSIGN_OVERFLOW(old_offset, (addr + size) - accum->loc, hsize_t, size_t);
/* Move the existing metadata to the proper location */
- HDmemmove(f->shared->accum.buf + size, f->shared->accum.buf + old_offset, (f->shared->accum.size - old_offset));
+ HDmemmove(accum->buf + size, accum->buf + old_offset, (accum->size - old_offset));
/* Copy the new metadata at the front */
- HDmemcpy(f->shared->accum.buf, buf, size);
+ HDmemcpy(accum->buf, buf, size);
/* Set the new size & location of the metadata accumulator */
- f->shared->accum.loc = addr;
- f->shared->accum.size += add_size;
+ accum->loc = addr;
+ accum->size += add_size;
/* Adjust the dirty region and mark accumulator dirty */
- if(f->shared->accum.dirty) {
- size_t curr_dirty_end = add_size + f->shared->accum.dirty_off + f->shared->accum.dirty_len;
+ if(accum->dirty) {
+ size_t curr_dirty_end = add_size + accum->dirty_off + accum->dirty_len;
- f->shared->accum.dirty_off = 0;
+ accum->dirty_off = 0;
if(size <= curr_dirty_end)
- f->shared->accum.dirty_len = curr_dirty_end;
+ accum->dirty_len = curr_dirty_end;
else
- f->shared->accum.dirty_len = size;
+ accum->dirty_len = size;
} /* end if */
else {
- f->shared->accum.dirty_off = 0;
- f->shared->accum.dirty_len = size;
- f->shared->accum.dirty = TRUE;
+ accum->dirty_off = 0;
+ accum->dirty_len = size;
+ accum->dirty = TRUE;
} /* end else */
} /* end if */
/* Check if the new metadata overlaps the end of the current accumulator */
- else if(addr >= f->shared->accum.loc && (addr + size) > (f->shared->accum.loc + f->shared->accum.size)) {
+ else if(addr >= accum->loc && (addr + size) > (accum->loc + accum->size)) {
size_t dirty_off; /* Offset of dirty region */
/* Calculate the amount we will need to add to the accumulator size, based on the amount of overlap */
- H5_ASSIGN_OVERFLOW(add_size, (addr + size) - (f->shared->accum.loc + f->shared->accum.size), hsize_t, size_t);
+ H5_ASSIGN_OVERFLOW(add_size, (addr + size) - (accum->loc + accum->size), hsize_t, size_t);
/* Check if we need to adjust accumulator size */
- if(H5F_accum_adjust(&f->shared->accum, f->shared->lf, dxpl_id, H5F_ACCUM_APPEND, add_size) < 0)
+ if(H5F__accum_adjust(accum, fio_info, H5F_ACCUM_APPEND, add_size) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator")
/* Compute offset of dirty region (after adjusting accumulator) */
- dirty_off = (size_t)(addr - f->shared->accum.loc);
+ dirty_off = (size_t)(addr - accum->loc);
/* Copy the new metadata to the end */
- HDmemcpy(f->shared->accum.buf + dirty_off, buf, size);
+ HDmemcpy(accum->buf + dirty_off, buf, size);
/* Set the new size of the metadata accumulator */
- f->shared->accum.size += add_size;
+ accum->size += add_size;
/* Adjust the dirty region and mark accumulator dirty */
- if(f->shared->accum.dirty) {
+ if(accum->dirty) {
/* Check for new metadata starting before current dirty region */
- if(dirty_off <= f->shared->accum.dirty_off) {
- f->shared->accum.dirty_off = dirty_off;
- f->shared->accum.dirty_len = size;
+ if(dirty_off <= accum->dirty_off) {
+ accum->dirty_off = dirty_off;
+ accum->dirty_len = size;
} /* end if */
else {
- f->shared->accum.dirty_len = (dirty_off + size) - f->shared->accum.dirty_off;
+ accum->dirty_len = (dirty_off + size) - accum->dirty_off;
} /* end else */
} /* end if */
else {
- f->shared->accum.dirty_off = dirty_off;
- f->shared->accum.dirty_len = size;
- f->shared->accum.dirty = TRUE;
+ accum->dirty_off = dirty_off;
+ accum->dirty_len = size;
+ accum->dirty = TRUE;
} /* end else */
} /* end if */
/* New metadata overlaps both ends of the current accumulator */
else {
/* Check if we need more buffer space */
- if(size > f->shared->accum.alloc_size) {
+ if(size > accum->alloc_size) {
size_t new_alloc_size; /* New size of accumulator */
/* Adjust the buffer size to be a power of 2 that is large enough to hold data */
new_alloc_size = (size_t)1 << (1 + H5VM_log2_gen((uint64_t)(size - 1)));
/* Reallocate the metadata accumulator buffer */
- if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_alloc_size)))
+ if(NULL == (accum->buf = H5FL_BLK_REALLOC(meta_accum, accum->buf, new_alloc_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
/* Note the new buffer size */
- f->shared->accum.alloc_size = new_alloc_size;
+ accum->alloc_size = new_alloc_size;
#ifdef H5_CLEAR_MEMORY
-HDmemset(f->shared->accum.buf + size, 0, (f->shared->accum.alloc_size - size));
+HDmemset(accum->buf + size, 0, (accum->alloc_size - size));
#endif /* H5_CLEAR_MEMORY */
} /* end if */
/* Copy the new metadata to the buffer */
- HDmemcpy(f->shared->accum.buf, buf, size);
+ HDmemcpy(accum->buf, buf, size);
/* Set the new size & location of the metadata accumulator */
- f->shared->accum.loc = addr;
- f->shared->accum.size = size;
+ accum->loc = addr;
+ accum->size = size;
/* Adjust the dirty region and mark accumulator dirty */
- f->shared->accum.dirty_off = 0;
- f->shared->accum.dirty_len = size;
- f->shared->accum.dirty = TRUE;
+ accum->dirty_off = 0;
+ accum->dirty_len = size;
+ accum->dirty = TRUE;
} /* end else */
} /* end if */
/* New piece of metadata doesn't adjoin or overlap the existing accumulator */
else {
/* Write out the existing metadata accumulator, with dispatch to driver */
- if(f->shared->accum.dirty) {
- if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_DEFAULT, f->shared->accum.loc + f->shared->accum.dirty_off, f->shared->accum.dirty_len, f->shared->accum.buf + f->shared->accum.dirty_off) < 0)
+ if(accum->dirty) {
+ if(H5FD_write(fio_info->f->shared->lf, fio_info->dxpl, H5FD_MEM_DEFAULT, accum->loc + accum->dirty_off, accum->dirty_len, accum->buf + accum->dirty_off) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
/* Reset accumulator dirty flag */
- f->shared->accum.dirty = FALSE;
+ accum->dirty = FALSE;
} /* end if */
/* Cache the new piece of metadata */
/* Check if we need to resize the buffer */
- if(size > f->shared->accum.alloc_size) {
+ if(size > accum->alloc_size) {
size_t new_size; /* New size of accumulator */
/* Adjust the buffer size to be a power of 2 that is large enough to hold data */
new_size = (size_t)1 << (1 + H5VM_log2_gen((uint64_t)(size - 1)));
/* Grow the metadata accumulator buffer */
- if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_size)))
+ if(NULL == (accum->buf = H5FL_BLK_REALLOC(meta_accum, accum->buf, new_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
/* Note the new buffer size */
- f->shared->accum.alloc_size = new_size;
+ accum->alloc_size = new_size;
#ifdef H5_CLEAR_MEMORY
{
-size_t clear_size = MAX(f->shared->accum.size, size);
-HDmemset(f->shared->accum.buf + clear_size, 0, (f->shared->accum.alloc_size - clear_size));
+size_t clear_size = MAX(accum->size, size);
+HDmemset(accum->buf + clear_size, 0, (accum->alloc_size - clear_size));
}
#endif /* H5_CLEAR_MEMORY */
} /* end if */
else {
/* Check if we should shrink the accumulator buffer */
- if(size < (f->shared->accum.alloc_size / H5F_ACCUM_THROTTLE) &&
- f->shared->accum.alloc_size > H5F_ACCUM_THRESHOLD) {
- size_t tmp_size = (f->shared->accum.alloc_size / H5F_ACCUM_THROTTLE); /* New size of accumulator buffer */
+ if(size < (accum->alloc_size / H5F_ACCUM_THROTTLE) &&
+ accum->alloc_size > H5F_ACCUM_THRESHOLD) {
+ size_t tmp_size = (accum->alloc_size / H5F_ACCUM_THROTTLE); /* New size of accumulator buffer */
/* Shrink the accumulator buffer */
- if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, tmp_size)))
+ if(NULL == (accum->buf = H5FL_BLK_REALLOC(meta_accum, accum->buf, tmp_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
/* Note the new buffer size */
- f->shared->accum.alloc_size = tmp_size;
+ accum->alloc_size = tmp_size;
} /* end if */
} /* end else */
/* Update the metadata accumulator information */
- f->shared->accum.loc = addr;
- f->shared->accum.size = size;
+ accum->loc = addr;
+ accum->size = size;
/* Store the piece of metadata in the accumulator */
- HDmemcpy(f->shared->accum.buf, buf, size);
+ HDmemcpy(accum->buf, buf, size);
/* Adjust the dirty region and mark accumulator dirty */
- f->shared->accum.dirty_off = 0;
- f->shared->accum.dirty_len = size;
- f->shared->accum.dirty = TRUE;
+ accum->dirty_off = 0;
+ accum->dirty_len = size;
+ accum->dirty = TRUE;
} /* end else */
} /* end if */
/* No metadata in the accumulator, grab this piece and keep it */
else {
/* Check if we need to reallocate the buffer */
- if(size > f->shared->accum.alloc_size) {
+ if(size > accum->alloc_size) {
size_t new_size; /* New size of accumulator */
/* Adjust the buffer size to be a power of 2 that is large enough to hold data */
new_size = (size_t)1 << (1 + H5VM_log2_gen((uint64_t)(size - 1)));
/* Reallocate the metadata accumulator buffer */
- if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_size)))
+ if(NULL == (accum->buf = H5FL_BLK_REALLOC(meta_accum, accum->buf, new_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
/* Note the new buffer size */
- f->shared->accum.alloc_size = new_size;
+ accum->alloc_size = new_size;
#ifdef H5_CLEAR_MEMORY
-HDmemset(f->shared->accum.buf + size, 0, (f->shared->accum.alloc_size - size));
+HDmemset(accum->buf + size, 0, (accum->alloc_size - size));
#endif /* H5_CLEAR_MEMORY */
} /* end if */
/* Update the metadata accumulator information */
- f->shared->accum.loc = addr;
- f->shared->accum.size = size;
+ accum->loc = addr;
+ accum->size = size;
/* Store the piece of metadata in the accumulator */
- HDmemcpy(f->shared->accum.buf, buf, size);
+ HDmemcpy(accum->buf, buf, size);
/* Adjust the dirty region and mark accumulator dirty */
- f->shared->accum.dirty_off = 0;
- f->shared->accum.dirty_len = size;
- f->shared->accum.dirty = TRUE;
+ accum->dirty_off = 0;
+ accum->dirty_len = size;
+ accum->dirty = TRUE;
} /* end else */
} /* end if */
else {
/* Write the data */
- if(H5FD_write(f->shared->lf, dxpl_id, map_type, addr, size, buf) < 0)
+ if(H5FD_write(fio_info->f->shared->lf, fio_info->dxpl, map_type, addr, size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
/* Check for overlap w/accumulator */
/* (Note that this could be improved by updating the accumulator
* with [some of] the information just read in. -QAK)
*/
- if(H5F_addr_overlap(addr, size, f->shared->accum.loc, f->shared->accum.size)) {
+ if(H5F_addr_overlap(addr, size, accum->loc, accum->size)) {
/* Check for write starting before beginning of accumulator */
- if(H5F_addr_le(addr, f->shared->accum.loc)) {
+ if(H5F_addr_le(addr, accum->loc)) {
/* Check for write ending within accumulator */
- if(H5F_addr_le(addr + size, f->shared->accum.loc + f->shared->accum.size)) {
+ if(H5F_addr_le(addr + size, accum->loc + accum->size)) {
size_t overlap_size; /* Size of overlapping region */
/* Compute overlap size */
- overlap_size = (size_t)((addr + size) - f->shared->accum.loc);
+ overlap_size = (size_t)((addr + size) - accum->loc);
/* Check for dirty region */
- if(f->shared->accum.dirty) {
- haddr_t dirty_start = f->shared->accum.loc + f->shared->accum.dirty_off; /* File address of start of dirty region */
- haddr_t dirty_end = dirty_start + f->shared->accum.dirty_len; /* File address of end of dirty region */
+ if(accum->dirty) {
+ haddr_t dirty_start = accum->loc + accum->dirty_off; /* File address of start of dirty region */
+ haddr_t dirty_end = dirty_start + accum->dirty_len; /* File address of end of dirty region */
/* Check if entire dirty region is overwritten */
if(H5F_addr_le(dirty_end, addr + size)) {
- f->shared->accum.dirty = FALSE;
- f->shared->accum.dirty_len = 0;
+ accum->dirty = FALSE;
+ accum->dirty_len = 0;
} /* end if */
else {
/* Check for dirty region falling after write */
if(H5F_addr_le(addr + size, dirty_start))
- f->shared->accum.dirty_off = overlap_size;
+ accum->dirty_off = overlap_size;
else { /* Dirty region overlaps w/written region */
- f->shared->accum.dirty_off = 0;
- f->shared->accum.dirty_len -= (size_t)((addr + size) - dirty_start);
+ accum->dirty_off = 0;
+ accum->dirty_len -= (size_t)((addr + size) - dirty_start);
} /* end else */
} /* end if */
} /* end if */
/* Trim bottom of accumulator off */
- f->shared->accum.loc += overlap_size;
- f->shared->accum.size -= overlap_size;
- HDmemmove(f->shared->accum.buf, f->shared->accum.buf + overlap_size, f->shared->accum.size);
+ accum->loc += overlap_size;
+ accum->size -= overlap_size;
+ HDmemmove(accum->buf, accum->buf + overlap_size, accum->size);
} /* end if */
else { /* Access covers whole accumulator */
/* Reset accumulator, but don't flush */
- if(H5F_accum_reset(f, dxpl_id, FALSE) < 0)
+ if(H5F__accum_reset(fio_info, FALSE) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator")
} /* end else */
} /* end if */
@@ -780,49 +789,49 @@ HDmemset(f->shared->accum.buf + size, 0, (f->shared->accum.alloc_size - size));
size_t overlap_size; /* Size of overlapping region */
/* Sanity check */
- HDassert(H5F_addr_gt(addr + size, f->shared->accum.loc + f->shared->accum.size));
+ HDassert(H5F_addr_gt(addr + size, accum->loc + accum->size));
/* Compute overlap size */
- overlap_size = (size_t)((f->shared->accum.loc + f->shared->accum.size) - addr);
+ overlap_size = (size_t)((accum->loc + accum->size) - addr);
/* Check for dirty region */
- if(f->shared->accum.dirty) {
- haddr_t dirty_start = f->shared->accum.loc + f->shared->accum.dirty_off; /* File address of start of dirty region */
- haddr_t dirty_end = dirty_start + f->shared->accum.dirty_len; /* File address of end of dirty region */
+ if(accum->dirty) {
+ haddr_t dirty_start = accum->loc + accum->dirty_off; /* File address of start of dirty region */
+ haddr_t dirty_end = dirty_start + accum->dirty_len; /* File address of end of dirty region */
/* Check if entire dirty region is overwritten */
if(H5F_addr_ge(dirty_start, addr)) {
- f->shared->accum.dirty = FALSE;
- f->shared->accum.dirty_len = 0;
+ accum->dirty = FALSE;
+ accum->dirty_len = 0;
} /* end if */
else {
/* Check for dirty region falling before write */
if(H5F_addr_le(dirty_end, addr))
; /* noop */
else /* Dirty region overlaps w/written region */
- f->shared->accum.dirty_len = (size_t)(addr - dirty_start);
+ accum->dirty_len = (size_t)(addr - dirty_start);
} /* end if */
} /* end if */
/* Trim top of accumulator off */
- f->shared->accum.size -= overlap_size;
+ accum->size -= overlap_size;
} /* end else */
} /* end if */
} /* end else */
} /* end if */
else {
/* Write the data */
- if(H5FD_write(f->shared->lf, dxpl_id, map_type, addr, size, buf) < 0)
+ if(H5FD_write(fio_info->f->shared->lf, fio_info->dxpl, map_type, addr, size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_accum_write() */
+} /* end H5F__accum_write() */
/*-------------------------------------------------------------------------
- * Function: H5F_accum_free
+ * Function: H5F__accum_free
*
* Purpose: Check for free space invalidating [part of] a metadata
* accumulator.
@@ -836,19 +845,25 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t UNUSED type, haddr_t addr,
+H5F__accum_free(const H5F_io_info_t *fio_info, H5FD_mem_t UNUSED type, haddr_t addr,
hsize_t size)
{
+ H5F_meta_accum_t *accum; /* Alias for file's metadata accumulator */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* check arguments */
- HDassert(f);
+ HDassert(fio_info);
+ HDassert(fio_info->f);
+ HDassert(fio_info->dxpl);
+
+ /* Set up alias for file's metadata accumulator info */
+ accum = &fio_info->f->shared->accum;
/* Adjust the metadata accumulator to remove the freed block, if it overlaps */
- if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA)
- && H5F_addr_overlap(addr, size, f->shared->accum.loc, f->shared->accum.size)) {
+ if((fio_info->f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA)
+ && H5F_addr_overlap(addr, size, accum->loc, accum->size)) {
size_t overlap_size; /* Size of overlap with accumulator */
/* Sanity check */
@@ -857,57 +872,57 @@ H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t UNUSED type, haddr_t addr,
HDassert(H5FD_MEM_GHEAP != type); /* (global heap data is being treated as raw data currently) */
/* Check for overlapping the beginning of the accumulator */
- if(H5F_addr_le(addr, f->shared->accum.loc)) {
+ if(H5F_addr_le(addr, accum->loc)) {
/* Check for completely overlapping the accumulator */
- if(H5F_addr_ge(addr + size, f->shared->accum.loc + f->shared->accum.size)) {
+ if(H5F_addr_ge(addr + size, accum->loc + accum->size)) {
/* Reset the accumulator, but don't free buffer */
- f->shared->accum.loc = HADDR_UNDEF;
- f->shared->accum.size = 0;
- f->shared->accum.dirty = FALSE;
+ accum->loc = HADDR_UNDEF;
+ accum->size = 0;
+ accum->dirty = FALSE;
} /* end if */
/* Block to free must end within the accumulator */
else {
size_t new_accum_size; /* Size of new accumulator buffer */
/* Calculate the size of the overlap with the accumulator, etc. */
- H5_ASSIGN_OVERFLOW(overlap_size, (addr + size) - f->shared->accum.loc, haddr_t, size_t);
- new_accum_size = f->shared->accum.size - overlap_size;
+ H5_ASSIGN_OVERFLOW(overlap_size, (addr + size) - accum->loc, haddr_t, size_t);
+ new_accum_size = accum->size - overlap_size;
/* Move the accumulator buffer information to eliminate the freed block */
- HDmemmove(f->shared->accum.buf, f->shared->accum.buf + overlap_size, new_accum_size);
+ HDmemmove(accum->buf, accum->buf + overlap_size, new_accum_size);
/* Adjust the accumulator information */
- f->shared->accum.loc += overlap_size;
- f->shared->accum.size = new_accum_size;
+ accum->loc += overlap_size;
+ accum->size = new_accum_size;
/* Adjust the dirty region and possibly mark accumulator clean */
- if(f->shared->accum.dirty) {
+ if(accum->dirty) {
/* Check if block freed is entirely before dirty region */
- if(overlap_size < f->shared->accum.dirty_off)
- f->shared->accum.dirty_off -= overlap_size;
+ if(overlap_size < accum->dirty_off)
+ accum->dirty_off -= overlap_size;
else {
/* Check if block freed ends within dirty region */
- if(overlap_size < (f->shared->accum.dirty_off + f->shared->accum.dirty_len)) {
- f->shared->accum.dirty_len = (f->shared->accum.dirty_off + f->shared->accum.dirty_len) - overlap_size;
- f->shared->accum.dirty_off = 0;
+ if(overlap_size < (accum->dirty_off + accum->dirty_len)) {
+ accum->dirty_len = (accum->dirty_off + accum->dirty_len) - overlap_size;
+ accum->dirty_off = 0;
} /* end if */
/* Block freed encompasses dirty region */
else
- f->shared->accum.dirty = FALSE;
+ accum->dirty = FALSE;
} /* end else */
} /* end if */
} /* end else */
} /* end if */
/* Block to free must start within the accumulator */
else {
- haddr_t dirty_end = f->shared->accum.loc + f->shared->accum.dirty_off + f->shared->accum.dirty_len;
- haddr_t dirty_start = f->shared->accum.loc + f->shared->accum.dirty_off;
+ haddr_t dirty_end = accum->loc + accum->dirty_off + accum->dirty_len;
+ haddr_t dirty_start = accum->loc + accum->dirty_off;
/* Calculate the size of the overlap with the accumulator */
- H5_ASSIGN_OVERFLOW(overlap_size, (f->shared->accum.loc + f->shared->accum.size) - addr, haddr_t, size_t);
+ H5_ASSIGN_OVERFLOW(overlap_size, (accum->loc + accum->size) - addr, haddr_t, size_t);
/* Check if block to free begins before end of dirty region */
- if(f->shared->accum.dirty && H5F_addr_lt(addr, dirty_end)) {
+ if(accum->dirty && H5F_addr_lt(addr, dirty_end)) {
haddr_t tail_addr;
/* Calculate the address of the tail to write */
@@ -918,7 +933,7 @@ H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t UNUSED type, haddr_t addr,
/* Check if block to free is entirely before dirty region */
if(H5F_addr_le(tail_addr, dirty_start)) {
/* Write out the entire dirty region of the accumulator */
- if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_DEFAULT, dirty_start, f->shared->accum.dirty_len, f->shared->accum.buf + f->shared->accum.dirty_off) < 0)
+ if(H5FD_write(fio_info->f->shared->lf, fio_info->dxpl, H5FD_MEM_DEFAULT, dirty_start, accum->dirty_len, accum->buf + accum->dirty_off) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
} /* end if */
/* Block to free overlaps with some/all of dirty region */
@@ -928,17 +943,17 @@ H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t UNUSED type, haddr_t addr,
size_t dirty_delta;
write_size = (size_t)(dirty_end - tail_addr);
- dirty_delta = f->shared->accum.dirty_len - write_size;
+ dirty_delta = accum->dirty_len - write_size;
HDassert(write_size > 0);
/* Write out the unfreed dirty region of the accumulator */
- if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_DEFAULT, dirty_start + dirty_delta, write_size, f->shared->accum.buf + f->shared->accum.dirty_off + dirty_delta) < 0)
+ if(H5FD_write(fio_info->f->shared->lf, fio_info->dxpl, H5FD_MEM_DEFAULT, dirty_start + dirty_delta, write_size, accum->buf + accum->dirty_off + dirty_delta) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
} /* end if */
/* Reset dirty flag */
- f->shared->accum.dirty = FALSE;
+ accum->dirty = FALSE;
} /* end if */
/* Block to free begins at beginning of or in middle of dirty region */
else {
@@ -948,40 +963,40 @@ H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t UNUSED type, haddr_t addr,
size_t dirty_delta;
write_size = (size_t)(dirty_end - tail_addr);
- dirty_delta = f->shared->accum.dirty_len - write_size;
+ dirty_delta = accum->dirty_len - write_size;
HDassert(write_size > 0);
/* Write out the unfreed end of the dirty region of the accumulator */
- if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_DEFAULT, dirty_start + dirty_delta, write_size, f->shared->accum.buf + f->shared->accum.dirty_off + dirty_delta) < 0)
+ if(H5FD_write(fio_info->f->shared->lf, fio_info->dxpl, H5FD_MEM_DEFAULT, dirty_start + dirty_delta, write_size, accum->buf + accum->dirty_off + dirty_delta) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
} /* end if */
/* Check for block to free beginning at same location as dirty region */
if(H5F_addr_eq(addr, dirty_start)) {
/* Reset dirty flag */
- f->shared->accum.dirty = FALSE;
+ accum->dirty = FALSE;
} /* end if */
/* Block to free eliminates end of dirty region */
else {
- f->shared->accum.dirty_len = (size_t)(addr - dirty_start);
+ accum->dirty_len = (size_t)(addr - dirty_start);
} /* end else */
} /* end else */
} /* end if */
/* Adjust the accumulator information */
- f->shared->accum.size = f->shared->accum.size - overlap_size;
+ accum->size = accum->size - overlap_size;
} /* end else */
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_accum_free() */
+} /* end H5F__accum_free() */
/*-------------------------------------------------------------------------
- * Function: H5F_accum_flush
+ * Function: H5F__accum_flush
*
* Purpose: Flush the metadata accumulator to the file
*
@@ -994,32 +1009,33 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_accum_flush(const H5F_t *f, hid_t dxpl_id)
+H5F__accum_flush(const H5F_io_info_t *fio_info)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- HDassert(f);
- HDassert(f->shared);
+ HDassert(fio_info);
+ HDassert(fio_info->f);
+ HDassert(fio_info->dxpl);
/* Check if we need to flush out the metadata accumulator */
- if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && f->shared->accum.dirty) {
+ if((fio_info->f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && fio_info->f->shared->accum.dirty) {
/* Flush the metadata contents */
- if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_DEFAULT, f->shared->accum.loc + f->shared->accum.dirty_off, f->shared->accum.dirty_len, f->shared->accum.buf + f->shared->accum.dirty_off) < 0)
+ if(H5FD_write(fio_info->f->shared->lf, fio_info->dxpl, H5FD_MEM_DEFAULT, fio_info->f->shared->accum.loc + fio_info->f->shared->accum.dirty_off, fio_info->f->shared->accum.dirty_len, fio_info->f->shared->accum.buf + fio_info->f->shared->accum.dirty_off) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
/* Reset the dirty flag */
- f->shared->accum.dirty = FALSE;
+ fio_info->f->shared->accum.dirty = FALSE;
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_accum_flush() */
+} /* end H5F__accum_flush() */
/*-------------------------------------------------------------------------
- * Function: H5F_accum_reset
+ * Function: H5F__accum_reset
*
* Purpose: Reset the metadata accumulator for the file
*
@@ -1032,37 +1048,38 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_accum_reset(const H5F_t *f, hid_t dxpl_id, hbool_t flush)
+H5F__accum_reset(const H5F_io_info_t *fio_info, hbool_t flush)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
- HDassert(f);
- HDassert(f->shared);
+ HDassert(fio_info);
+ HDassert(fio_info->f);
+ HDassert(fio_info->dxpl);
/* Flush any dirty data in accumulator, if requested */
if(flush)
- if(H5F_accum_flush(f, dxpl_id) < 0)
+ if(H5F__accum_flush(fio_info) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "can't flush metadata accumulator")
/* Check if we need to reset the metadata accumulator information */
- if(f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) {
+ if(fio_info->f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) {
/* Sanity check */
- HDassert(!f->closing || FALSE == f->shared->accum.dirty);
+ HDassert(!fio_info->f->closing || FALSE == fio_info->f->shared->accum.dirty);
/* Free the buffer */
- if(f->shared->accum.buf)
- f->shared->accum.buf = H5FL_BLK_FREE(meta_accum, f->shared->accum.buf);
+ if(fio_info->f->shared->accum.buf)
+ fio_info->f->shared->accum.buf = H5FL_BLK_FREE(meta_accum, fio_info->f->shared->accum.buf);
/* Reset the buffer sizes & location */
- f->shared->accum.alloc_size = f->shared->accum.size = 0;
- f->shared->accum.loc = HADDR_UNDEF;
- f->shared->accum.dirty = FALSE;
- f->shared->accum.dirty_len = 0;
+ fio_info->f->shared->accum.alloc_size = fio_info->f->shared->accum.size = 0;
+ fio_info->f->shared->accum.loc = HADDR_UNDEF;
+ fio_info->f->shared->accum.dirty = FALSE;
+ fio_info->f->shared->accum.dirty_len = 0;
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_accum_reset() */
+} /* end H5F__accum_reset() */
diff --git a/src/H5Fio.c b/src/H5Fio.c
index d494488..1d05cd0 100644
--- a/src/H5Fio.c
+++ b/src/H5Fio.c
@@ -38,6 +38,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
#include "H5FDprivate.h" /* File drivers */
+#include "H5Iprivate.h" /* IDs */
/****************/
@@ -95,6 +96,7 @@ herr_t
H5F_block_read(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size,
hid_t dxpl_id, void *buf/*out*/)
{
+ H5F_io_info_t fio_info; /* I/O info for operation */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -108,8 +110,13 @@ H5F_block_read(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size,
if(H5F_addr_le(f->shared->tmp_addr, (addr + size)))
HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space")
+ /* Set up I/O info for operation */
+ fio_info.f = f;
+ if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
+
/* Pass through metadata accumulator layer */
- if(H5F_accum_read(f, dxpl_id, type, addr, size, buf) < 0)
+ if(H5F__accum_read(&fio_info, type, addr, size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "read through metadata accumulator failed")
done:
@@ -136,6 +143,7 @@ herr_t
H5F_block_write(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size,
hid_t dxpl_id, const void *buf)
{
+ H5F_io_info_t fio_info; /* I/O info for operation */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -153,8 +161,13 @@ HDfprintf(stderr, "%s: write to addr = %a, size = %Zu\n", FUNC, addr, size);
if(H5F_addr_le(f->shared->tmp_addr, (addr + size)))
HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space")
+ /* Set up I/O info for operation */
+ fio_info.f = f;
+ if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
+
/* Pass through metadata accumulator layer */
- if(H5F_accum_write(f, dxpl_id, type, addr, size, buf) < 0)
+ if(H5F__accum_write(&fio_info, type, addr, size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write through metadata accumulator failed")
done:
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 1f10dbc..2313f63 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -53,10 +53,6 @@
# undef H5F_DEBUG
#endif
-/* Define the HDF5 file signature */
-#define H5F_SIGNATURE "\211HDF\r\n\032\n"
-#define H5F_SIGNATURE_LEN 8
-
/* Superblock status flags */
#define H5F_SUPER_WRITE_ACCESS 0x01
#define H5F_SUPER_FILE_OK 0x02
@@ -292,7 +288,6 @@ H5_DLLVAR const H5AC_class_t H5AC_SUPERBLOCK[1];
/* General routines */
H5_DLL herr_t H5F_init(void);
H5_DLL herr_t H5F__term_deprec_interface(void);
-H5_DLL herr_t H5F_locate_signature(H5FD_t *file, hid_t dxpl_id, haddr_t *sig_addr);
H5_DLL herr_t H5F_flush(H5F_t *f, hid_t dxpl_id, hbool_t closing);
/* File mount related routines */
@@ -314,14 +309,14 @@ H5_DLL herr_t H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hid_t dxpl_id,
hbool_t was_created);
/* Metadata accumulator routines */
-H5_DLL herr_t H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type,
+H5_DLL herr_t H5F__accum_read(const H5F_io_info_t *fio_info, H5FD_mem_t type,
haddr_t addr, size_t size, void *buf);
-H5_DLL herr_t H5F_accum_write(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type,
+H5_DLL herr_t H5F__accum_write(const H5F_io_info_t *fio_info, H5FD_mem_t type,
haddr_t addr, size_t size, const void *buf);
-H5_DLL herr_t H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type,
+H5_DLL herr_t H5F__accum_free(const H5F_io_info_t *fio_info, H5FD_mem_t type,
haddr_t addr, hsize_t size);
-H5_DLL herr_t H5F_accum_flush(const H5F_t *f, hid_t dxpl_id);
-H5_DLL herr_t H5F_accum_reset(const H5F_t *f, hid_t dxpl_id, hbool_t flush);
+H5_DLL herr_t H5F__accum_flush(const H5F_io_info_t *fio_info);
+H5_DLL herr_t H5F__accum_reset(const H5F_io_info_t *fio_info, hbool_t flush);
/* Shared file list related routines */
H5_DLL herr_t H5F_sfile_add(H5F_file_t *shared);
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 4d6e5ba..c9a0609 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -29,17 +29,9 @@
/* Private headers needed by this file */
-/****************************/
-/* Library Private Typedefs */
-/****************************/
-
-/* Main file structure */
-typedef struct H5F_t H5F_t;
-typedef struct H5F_file_t H5F_file_t;
-
-/* Block aggregation structure */
-typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
-
+/**************************/
+/* Library Private Macros */
+/**************************/
/*
* Encode and decode macros for file meta-data.
@@ -414,6 +406,10 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
#define H5_PAR_META_WRITE 0
#endif /* H5_HAVE_PARALLEL */
+/* Define the HDF5 file signature */
+#define H5F_SIGNATURE "\211HDF\r\n\032\n"
+#define H5F_SIGNATURE_LEN 8
+
/* Version #'s of the major components of the file format */
#define HDF5_SUPERBLOCK_VERSION_DEF 0 /* The default super block format */
#define HDF5_SUPERBLOCK_VERSION_1 1 /* Version with non-default B-tree 'K' value */
@@ -479,11 +475,42 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
#define H5SM_LIST_MAGIC "SMLI" /* Shared Message List */
-/* Forward declarations for prototype arguments */
+/****************************/
+/* Library Private Typedefs */
+/****************************/
+
+/* Forward declarations (for prototypes & type definitions) */
struct H5B_class_t;
struct H5RC_t;
struct H5O_loc_t;
struct H5HG_heap_t;
+struct H5P_genplist_t;
+
+/* Forward declarations for anonymous H5F objects */
+
+/* Main file structures */
+typedef struct H5F_t H5F_t;
+typedef struct H5F_file_t H5F_file_t;
+
+/* Block aggregation structure */
+typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
+
+/* I/O Info for an operation */
+typedef struct H5F_io_info_t {
+ const H5F_t *f; /* File object */
+ const struct H5P_genplist_t *dxpl; /* DXPL object */
+} H5F_io_info_t;
+
+
+/*****************************/
+/* Library-private Variables */
+/*****************************/
+
+
+/***************************************/
+/* Library-private Function Prototypes */
+/***************************************/
+
/* Private functions */
H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id,
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 68dd17a..43ab0ec 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -100,70 +100,6 @@ H5F_init_super_interface(void)
/*-------------------------------------------------------------------------
- * Function: H5F_locate_signature
- *
- * Purpose: Finds the HDF5 superblock signature in a file. The
- * signature can appear at address 0, or any power of two
- * beginning with 512.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5F_locate_signature(H5FD_t *file, hid_t dxpl_id, haddr_t *sig_addr)
-{
- haddr_t addr, eoa;
- uint8_t buf[H5F_SIGNATURE_LEN];
- unsigned n, maxpow;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Find the least N such that 2^N is larger than the file size */
- if(HADDR_UNDEF == (addr = H5FD_get_eof(file)) || HADDR_UNDEF == (eoa = H5FD_get_eoa(file, H5FD_MEM_SUPER)))
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to obtain EOF/EOA value")
- for(maxpow = 0; addr; maxpow++)
- addr >>= 1;
- maxpow = MAX(maxpow, 9);
-
- /*
- * Search for the file signature at format address zero followed by
- * powers of two larger than 9.
- */
- for(n = 8; n < maxpow; n++) {
- addr = (8 == n) ? 0 : (haddr_t)1 << n;
- if(H5FD_set_eoa(file, H5FD_MEM_SUPER, addr + H5F_SIGNATURE_LEN) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to set EOA value for file signature")
- if(H5FD_read(file, dxpl_id, H5FD_MEM_SUPER, addr, (size_t)H5F_SIGNATURE_LEN, buf) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to read file signature")
- if(!HDmemcmp(buf, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN))
- break;
- } /* end for */
-
- /*
- * If the signature was not found then reset the EOA value and return
- * HADDR_UNDEF.
- */
- if(n >= maxpow) {
- if(H5FD_set_eoa(file, H5FD_MEM_SUPER, eoa) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to reset EOA value")
- *sig_addr = HADDR_UNDEF;
- } /* end if */
- else
- /* Set return value */
- *sig_addr = addr;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_locate_signature() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5F_super_ext_create
*
* Purpose: Create the superblock extension
@@ -320,6 +256,7 @@ done:
herr_t
H5F_super_read(H5F_t *f, hid_t dxpl_id)
{
+ H5P_genplist_t *dxpl; /* DXPL object */
H5F_super_t * sblock = NULL; /* superblock structure */
unsigned sblock_flags = H5AC__NO_FLAGS_SET; /* flags used in superblock unprotect call */
haddr_t super_addr; /* Absolute address of superblock */
@@ -329,8 +266,12 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id)
FUNC_ENTER_NOAPI(FAIL)
+ /* Get the DXPL plist object for DXPL ID */
+ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
+
/* Find the superblock */
- if(H5F_locate_signature(f->shared->lf, dxpl_id, &super_addr) < 0)
+ if(H5FD_locate_signature(f->shared->lf, dxpl, &super_addr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature")
if(HADDR_UNDEF == super_addr)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "file signature not found")
diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c
index a437451..9c02bc1 100644
--- a/src/H5Fsuper_cache.c
+++ b/src/H5Fsuper_cache.c
@@ -115,6 +115,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata)
H5F_super_t *sblock = NULL; /* File's superblock */
haddr_t base_addr = HADDR_UNDEF; /* Base address of file */
uint8_t sbuf[H5F_MAX_SUPERBLOCK_SIZE]; /* Buffer for superblock */
+ H5P_genplist_t *dxpl; /* DXPL object */
H5P_genplist_t *c_plist; /* File creation property list */
H5F_file_t *shared; /* shared part of `file' */
H5FD_t *lf; /* file driver part of `shared' */
@@ -152,12 +153,16 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata)
if(NULL == (sblock = H5FL_CALLOC(H5F_super_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ /* Get the DXPL plist object for DXPL ID */
+ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "can't get property list")
+
/* Read fixed-size portion of the superblock */
p = sbuf;
H5_CHECK_OVERFLOW(fixed_size, size_t, haddr_t);
if(H5FD_set_eoa(lf, H5FD_MEM_SUPER, (haddr_t)fixed_size) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "set end of space allocation request failed")
- if(H5FD_read(lf, dxpl_id, H5FD_MEM_SUPER, (haddr_t)0, fixed_size, p) < 0)
+ if(H5FD_read(lf, dxpl, H5FD_MEM_SUPER, (haddr_t)0, fixed_size, p) < 0)
HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock")
/* Skip over signature (already checked when locating the superblock) */
@@ -184,7 +189,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata)
/* Read in variable-sized portion of superblock */
if(H5FD_set_eoa(lf, H5FD_MEM_SUPER, (haddr_t)(fixed_size + variable_size)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "set end of space allocation request failed")
- if(H5FD_read(lf, dxpl_id, H5FD_MEM_SUPER, (haddr_t)fixed_size, variable_size, p) < 0)
+ if(H5FD_read(lf, dxpl, H5FD_MEM_SUPER, (haddr_t)fixed_size, variable_size, p) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read superblock")
/* Check for older version of superblock format */
@@ -338,7 +343,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata)
p = dbuf;
if(H5FD_set_eoa(lf, H5FD_MEM_SUPER, sblock->driver_addr + H5F_DRVINFOBLOCK_HDR_SIZE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "set end of space allocation request failed")
- if(H5FD_read(lf, dxpl_id, H5FD_MEM_SUPER, sblock->driver_addr, (size_t)H5F_DRVINFOBLOCK_HDR_SIZE, p) < 0)
+ if(H5FD_read(lf, dxpl, H5FD_MEM_SUPER, sblock->driver_addr, (size_t)H5F_DRVINFOBLOCK_HDR_SIZE, p) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read driver information block")
/* Version number */
@@ -370,7 +375,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata)
/* Read in variable-sized portion of driver info block */
if(H5FD_set_eoa(lf, H5FD_MEM_SUPER, sblock->driver_addr + H5F_DRVINFOBLOCK_HDR_SIZE + drv_variable_size) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "set end of space allocation request failed")
- if(H5FD_read(lf, dxpl_id, H5FD_MEM_SUPER, sblock->driver_addr + H5F_DRVINFOBLOCK_HDR_SIZE, drv_variable_size, p) < 0)
+ if(H5FD_read(lf, dxpl, H5FD_MEM_SUPER, sblock->driver_addr + H5F_DRVINFOBLOCK_HDR_SIZE, drv_variable_size, p) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read file driver information")
/* Decode driver information */
@@ -607,11 +612,12 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr,
HDassert(sblock);
if(sblock->cache_info.is_dirty) {
+ H5P_genplist_t *dxpl; /* DXPL object */
uint8_t buf[H5F_MAX_SUPERBLOCK_SIZE + H5F_MAX_DRVINFOBLOCK_SIZE]; /* Superblock & driver info blockencoding buffer */
- uint8_t *p; /* Ptr into encoding buffer */
- haddr_t rel_eoa; /* Relative EOA for file */
- size_t superblock_size; /* Size of superblock, in bytes */
- size_t driver_size; /* Size of driver info block (bytes)*/
+ uint8_t *p; /* Ptr into encoding buffer */
+ haddr_t rel_eoa; /* Relative EOA for file */
+ size_t superblock_size; /* Size of superblock, in bytes */
+ size_t driver_size; /* Size of driver info block (bytes)*/
/* Encode the common portion of the file superblock for all versions */
p = buf;
@@ -727,9 +733,13 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr,
/* Double check we didn't overrun the block (unlikely) */
HDassert(superblock_size <= sizeof(buf));
+ /* Get the DXPL plist object for DXPL ID */
+ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
+
/* Write superblock */
/* (always at relative address 0) */
- if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_SUPER, (haddr_t)0, superblock_size, buf) < 0)
+ if(H5FD_write(f->shared->lf, dxpl, H5FD_MEM_SUPER, (haddr_t)0, superblock_size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write superblock")
/* Check for newer version of superblock format & superblock extension */
diff --git a/src/H5G.c b/src/H5G.c
index cbd47ba..78b4a20 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -547,7 +547,7 @@ H5G_get_create_plist(H5G_t *grp)
FUNC_ENTER_NOAPI(FAIL)
/* Copy the default group creation property list */
- if(NULL == (gcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_GROUP_CREATE_g)))
+ if(NULL == (gcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_GROUP_CREATE_ID_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get default group creation property list")
if((new_gcpl_id = H5P_copy_plist(gcpl_plist, TRUE)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to copy the creation property list")
diff --git a/src/H5MF.c b/src/H5MF.c
index 763d15e..82a87f1 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -38,8 +38,9 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
+#include "H5Iprivate.h" /* IDs */
#include "H5MFpkg.h" /* File memory management */
-#include "H5VMprivate.h" /* Vectors and arrays */
+#include "H5VMprivate.h" /* Vectors and arrays */
/****************/
@@ -593,6 +594,7 @@ herr_t
H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, haddr_t addr,
hsize_t size)
{
+ H5F_io_info_t fio_info; /* I/O info for operation */
H5MF_free_section_t *node = NULL; /* Free space section pointer */
H5MF_sect_ud_t udata; /* User data for callback */
H5FD_mem_t fs_type; /* Free space type (mapped from allocation type) */
@@ -613,8 +615,13 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN
if(H5F_addr_le(f->shared->tmp_addr, addr))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, FAIL, "attempting to free temporary file space")
+ /* Set up I/O info for operation */
+ fio_info.f = f;
+ if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
+
/* Check if the space to free intersects with the file's metadata accumulator */
- if(H5F_accum_free(f, dxpl_id, alloc_type, addr, size) < 0)
+ if(H5F__accum_free(&fio_info, alloc_type, addr, size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't check free space intersection w/metadata accumulator")
/* Get free space type from allocation type */
@@ -816,7 +823,7 @@ H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_si
hsize_t tot_fs_size = 0; /* Amount of all free space managed */
hsize_t tot_meta_size = 0; /* Amount of metadata for free space managers */
H5FD_mem_t type; /* Memory type for iteration */
- H5FD_mem_t fs_started[H5FD_MEM_NTYPES]; /* Indicate whether the free-space manager has been started */
+ hbool_t fs_started[H5FD_MEM_NTYPES]; /* Indicate whether the free-space manager has been started */
hbool_t eoa_shrank; /* Whether an EOA shrink occurs */
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5Pacpl.c b/src/H5Pacpl.c
index b30bf1e..0a0641c 100644
--- a/src/H5Pacpl.c
+++ b/src/H5Pacpl.c
@@ -65,10 +65,13 @@
const H5P_libclass_t H5P_CLS_ACRT[1] = {{
"attribute create", /* Class name for debugging */
H5P_TYPE_ATTRIBUTE_CREATE, /* Class type */
- &H5P_CLS_STRING_CREATE_g, /* Parent class ID */
- &H5P_CLS_ATTRIBUTE_CREATE_g, /* Pointer to class ID */
- &H5P_LST_ATTRIBUTE_CREATE_g, /* Pointer to default property list ID */
+
+ &H5P_CLS_STRING_CREATE_g, /* Parent class */
+ &H5P_CLS_ATTRIBUTE_CREATE_g, /* Pointer to class */
+ &H5P_CLS_ATTRIBUTE_CREATE_ID_g, /* Pointer to class ID */
+ &H5P_LST_ATTRIBUTE_CREATE_ID_g, /* Pointer to default property list ID */
NULL, /* Default property registration routine */
+
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
NULL, /* Class copy callback */
diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c
index d21cdbf..485fcba 100644
--- a/src/H5Pdapl.c
+++ b/src/H5Pdapl.c
@@ -83,10 +83,13 @@ static herr_t H5P__dacc_reg_prop(H5P_genclass_t *pclass);
const H5P_libclass_t H5P_CLS_DACC[1] = {{
"dataset access", /* Class name for debugging */
H5P_TYPE_DATASET_ACCESS, /* Class type */
- &H5P_CLS_LINK_ACCESS_g, /* Parent class ID */
- &H5P_CLS_DATASET_ACCESS_g, /* Pointer to class ID */
- &H5P_LST_DATASET_ACCESS_g, /* Pointer to default property list ID */
+
+ &H5P_CLS_LINK_ACCESS_g, /* Parent class */
+ &H5P_CLS_DATASET_ACCESS_g, /* Pointer to class */
+ &H5P_CLS_DATASET_ACCESS_ID_g, /* Pointer to class ID */
+ &H5P_LST_DATASET_ACCESS_ID_g, /* Pointer to default property list ID */
H5P__dacc_reg_prop, /* Default property registration routine */
+
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
NULL, /* Class copy callback */
@@ -187,7 +190,7 @@ H5Pset_chunk_cache(hid_t dapl_id, size_t rdcc_nslots, size_t rdcc_nbytes, double
/* Check arguments. Note that we allow negative values - they are
* considered to "unset" the property. */
- if(rdcc_w0 > 1.0)
+ if(rdcc_w0 > (double)1.0f)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "raw data cache w0 value must be between 0.0 and 1.0 inclusive, or H5D_CHUNK_CACHE_W0_DEFAULT");
/* Get the plist structure */
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index 6e106ea..0841e5b 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -129,10 +129,13 @@ static int H5P__dcrt_ext_file_list_cmp(const void *value1, const void *value2, s
const H5P_libclass_t H5P_CLS_DCRT[1] = {{
"dataset create", /* Class name for debugging */
H5P_TYPE_DATASET_CREATE, /* Class type */
- &H5P_CLS_OBJECT_CREATE_g, /* Parent class ID */
- &H5P_CLS_DATASET_CREATE_g, /* Pointer to class ID */
- &H5P_LST_DATASET_CREATE_g, /* Pointer to default property list ID */
+
+ &H5P_CLS_OBJECT_CREATE_g, /* Parent class */
+ &H5P_CLS_DATASET_CREATE_g, /* Pointer to class */
+ &H5P_CLS_DATASET_CREATE_ID_g, /* Pointer to class ID */
+ &H5P_LST_DATASET_CREATE_ID_g, /* Pointer to default property list ID */
H5P__dcrt_reg_prop, /* Default property registration routine */
+
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
H5P__dcrt_copy, /* Class copy callback */
@@ -1502,7 +1505,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5P_get_fill_value(H5P_genplist_t *plist, H5T_t *type, void *value/*out*/,
+H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value/*out*/,
hid_t dxpl_id)
{
H5O_fill_t fill; /* Fill value to retrieve */
diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c
index e525327..e265c50 100644
--- a/src/H5Pdeprec.c
+++ b/src/H5Pdeprec.c
@@ -42,6 +42,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
#include "H5Iprivate.h" /* IDs */
#include "H5Ppkg.h" /* Property lists */
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index 9e25a59..7688ecf 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -170,10 +170,13 @@ static herr_t H5P__dxfr_xform_close(const char* name, size_t size, void* value);
const H5P_libclass_t H5P_CLS_DXFR[1] = {{
"data transfer", /* Class name for debugging */
H5P_TYPE_DATASET_XFER, /* Class type */
- &H5P_CLS_ROOT_g, /* Parent class ID */
- &H5P_CLS_DATASET_XFER_g, /* Pointer to class ID */
- &H5P_LST_DATASET_XFER_g, /* Pointer to default property list ID */
+
+ &H5P_CLS_ROOT_g, /* Parent class */
+ &H5P_CLS_DATASET_XFER_g, /* Pointer to class */
+ &H5P_CLS_DATASET_XFER_ID_g, /* Pointer to class ID */
+ &H5P_LST_DATASET_XFER_ID_g, /* Pointer to default property list ID */
H5P__dxfr_reg_prop, /* Default property registration routine */
+
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
NULL, /* Class copy callback */
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index ee483cd..257eb24 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -37,17 +37,17 @@
#include "H5ACprivate.h" /* Metadata cache */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
+#include "H5Fprivate.h" /* Files */
#include "H5FDprivate.h" /* File drivers */
#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory Management */
+#include "H5MMprivate.h" /* Memory Management */
#include "H5Ppkg.h" /* Property lists */
/* Includes needed to set as default file driver */
#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */
#include "H5FDstdio.h" /* Standard C buffered I/O */
#ifdef H5_HAVE_WINDOWS
-#include "H5FDwindows.h" /* Windows buffered I/O */
+#include "H5FDwindows.h" /* Windows buffered I/O */
#endif
@@ -169,10 +169,13 @@ static herr_t H5P_file_image_info_close(const char *name, size_t size, void *val
const H5P_libclass_t H5P_CLS_FACC[1] = {{
"file access", /* Class name for debugging */
H5P_TYPE_FILE_ACCESS, /* Class type */
- &H5P_CLS_ROOT_g, /* Parent class ID */
- &H5P_CLS_FILE_ACCESS_g, /* Pointer to class ID */
- &H5P_LST_FILE_ACCESS_g, /* Pointer to default property list ID */
+
+ &H5P_CLS_ROOT_g, /* Parent class */
+ &H5P_CLS_FILE_ACCESS_g, /* Pointer to class */
+ &H5P_CLS_FILE_ACCESS_ID_g, /* Pointer to class ID */
+ &H5P_LST_FILE_ACCESS_ID_g, /* Pointer to default property list ID */
H5P_facc_reg_prop, /* Default property registration routine */
+
H5P_facc_create, /* Class creation callback */
NULL, /* Class creation callback info */
H5P_facc_copy, /* Class copy callback */
@@ -1033,7 +1036,7 @@ H5Pset_cache(hid_t plist_id, int UNUSED mdc_nelmts,
rdcc_w0);
/* Check arguments */
- if(rdcc_w0 < 0.0 || rdcc_w0 > 1.0)
+ if(rdcc_w0 < (double)0.0f || rdcc_w0 > (double)1.0f)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "raw data cache w0 value must be between 0.0 and 1.0 inclusive")
/* Get the plist structure */
diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c
index e1f83b0..d114650 100644
--- a/src/H5Pfcpl.c
+++ b/src/H5Pfcpl.c
@@ -103,10 +103,13 @@ static herr_t H5P_fcrt_reg_prop(H5P_genclass_t *pclass);
const H5P_libclass_t H5P_CLS_FCRT[1] = {{
"file create", /* Class name for debugging */
H5P_TYPE_FILE_CREATE, /* Class type */
- &H5P_CLS_GROUP_CREATE_g, /* Parent class ID */
- &H5P_CLS_FILE_CREATE_g, /* Pointer to class ID */
- &H5P_LST_FILE_CREATE_g, /* Pointer to default property list ID */
+
+ &H5P_CLS_GROUP_CREATE_g, /* Parent class */
+ &H5P_CLS_FILE_CREATE_g, /* Pointer to class */
+ &H5P_CLS_FILE_CREATE_ID_g, /* Pointer to class ID */
+ &H5P_LST_FILE_CREATE_ID_g, /* Pointer to default property list ID */
H5P_fcrt_reg_prop, /* Default property registration routine */
+
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
NULL, /* Class copy callback */
diff --git a/src/H5Pfmpl.c b/src/H5Pfmpl.c
index 0158bf1..3d1f9b2 100644
--- a/src/H5Pfmpl.c
+++ b/src/H5Pfmpl.c
@@ -35,6 +35,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
#include "H5Iprivate.h" /* IDs */
#include "H5Ppkg.h" /* Property lists */
@@ -75,10 +76,13 @@ static herr_t H5P_fmnt_reg_prop(H5P_genclass_t *pclass);
const H5P_libclass_t H5P_CLS_FMNT[1] = {{
"file mount", /* Class name for debugging */
H5P_TYPE_FILE_MOUNT, /* Class type */
- &H5P_CLS_ROOT_g, /* Parent class ID */
- &H5P_CLS_FILE_MOUNT_g, /* Pointer to class ID */
- &H5P_LST_FILE_MOUNT_g, /* Pointer to default property list ID */
+
+ &H5P_CLS_ROOT_g, /* Parent class */
+ &H5P_CLS_FILE_MOUNT_g, /* Pointer to class */
+ &H5P_CLS_FILE_MOUNT_ID_g, /* Pointer to class ID */
+ &H5P_LST_FILE_MOUNT_ID_g, /* Pointer to default property list ID */
H5P_fmnt_reg_prop, /* Default property registration routine */
+
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
NULL, /* Class copy callback */
diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c
index 394cf8b..754e44d 100644
--- a/src/H5Pgcpl.c
+++ b/src/H5Pgcpl.c
@@ -34,7 +34,9 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
+#include "H5Gprivate.h" /* Groups */
#include "H5Iprivate.h" /* IDs */
+#include "H5Oprivate.h" /* Object headers */
#include "H5Ppkg.h" /* Property lists */
@@ -69,10 +71,13 @@ static herr_t H5P__gcrt_reg_prop(H5P_genclass_t *pclass);
const H5P_libclass_t H5P_CLS_GCRT[1] = {{
"group create", /* Class name for debugging */
H5P_TYPE_GROUP_CREATE, /* Class type */
- &H5P_CLS_OBJECT_CREATE_g, /* Parent class ID */
- &H5P_CLS_GROUP_CREATE_g, /* Pointer to class ID */
- &H5P_LST_GROUP_CREATE_g, /* Pointer to default property list ID */
+
+ &H5P_CLS_OBJECT_CREATE_g, /* Parent class */
+ &H5P_CLS_GROUP_CREATE_g, /* Pointer to class */
+ &H5P_CLS_GROUP_CREATE_ID_g, /* Pointer to class ID */
+ &H5P_LST_GROUP_CREATE_ID_g, /* Pointer to default property list ID */
H5P__gcrt_reg_prop, /* Default property registration routine */
+
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
NULL, /* Class copy callback */
diff --git a/src/H5Pint.c b/src/H5Pint.c
index 2d5f609..4858e80 100644
--- a/src/H5Pint.c
+++ b/src/H5Pint.c
@@ -98,51 +98,71 @@ static int H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2);
* Predefined property list classes. These are initialized at runtime by
* H5P_init_interface() in this source file.
*/
-hid_t H5P_CLS_ROOT_g = FAIL;
-hid_t H5P_CLS_OBJECT_CREATE_g = FAIL;
-hid_t H5P_CLS_FILE_CREATE_g = FAIL;
-hid_t H5P_CLS_FILE_ACCESS_g = FAIL;
-hid_t H5P_CLS_DATASET_CREATE_g = FAIL;
-hid_t H5P_CLS_DATASET_ACCESS_g = FAIL;
-hid_t H5P_CLS_DATASET_XFER_g = FAIL;
-hid_t H5P_CLS_FILE_MOUNT_g = FAIL;
-hid_t H5P_CLS_GROUP_CREATE_g = FAIL;
-hid_t H5P_CLS_GROUP_ACCESS_g = FAIL;
-hid_t H5P_CLS_DATATYPE_CREATE_g = FAIL;
-hid_t H5P_CLS_DATATYPE_ACCESS_g = FAIL;
-hid_t H5P_CLS_ATTRIBUTE_CREATE_g = FAIL;
-hid_t H5P_CLS_OBJECT_COPY_g = FAIL;
-hid_t H5P_CLS_LINK_CREATE_g = FAIL;
-hid_t H5P_CLS_LINK_ACCESS_g = FAIL;
-hid_t H5P_CLS_STRING_CREATE_g = FAIL;
+hid_t H5P_CLS_ROOT_ID_g = FAIL;
+H5P_genclass_t *H5P_CLS_ROOT_g = NULL;
+hid_t H5P_CLS_OBJECT_CREATE_ID_g = FAIL;
+H5P_genclass_t *H5P_CLS_OBJECT_CREATE_g = NULL;
+hid_t H5P_CLS_FILE_CREATE_ID_g = FAIL;
+H5P_genclass_t *H5P_CLS_FILE_CREATE_g = NULL;
+hid_t H5P_CLS_FILE_ACCESS_ID_g = FAIL;
+H5P_genclass_t *H5P_CLS_FILE_ACCESS_g = NULL;
+hid_t H5P_CLS_DATASET_CREATE_ID_g = FAIL;
+H5P_genclass_t *H5P_CLS_DATASET_CREATE_g = NULL;
+hid_t H5P_CLS_DATASET_ACCESS_ID_g = FAIL;
+H5P_genclass_t *H5P_CLS_DATASET_ACCESS_g = NULL;
+hid_t H5P_CLS_DATASET_XFER_ID_g = FAIL;
+H5P_genclass_t *H5P_CLS_DATASET_XFER_g = NULL;
+hid_t H5P_CLS_FILE_MOUNT_ID_g = FAIL;
+H5P_genclass_t *H5P_CLS_FILE_MOUNT_g = NULL;
+hid_t H5P_CLS_GROUP_CREATE_ID_g = FAIL;
+H5P_genclass_t *H5P_CLS_GROUP_CREATE_g = NULL;
+hid_t H5P_CLS_GROUP_ACCESS_ID_g = FAIL;
+H5P_genclass_t *H5P_CLS_GROUP_ACCESS_g = NULL;
+hid_t H5P_CLS_DATATYPE_CREATE_ID_g = FAIL;
+H5P_genclass_t *H5P_CLS_DATATYPE_CREATE_g = NULL;
+hid_t H5P_CLS_DATATYPE_ACCESS_ID_g = FAIL;
+H5P_genclass_t *H5P_CLS_DATATYPE_ACCESS_g = NULL;
+hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g = FAIL;
+H5P_genclass_t *H5P_CLS_ATTRIBUTE_CREATE_g = NULL;
+hid_t H5P_CLS_OBJECT_COPY_ID_g = FAIL;
+H5P_genclass_t *H5P_CLS_OBJECT_COPY_g = NULL;
+hid_t H5P_CLS_LINK_CREATE_ID_g = FAIL;
+H5P_genclass_t *H5P_CLS_LINK_CREATE_g = NULL;
+hid_t H5P_CLS_LINK_ACCESS_ID_g = FAIL;
+H5P_genclass_t *H5P_CLS_LINK_ACCESS_g = NULL;
+hid_t H5P_CLS_STRING_CREATE_ID_g = FAIL;
+H5P_genclass_t *H5P_CLS_STRING_CREATE_g = NULL;
/*
* Predefined property lists for each predefined class. These are initialized
* at runtime by H5P_init_interface() in this source file.
*/
-hid_t H5P_LST_FILE_CREATE_g = FAIL;
-hid_t H5P_LST_FILE_ACCESS_g = FAIL;
-hid_t H5P_LST_DATASET_CREATE_g = FAIL;
-hid_t H5P_LST_DATASET_ACCESS_g = FAIL;
-hid_t H5P_LST_DATASET_XFER_g = FAIL;
-hid_t H5P_LST_FILE_MOUNT_g = FAIL;
-hid_t H5P_LST_GROUP_CREATE_g = FAIL;
-hid_t H5P_LST_GROUP_ACCESS_g = FAIL;
-hid_t H5P_LST_DATATYPE_CREATE_g = FAIL;
-hid_t H5P_LST_DATATYPE_ACCESS_g = FAIL;
-hid_t H5P_LST_ATTRIBUTE_CREATE_g = FAIL;
-hid_t H5P_LST_OBJECT_COPY_g = FAIL;
-hid_t H5P_LST_LINK_CREATE_g = FAIL;
-hid_t H5P_LST_LINK_ACCESS_g = FAIL;
+hid_t H5P_LST_FILE_CREATE_ID_g = FAIL;
+hid_t H5P_LST_FILE_ACCESS_ID_g = FAIL;
+hid_t H5P_LST_DATASET_CREATE_ID_g = FAIL;
+hid_t H5P_LST_DATASET_ACCESS_ID_g = FAIL;
+hid_t H5P_LST_DATASET_XFER_ID_g = FAIL;
+hid_t H5P_LST_FILE_MOUNT_ID_g = FAIL;
+hid_t H5P_LST_GROUP_CREATE_ID_g = FAIL;
+hid_t H5P_LST_GROUP_ACCESS_ID_g = FAIL;
+hid_t H5P_LST_DATATYPE_CREATE_ID_g = FAIL;
+hid_t H5P_LST_DATATYPE_ACCESS_ID_g = FAIL;
+hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g = FAIL;
+hid_t H5P_LST_OBJECT_COPY_ID_g = FAIL;
+hid_t H5P_LST_LINK_CREATE_ID_g = FAIL;
+hid_t H5P_LST_LINK_ACCESS_ID_g = FAIL;
/* Root property list class library initialization object */
const H5P_libclass_t H5P_CLS_ROOT[1] = {{
"root", /* Class name for debugging */
H5P_TYPE_ROOT, /* Class type */
- NULL, /* Parent class ID */
- &H5P_CLS_ROOT_g, /* Pointer to class ID */
+
+ NULL, /* Parent class */
+ &H5P_CLS_ROOT_g, /* Pointer to class */
+ &H5P_CLS_ROOT_ID_g, /* Pointer to class ID */
NULL, /* Pointer to default property list ID */
NULL, /* Default property registration routine */
+
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
NULL, /* Class copy callback */
@@ -156,10 +176,13 @@ const H5P_libclass_t H5P_CLS_ROOT[1] = {{
const H5P_libclass_t H5P_CLS_GACC[1] = {{
"group access", /* Class name for debugging */
H5P_TYPE_GROUP_ACCESS, /* Class type */
- &H5P_CLS_LINK_ACCESS_g, /* Parent class ID */
- &H5P_CLS_GROUP_ACCESS_g, /* Pointer to class ID */
- &H5P_LST_GROUP_ACCESS_g, /* Pointer to default property list ID */
+
+ &H5P_CLS_LINK_ACCESS_g, /* Parent class */
+ &H5P_CLS_GROUP_ACCESS_g, /* Pointer to class */
+ &H5P_CLS_GROUP_ACCESS_ID_g, /* Pointer to class ID */
+ &H5P_LST_GROUP_ACCESS_ID_g, /* Pointer to default property list ID */
NULL, /* Default property registration routine */
+
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
NULL, /* Class copy callback */
@@ -173,10 +196,13 @@ const H5P_libclass_t H5P_CLS_GACC[1] = {{
const H5P_libclass_t H5P_CLS_TCRT[1] = {{
"datatype create", /* Class name for debugging */
H5P_TYPE_DATATYPE_CREATE, /* Class type */
- &H5P_CLS_OBJECT_CREATE_g, /* Parent class ID */
- &H5P_CLS_DATATYPE_CREATE_g, /* Pointer to class ID */
- &H5P_LST_DATATYPE_CREATE_g, /* Pointer to default property list ID */
+
+ &H5P_CLS_OBJECT_CREATE_g, /* Parent class */
+ &H5P_CLS_DATATYPE_CREATE_g, /* Pointer to class */
+ &H5P_CLS_DATATYPE_CREATE_ID_g, /* Pointer to class ID */
+ &H5P_LST_DATATYPE_CREATE_ID_g, /* Pointer to default property list ID */
NULL, /* Default property registration routine */
+
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
NULL, /* Class copy callback */
@@ -190,10 +216,13 @@ const H5P_libclass_t H5P_CLS_TCRT[1] = {{
const H5P_libclass_t H5P_CLS_TACC[1] = {{
"datatype access", /* Class name for debugging */
H5P_TYPE_DATATYPE_ACCESS, /* Class type */
- &H5P_CLS_LINK_ACCESS_g, /* Parent class ID */
- &H5P_CLS_DATATYPE_ACCESS_g, /* Pointer to class ID */
- &H5P_LST_DATATYPE_ACCESS_g, /* Pointer to default property list ID */
+
+ &H5P_CLS_LINK_ACCESS_g, /* Parent class */
+ &H5P_CLS_DATATYPE_ACCESS_g, /* Pointer to class */
+ &H5P_CLS_DATATYPE_ACCESS_ID_g, /* Pointer to class ID */
+ &H5P_LST_DATATYPE_ACCESS_ID_g, /* Pointer to default property list ID */
NULL, /* Default property registration routine */
+
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
NULL, /* Class copy callback */
@@ -425,37 +454,27 @@ H5P_init_interface(void)
/* Check if the current class hasn't been initialized and can be now */
HDassert(lib_class->class_id);
- if(*lib_class->class_id == (-1) && (lib_class->par_class_id == NULL
- || *lib_class->par_class_id > 0)) {
- H5P_genclass_t *par_pclass = NULL; /* Parent class of new class */
- H5P_genclass_t *new_pclass; /* New property list class created */
-
+ if(*lib_class->class_id == (-1) && (lib_class->par_pclass == NULL
+ || *lib_class->par_pclass != NULL)) {
/* Sanity check - only the root class is not allowed to have a parent class */
- HDassert(lib_class->par_class_id || lib_class == H5P_CLS_ROOT);
-
- /* Check for parent class */
- if(lib_class->par_class_id) {
- /* Get the pointer to the parent class */
- if(NULL == (par_pclass = (H5P_genclass_t *)H5I_object(*lib_class->par_class_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
- } /* end if */
+ HDassert(lib_class->par_pclass || lib_class == H5P_CLS_ROOT);
/* Allocate the new class */
- if(NULL == (new_pclass = H5P_create_class(par_pclass, lib_class->name, lib_class->type, lib_class->create_func, lib_class->create_data, lib_class->copy_func, lib_class->copy_data, lib_class->close_func, lib_class->close_data)))
+ if(NULL == (*lib_class->pclass = H5P_create_class(lib_class->par_pclass ? *lib_class->par_pclass : NULL, lib_class->name, lib_class->type, lib_class->create_func, lib_class->create_data, lib_class->copy_func, lib_class->copy_data, lib_class->close_func, lib_class->close_data)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed")
/* Call routine to register properties for class */
- if(lib_class->reg_prop_func && (*lib_class->reg_prop_func)(new_pclass) < 0)
+ if(lib_class->reg_prop_func && (*lib_class->reg_prop_func)(*lib_class->pclass) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register properties")
/* Register the new class */
- if((*lib_class->class_id = H5I_register(H5I_GENPROP_CLS, new_pclass, FALSE)) < 0)
+ if((*lib_class->class_id = H5I_register(H5I_GENPROP_CLS, *lib_class->pclass, FALSE)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class")
/* Only register the default property list if it hasn't been created yet */
if(lib_class->def_plist_id && *lib_class->def_plist_id == (-1)) {
/* Register the default property list for the new class*/
- if((*lib_class->def_plist_id = H5P_create_id(new_pclass, FALSE)) < 0)
+ if((*lib_class->def_plist_id = H5P_create_id(*lib_class->pclass, FALSE)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register default property list for class")
} /* end if */
@@ -516,20 +535,20 @@ H5P_term_interface(void)
/* Reset the default property lists, if they've been closed */
if(H5I_nmembers(H5I_GENPROP_LST)==0) {
- H5P_LST_FILE_CREATE_g =
- H5P_LST_FILE_ACCESS_g =
- H5P_LST_DATASET_CREATE_g =
- H5P_LST_DATASET_ACCESS_g =
- H5P_LST_DATASET_XFER_g =
- H5P_LST_GROUP_CREATE_g =
- H5P_LST_GROUP_ACCESS_g =
- H5P_LST_DATATYPE_CREATE_g =
- H5P_LST_DATATYPE_ACCESS_g =
- H5P_LST_ATTRIBUTE_CREATE_g =
- H5P_LST_OBJECT_COPY_g =
- H5P_LST_LINK_CREATE_g =
- H5P_LST_LINK_ACCESS_g =
- H5P_LST_FILE_MOUNT_g = (-1);
+ H5P_LST_FILE_CREATE_ID_g =
+ H5P_LST_FILE_ACCESS_ID_g =
+ H5P_LST_DATASET_CREATE_ID_g =
+ H5P_LST_DATASET_ACCESS_ID_g =
+ H5P_LST_DATASET_XFER_ID_g =
+ H5P_LST_GROUP_CREATE_ID_g =
+ H5P_LST_GROUP_ACCESS_ID_g =
+ H5P_LST_DATATYPE_CREATE_ID_g =
+ H5P_LST_DATATYPE_ACCESS_ID_g =
+ H5P_LST_ATTRIBUTE_CREATE_ID_g =
+ H5P_LST_OBJECT_COPY_ID_g =
+ H5P_LST_LINK_CREATE_ID_g =
+ H5P_LST_LINK_ACCESS_ID_g =
+ H5P_LST_FILE_MOUNT_ID_g = (-1);
} /* end if */
} /* end if */
@@ -555,7 +574,25 @@ H5P_term_interface(void)
H5P_CLS_OBJECT_COPY_g =
H5P_CLS_LINK_CREATE_g =
H5P_CLS_LINK_ACCESS_g =
- H5P_CLS_FILE_MOUNT_g = (-1);
+ H5P_CLS_FILE_MOUNT_g = NULL;
+
+ H5P_CLS_ROOT_ID_g =
+ H5P_CLS_OBJECT_CREATE_ID_g =
+ H5P_CLS_FILE_CREATE_ID_g =
+ H5P_CLS_FILE_ACCESS_ID_g =
+ H5P_CLS_DATASET_CREATE_ID_g =
+ H5P_CLS_DATASET_ACCESS_ID_g =
+ H5P_CLS_DATASET_XFER_ID_g =
+ H5P_CLS_GROUP_CREATE_ID_g =
+ H5P_CLS_GROUP_ACCESS_ID_g =
+ H5P_CLS_DATATYPE_CREATE_ID_g =
+ H5P_CLS_DATATYPE_ACCESS_ID_g =
+ H5P_CLS_STRING_CREATE_ID_g =
+ H5P_CLS_ATTRIBUTE_CREATE_ID_g =
+ H5P_CLS_OBJECT_COPY_ID_g =
+ H5P_CLS_LINK_CREATE_ID_g =
+ H5P_CLS_LINK_ACCESS_ID_g =
+ H5P_CLS_FILE_MOUNT_ID_g = (-1);
} /* end if */
} /* end if */
} else {
@@ -2784,41 +2821,6 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5P_get_class
- PURPOSE
- Internal routine to query the class of a generic property list
- USAGE
- H5P_genclass_t *H5P_get_class(plist)
- H5P_genplist_t *plist; IN: Property list to check
- RETURNS
- Success: Pointer to the class for a property list
- Failure: NULL
- DESCRIPTION
- This routine retrieves a pointer to the class for a property list.
-
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-H5P_genclass_t *
-H5P_get_class(const H5P_genplist_t *plist)
-{
- H5P_genclass_t *ret_value; /* return value */
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- HDassert(plist);
-
- /* Get property size */
- ret_value = plist->pclass;
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_get_class() */
-
-
-/*--------------------------------------------------------------------------
- NAME
H5P_get_nprops_plist
PURPOSE
Internal routine to query the number of properties in a property list
@@ -3239,12 +3241,12 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5P_isa_class_real
+ H5P_class_isa
PURPOSE
Internal routine to query whether a property class is the same as another
class.
USAGE
- htri_t H5P_isa_class_real(pclass1, pclass2)
+ htri_t H5P_class_isa(pclass1, pclass2)
H5P_genclass_t *pclass1; IN: Property class to check
H5P_genclass_t *pclass2; IN: Property class to compare with
RETURNS
@@ -3260,12 +3262,12 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static htri_t
-H5P_isa_class_real(H5P_genclass_t *pclass1, H5P_genclass_t *pclass2)
+htri_t
+H5P_class_isa(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2)
{
htri_t ret_value;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_NOAPI(FAIL)
HDassert(pclass1);
HDassert(pclass2);
@@ -3276,14 +3278,14 @@ H5P_isa_class_real(H5P_genclass_t *pclass1, H5P_genclass_t *pclass2)
} else {
/* Check if the class is derived, and walk up the chain, if so */
if(pclass1->parent != NULL)
- ret_value = H5P_isa_class_real(pclass1->parent, pclass2);
+ ret_value = H5P_class_isa(pclass1->parent, pclass2);
else
HGOTO_DONE(FALSE);
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_isa_class_real() */
+} /* H5P_class_isa() */
/*--------------------------------------------------------------------------
@@ -3327,7 +3329,7 @@ H5P_isa_class(hid_t plist_id, hid_t pclass_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class")
/* Compare the property list's class against the other class */
- if((ret_value = H5P_isa_class_real(plist->pclass, pclass)) < 0)
+ if((ret_value = H5P_class_isa(plist->pclass, pclass)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to compare property list classes")
done:
@@ -4871,3 +4873,59 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5P_close_class() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5P_get_plist_id
+ *
+ * Purpose: Quick and dirty routine to retrieve property list ID from
+ * property list structure.
+ * (Mainly added to stop non-file routines from poking about in the
+ * H5P_genplist_t data structure)
+ *
+ * Return: Success: Non-negative ID of property list.
+ * Failure: negative.
+ *
+ * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * April 22, 2014
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5P_get_plist_id(const H5P_genplist_t *plist)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(plist);
+
+ FUNC_LEAVE_NOAPI(plist->plist_id)
+} /* end H5P_get_plist_id() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P_get_class
+ *
+ * Purpose: Quick and dirty routine to retrieve property list class from
+ * property list structure.
+ * (Mainly added to stop non-file routines from poking about in the
+ * H5P_genplist_t data structure)
+ *
+ * Return: Success: Non-NULL class of property list.
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * April 22, 2014
+ *
+ *-------------------------------------------------------------------------
+ */
+H5P_genclass_t *
+H5P_get_class(const H5P_genplist_t *plist)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(plist);
+
+ FUNC_LEAVE_NOAPI(plist->pclass)
+} /* end H5P_get_class() */
+
diff --git a/src/H5Plapl.c b/src/H5Plapl.c
index 0697130..25ae661 100644
--- a/src/H5Plapl.c
+++ b/src/H5Plapl.c
@@ -110,10 +110,13 @@ static herr_t H5P_lacc_elink_fapl_close(const char* name, size_t size, void* val
const H5P_libclass_t H5P_CLS_LACC[1] = {{
"link access", /* Class name for debugging */
H5P_TYPE_LINK_ACCESS, /* Class type */
- &H5P_CLS_ROOT_g, /* Parent class ID */
- &H5P_CLS_LINK_ACCESS_g, /* Pointer to class ID */
- &H5P_LST_LINK_ACCESS_g, /* Pointer to default property list ID */
+
+ &H5P_CLS_ROOT_g, /* Parent class */
+ &H5P_CLS_LINK_ACCESS_g, /* Pointer to class */
+ &H5P_CLS_LINK_ACCESS_ID_g, /* Pointer to class ID */
+ &H5P_LST_LINK_ACCESS_ID_g, /* Pointer to default property list ID */
H5P_lacc_reg_prop, /* Default property registration routine */
+
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
NULL, /* Class copy callback */
diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c
index b327df9..21ee74b 100644
--- a/src/H5Plcpl.c
+++ b/src/H5Plcpl.c
@@ -76,10 +76,13 @@ static herr_t H5P_lcrt_reg_prop(H5P_genclass_t *pclass);
const H5P_libclass_t H5P_CLS_LCRT[1] = {{
"link create", /* Class name for debugging */
H5P_TYPE_LINK_CREATE, /* Class type */
- &H5P_CLS_STRING_CREATE_g, /* Parent class ID */
- &H5P_CLS_LINK_CREATE_g, /* Pointer to class ID */
- &H5P_LST_LINK_CREATE_g, /* Pointer to default property list ID */
+
+ &H5P_CLS_STRING_CREATE_g, /* Parent class */
+ &H5P_CLS_LINK_CREATE_g, /* Pointer to class */
+ &H5P_CLS_LINK_CREATE_ID_g, /* Pointer to class ID */
+ &H5P_LST_LINK_CREATE_ID_g, /* Pointer to default property list ID */
H5P_lcrt_reg_prop, /* Default property registration routine */
+
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
NULL, /* Class copy callback */
diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c
index 381dae4..838931c 100644
--- a/src/H5Pocpl.c
+++ b/src/H5Pocpl.c
@@ -93,10 +93,13 @@ static herr_t H5P__set_filter(H5P_genplist_t *plist, H5Z_filter_t filter,
const H5P_libclass_t H5P_CLS_OCRT[1] = {{
"object create", /* Class name for debugging */
H5P_TYPE_OBJECT_CREATE, /* Class type */
- &H5P_CLS_ROOT_g, /* Parent class ID */
- &H5P_CLS_OBJECT_CREATE_g, /* Pointer to class ID */
+
+ &H5P_CLS_ROOT_g, /* Parent class */
+ &H5P_CLS_OBJECT_CREATE_g, /* Pointer to class */
+ &H5P_CLS_OBJECT_CREATE_ID_g, /* Pointer to class ID */
NULL, /* Pointer to default property list ID */
H5P__ocrt_reg_prop, /* Default property registration routine */
+
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
H5P__ocrt_copy, /* Class copy callback */
diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c
index 0ba5625..895c8fe 100644
--- a/src/H5Pocpypl.c
+++ b/src/H5Pocpypl.c
@@ -38,6 +38,7 @@
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
+#include "H5Oprivate.h" /* Object headers */
#include "H5Ppkg.h" /* Property lists */
@@ -94,10 +95,13 @@ static herr_t H5P__ocpy_merge_comm_dt_list_close(const char* name, size_t size,
const H5P_libclass_t H5P_CLS_OCPY[1] = {{
"object copy", /* Class name for debugging */
H5P_TYPE_OBJECT_COPY, /* Class type */
- &H5P_CLS_ROOT_g, /* Parent class ID */
- &H5P_CLS_OBJECT_COPY_g, /* Pointer to class ID */
- &H5P_LST_OBJECT_COPY_g, /* Pointer to default property list ID */
+
+ &H5P_CLS_ROOT_g, /* Parent class */
+ &H5P_CLS_OBJECT_COPY_g, /* Pointer to class */
+ &H5P_CLS_OBJECT_COPY_ID_g, /* Pointer to class ID */
+ &H5P_LST_OBJECT_COPY_ID_g, /* Pointer to default property list ID */
H5P__ocpy_reg_prop, /* Default property registration routine */
+
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
NULL, /* Class copy callback */
diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h
index 293420e..44ef473 100644
--- a/src/H5Ppkg.h
+++ b/src/H5Ppkg.h
@@ -125,7 +125,8 @@ typedef struct H5P_libclass_t {
const char *name; /* Class name */
H5P_plist_type_t type; /* Class type */
- hid_t const * const par_class_id; /* Pointer to global parent class property list class ID */
+ H5P_genclass_t * * par_pclass; /* Pointer to global parent class property list class */
+ H5P_genclass_t * * pclass; /* Pointer to global property list class */
hid_t * const class_id; /* Pointer to global property list class ID */
hid_t * const def_plist_id; /* Pointer to global default property list ID */
H5P_reg_prop_func_t reg_prop_func; /* Register class's properties */
@@ -142,6 +143,9 @@ typedef struct H5P_libclass_t {
/* Property list/class iterator callback function pointer */
typedef int (*H5P_iterate_int_t)(H5P_genprop_t *prop, void *udata);
+/* Forward declarations (for prototypes & struct definitions) */
+struct H5Z_filter_info_t;
+
/*****************************/
/* Package Private Variables */
/*****************************/
@@ -177,7 +181,6 @@ H5_DLL herr_t H5P_get_size_plist(const H5P_genplist_t *plist, const char *name,
size_t *size);
H5_DLL herr_t H5P_get_size_pclass(H5P_genclass_t *pclass, const char *name,
size_t *size);
-H5_DLL H5P_genclass_t *H5P_get_class(const H5P_genplist_t *plist);
H5_DLL herr_t H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops);
H5_DLL int H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2);
H5_DLL herr_t H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2,
@@ -193,10 +196,12 @@ H5_DLL char *H5P_get_class_path(H5P_genclass_t *pclass);
H5_DLL H5P_genclass_t *H5P_open_class_path(const char *path);
H5_DLL H5P_genclass_t *H5P_get_class_parent(const H5P_genclass_t *pclass);
H5_DLL herr_t H5P_close_class(void *_pclass);
-H5_DLL herr_t H5P_get_filter(const H5Z_filter_info_t *filter,
+H5_DLL H5P_genprop_t *H5P__find_prop_plist(const H5P_genplist_t *plist, const char *name);
+
+/* Private OCPL routines */
+H5_DLL herr_t H5P_get_filter(const struct 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);
/* Testing functions */
#ifdef H5P_TESTING
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index 72157dc..542fd52 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -24,7 +24,6 @@
/* Private headers needed by this file */
#include "H5private.h" /* Generic Functions */
-#include "H5Oprivate.h" /* Object headers */
/**************************/
/* Library Private Macros */
@@ -33,11 +32,24 @@
/* ======== String creation property names ======== */
#define H5P_STRCRT_CHAR_ENCODING_NAME "character_encoding" /* Character set encoding for string */
+/* If the module using this macro is allowed access to the private variables, access them directly */
+#ifdef H5P_PACKAGE
+#define H5P_PLIST_ID(P) ((P)->plist_id)
+#define H5P_CLASS(P) ((P)->pclass)
+#else /* H5F_PACKAGE */
+#define H5P_PLIST_ID(P) (H5P_get_plist_id(P))
+#define H5P_CLASS(P) (H5P_get_class(P))
+#endif /* H5P_PACKAGE */
+
/****************************/
/* Library Private Typedefs */
/****************************/
+/* Forward declarations (for prototypes & type definitions) */
+struct H5O_fill_t;
+struct H5T_t;
+
/* Forward declarations for anonymous H5P objects */
typedef struct H5P_genplist_t H5P_genplist_t;
typedef struct H5P_genclass_t H5P_genclass_t;
@@ -68,6 +80,25 @@ typedef enum H5P_plist_type_t {
/* Library Private Variables */
/*****************************/
+/* Predefined property list classes. */
+H5_DLLVAR H5P_genclass_t *H5P_CLS_ROOT_g;
+H5_DLLVAR H5P_genclass_t *H5P_CLS_OBJECT_CREATE_g;
+H5_DLLVAR H5P_genclass_t *H5P_CLS_FILE_CREATE_g;
+H5_DLLVAR H5P_genclass_t *H5P_CLS_FILE_ACCESS_g;
+H5_DLLVAR H5P_genclass_t *H5P_CLS_DATASET_CREATE_g;
+H5_DLLVAR H5P_genclass_t *H5P_CLS_DATASET_ACCESS_g;
+H5_DLLVAR H5P_genclass_t *H5P_CLS_DATASET_XFER_g;
+H5_DLLVAR H5P_genclass_t *H5P_CLS_FILE_MOUNT_g;
+H5_DLLVAR H5P_genclass_t *H5P_CLS_GROUP_CREATE_g;
+H5_DLLVAR H5P_genclass_t *H5P_CLS_GROUP_ACCESS_g;
+H5_DLLVAR H5P_genclass_t *H5P_CLS_DATATYPE_CREATE_g;
+H5_DLLVAR H5P_genclass_t *H5P_CLS_DATATYPE_ACCESS_g;
+H5_DLLVAR H5P_genclass_t *H5P_CLS_ATTRIBUTE_CREATE_g;
+H5_DLLVAR H5P_genclass_t *H5P_CLS_OBJECT_COPY_g;
+H5_DLLVAR H5P_genclass_t *H5P_CLS_LINK_CREATE_g;
+H5_DLLVAR H5P_genclass_t *H5P_CLS_LINK_ACCESS_g;
+H5_DLLVAR H5P_genclass_t *H5P_CLS_STRING_CREATE_g;
+
/******************************/
/* Library Private Prototypes */
@@ -88,6 +119,7 @@ H5_DLL herr_t H5P_insert(H5P_genplist_t *plist, const char *name, size_t size,
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);
H5_DLL htri_t H5P_exist_plist(const H5P_genplist_t *plist, const char *name);
+H5_DLL htri_t H5P_class_isa(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2);
H5_DLL char *H5P_get_class_name(H5P_genclass_t *pclass);
H5_DLL herr_t H5P_get_nprops_pclass(const H5P_genclass_t *pclass, size_t *nprops,
hbool_t recurse);
@@ -98,7 +130,7 @@ H5_DLL herr_t H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id,
H5_DLL herr_t H5P_set_vlen_mem_manager(H5P_genplist_t *plist,
H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func,
void *free_info);
-H5_DLL herr_t H5P_is_fill_value_defined(const H5O_fill_t *fill,
+H5_DLL herr_t H5P_is_fill_value_defined(const struct H5O_fill_t *fill,
H5D_fill_value_t *status);
H5_DLL int H5P_fill_value_cmp(const void *value1, const void *value2,
size_t size);
@@ -109,6 +141,10 @@ H5_DLL herr_t H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id,
size_t namelen, char name[], unsigned *filter_config);
H5_DLL htri_t H5P_filter_in_pline(H5P_genplist_t *plist, H5Z_filter_t id);
+/* Query internal fields of the property list struct */
+H5_DLL hid_t H5P_get_plist_id(const H5P_genplist_t *plist);
+H5_DLL H5P_genclass_t *H5P_get_class(const H5P_genplist_t *plist);
+
/* *SPECIAL* Don't make more of these! -QAK */
H5_DLL htri_t H5P_isa_class(hid_t plist_id, hid_t pclass_id);
H5_DLL H5P_genplist_t *H5P_object_verify(hid_t plist_id, hid_t pclass_id);
@@ -122,7 +158,7 @@ H5_DLL size_t H5P_peek_size_t(H5P_genplist_t *plist, const char *name);
/* Private DCPL routines */
H5_DLL herr_t H5P_fill_value_defined(H5P_genplist_t *plist,
H5D_fill_value_t *status);
-H5_DLL herr_t H5P_get_fill_value(H5P_genplist_t *plist, H5T_t *type,
+H5_DLL herr_t H5P_get_fill_value(H5P_genplist_t *plist, const struct H5T_t *type,
void *value, hid_t dxpl_id);
#endif /* _H5Pprivate_H */
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 1d8ced4..5c358ec 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -52,41 +52,41 @@
* The library's property list classes
*/
-#define H5P_ROOT (H5OPEN H5P_CLS_ROOT_g)
-#define H5P_OBJECT_CREATE (H5OPEN H5P_CLS_OBJECT_CREATE_g)
-#define H5P_FILE_CREATE (H5OPEN H5P_CLS_FILE_CREATE_g)
-#define H5P_FILE_ACCESS (H5OPEN H5P_CLS_FILE_ACCESS_g)
-#define H5P_DATASET_CREATE (H5OPEN H5P_CLS_DATASET_CREATE_g)
-#define H5P_DATASET_ACCESS (H5OPEN H5P_CLS_DATASET_ACCESS_g)
-#define H5P_DATASET_XFER (H5OPEN H5P_CLS_DATASET_XFER_g)
-#define H5P_FILE_MOUNT (H5OPEN H5P_CLS_FILE_MOUNT_g)
-#define H5P_GROUP_CREATE (H5OPEN H5P_CLS_GROUP_CREATE_g)
-#define H5P_GROUP_ACCESS (H5OPEN H5P_CLS_GROUP_ACCESS_g)
-#define H5P_DATATYPE_CREATE (H5OPEN H5P_CLS_DATATYPE_CREATE_g)
-#define H5P_DATATYPE_ACCESS (H5OPEN H5P_CLS_DATATYPE_ACCESS_g)
-#define H5P_STRING_CREATE (H5OPEN H5P_CLS_STRING_CREATE_g)
-#define H5P_ATTRIBUTE_CREATE (H5OPEN H5P_CLS_ATTRIBUTE_CREATE_g)
-#define H5P_OBJECT_COPY (H5OPEN H5P_CLS_OBJECT_COPY_g)
-#define H5P_LINK_CREATE (H5OPEN H5P_CLS_LINK_CREATE_g)
-#define H5P_LINK_ACCESS (H5OPEN H5P_CLS_LINK_ACCESS_g)
+#define H5P_ROOT (H5OPEN H5P_CLS_ROOT_ID_g)
+#define H5P_OBJECT_CREATE (H5OPEN H5P_CLS_OBJECT_CREATE_ID_g)
+#define H5P_FILE_CREATE (H5OPEN H5P_CLS_FILE_CREATE_ID_g)
+#define H5P_FILE_ACCESS (H5OPEN H5P_CLS_FILE_ACCESS_ID_g)
+#define H5P_DATASET_CREATE (H5OPEN H5P_CLS_DATASET_CREATE_ID_g)
+#define H5P_DATASET_ACCESS (H5OPEN H5P_CLS_DATASET_ACCESS_ID_g)
+#define H5P_DATASET_XFER (H5OPEN H5P_CLS_DATASET_XFER_ID_g)
+#define H5P_FILE_MOUNT (H5OPEN H5P_CLS_FILE_MOUNT_ID_g)
+#define H5P_GROUP_CREATE (H5OPEN H5P_CLS_GROUP_CREATE_ID_g)
+#define H5P_GROUP_ACCESS (H5OPEN H5P_CLS_GROUP_ACCESS_ID_g)
+#define H5P_DATATYPE_CREATE (H5OPEN H5P_CLS_DATATYPE_CREATE_ID_g)
+#define H5P_DATATYPE_ACCESS (H5OPEN H5P_CLS_DATATYPE_ACCESS_ID_g)
+#define H5P_STRING_CREATE (H5OPEN H5P_CLS_STRING_CREATE_ID_g)
+#define H5P_ATTRIBUTE_CREATE (H5OPEN H5P_CLS_ATTRIBUTE_CREATE_ID_g)
+#define H5P_OBJECT_COPY (H5OPEN H5P_CLS_OBJECT_COPY_ID_g)
+#define H5P_LINK_CREATE (H5OPEN H5P_CLS_LINK_CREATE_ID_g)
+#define H5P_LINK_ACCESS (H5OPEN H5P_CLS_LINK_ACCESS_ID_g)
/*
* The library's default property lists
*/
-#define H5P_FILE_CREATE_DEFAULT (H5OPEN H5P_LST_FILE_CREATE_g)
-#define H5P_FILE_ACCESS_DEFAULT (H5OPEN H5P_LST_FILE_ACCESS_g)
-#define H5P_DATASET_CREATE_DEFAULT (H5OPEN H5P_LST_DATASET_CREATE_g)
-#define H5P_DATASET_ACCESS_DEFAULT (H5OPEN H5P_LST_DATASET_ACCESS_g)
-#define H5P_DATASET_XFER_DEFAULT (H5OPEN H5P_LST_DATASET_XFER_g)
-#define H5P_FILE_MOUNT_DEFAULT (H5OPEN H5P_LST_FILE_MOUNT_g)
-#define H5P_GROUP_CREATE_DEFAULT (H5OPEN H5P_LST_GROUP_CREATE_g)
-#define H5P_GROUP_ACCESS_DEFAULT (H5OPEN H5P_LST_GROUP_ACCESS_g)
-#define H5P_DATATYPE_CREATE_DEFAULT (H5OPEN H5P_LST_DATATYPE_CREATE_g)
-#define H5P_DATATYPE_ACCESS_DEFAULT (H5OPEN H5P_LST_DATATYPE_ACCESS_g)
-#define H5P_ATTRIBUTE_CREATE_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_CREATE_g)
-#define H5P_OBJECT_COPY_DEFAULT (H5OPEN H5P_LST_OBJECT_COPY_g)
-#define H5P_LINK_CREATE_DEFAULT (H5OPEN H5P_LST_LINK_CREATE_g)
-#define H5P_LINK_ACCESS_DEFAULT (H5OPEN H5P_LST_LINK_ACCESS_g)
+#define H5P_FILE_CREATE_DEFAULT (H5OPEN H5P_LST_FILE_CREATE_ID_g)
+#define H5P_FILE_ACCESS_DEFAULT (H5OPEN H5P_LST_FILE_ACCESS_ID_g)
+#define H5P_DATASET_CREATE_DEFAULT (H5OPEN H5P_LST_DATASET_CREATE_ID_g)
+#define H5P_DATASET_ACCESS_DEFAULT (H5OPEN H5P_LST_DATASET_ACCESS_ID_g)
+#define H5P_DATASET_XFER_DEFAULT (H5OPEN H5P_LST_DATASET_XFER_ID_g)
+#define H5P_FILE_MOUNT_DEFAULT (H5OPEN H5P_LST_FILE_MOUNT_ID_g)
+#define H5P_GROUP_CREATE_DEFAULT (H5OPEN H5P_LST_GROUP_CREATE_ID_g)
+#define H5P_GROUP_ACCESS_DEFAULT (H5OPEN H5P_LST_GROUP_ACCESS_ID_g)
+#define H5P_DATATYPE_CREATE_DEFAULT (H5OPEN H5P_LST_DATATYPE_CREATE_ID_g)
+#define H5P_DATATYPE_ACCESS_DEFAULT (H5OPEN H5P_LST_DATATYPE_ACCESS_ID_g)
+#define H5P_ATTRIBUTE_CREATE_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_CREATE_ID_g)
+#define H5P_OBJECT_COPY_DEFAULT (H5OPEN H5P_LST_OBJECT_COPY_ID_g)
+#define H5P_LINK_CREATE_DEFAULT (H5OPEN H5P_LST_LINK_CREATE_ID_g)
+#define H5P_LINK_ACCESS_DEFAULT (H5OPEN H5P_LST_LINK_ACCESS_ID_g)
/* Common creation order flags (for links in groups and attributes on objects) */
#define H5P_CRT_ORDER_TRACKED 0x0001
@@ -170,40 +170,40 @@ typedef enum H5D_mpio_no_collective_cause_t {
/* Property list class IDs */
/* (Internal to library, do not use! Use macros above) */
-H5_DLLVAR hid_t H5P_CLS_ROOT_g;
-H5_DLLVAR hid_t H5P_CLS_OBJECT_CREATE_g;
-H5_DLLVAR hid_t H5P_CLS_FILE_CREATE_g;
-H5_DLLVAR hid_t H5P_CLS_FILE_ACCESS_g;
-H5_DLLVAR hid_t H5P_CLS_DATASET_CREATE_g;
-H5_DLLVAR hid_t H5P_CLS_DATASET_ACCESS_g;
-H5_DLLVAR hid_t H5P_CLS_DATASET_XFER_g;
-H5_DLLVAR hid_t H5P_CLS_FILE_MOUNT_g;
-H5_DLLVAR hid_t H5P_CLS_GROUP_CREATE_g;
-H5_DLLVAR hid_t H5P_CLS_GROUP_ACCESS_g;
-H5_DLLVAR hid_t H5P_CLS_DATATYPE_CREATE_g;
-H5_DLLVAR hid_t H5P_CLS_DATATYPE_ACCESS_g;
-H5_DLLVAR hid_t H5P_CLS_STRING_CREATE_g;
-H5_DLLVAR hid_t H5P_CLS_ATTRIBUTE_CREATE_g;
-H5_DLLVAR hid_t H5P_CLS_OBJECT_COPY_g;
-H5_DLLVAR hid_t H5P_CLS_LINK_CREATE_g;
-H5_DLLVAR hid_t H5P_CLS_LINK_ACCESS_g;
+H5_DLLVAR hid_t H5P_CLS_ROOT_ID_g;
+H5_DLLVAR hid_t H5P_CLS_OBJECT_CREATE_ID_g;
+H5_DLLVAR hid_t H5P_CLS_FILE_CREATE_ID_g;
+H5_DLLVAR hid_t H5P_CLS_FILE_ACCESS_ID_g;
+H5_DLLVAR hid_t H5P_CLS_DATASET_CREATE_ID_g;
+H5_DLLVAR hid_t H5P_CLS_DATASET_ACCESS_ID_g;
+H5_DLLVAR hid_t H5P_CLS_DATASET_XFER_ID_g;
+H5_DLLVAR hid_t H5P_CLS_FILE_MOUNT_ID_g;
+H5_DLLVAR hid_t H5P_CLS_GROUP_CREATE_ID_g;
+H5_DLLVAR hid_t H5P_CLS_GROUP_ACCESS_ID_g;
+H5_DLLVAR hid_t H5P_CLS_DATATYPE_CREATE_ID_g;
+H5_DLLVAR hid_t H5P_CLS_DATATYPE_ACCESS_ID_g;
+H5_DLLVAR hid_t H5P_CLS_STRING_CREATE_ID_g;
+H5_DLLVAR hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g;
+H5_DLLVAR hid_t H5P_CLS_OBJECT_COPY_ID_g;
+H5_DLLVAR hid_t H5P_CLS_LINK_CREATE_ID_g;
+H5_DLLVAR hid_t H5P_CLS_LINK_ACCESS_ID_g;
/* Default roperty list IDs */
/* (Internal to library, do not use! Use macros above) */
-H5_DLLVAR hid_t H5P_LST_FILE_CREATE_g;
-H5_DLLVAR hid_t H5P_LST_FILE_ACCESS_g;
-H5_DLLVAR hid_t H5P_LST_DATASET_CREATE_g;
-H5_DLLVAR hid_t H5P_LST_DATASET_ACCESS_g;
-H5_DLLVAR hid_t H5P_LST_DATASET_XFER_g;
-H5_DLLVAR hid_t H5P_LST_FILE_MOUNT_g;
-H5_DLLVAR hid_t H5P_LST_GROUP_CREATE_g;
-H5_DLLVAR hid_t H5P_LST_GROUP_ACCESS_g;
-H5_DLLVAR hid_t H5P_LST_DATATYPE_CREATE_g;
-H5_DLLVAR hid_t H5P_LST_DATATYPE_ACCESS_g;
-H5_DLLVAR hid_t H5P_LST_ATTRIBUTE_CREATE_g;
-H5_DLLVAR hid_t H5P_LST_OBJECT_COPY_g;
-H5_DLLVAR hid_t H5P_LST_LINK_CREATE_g;
-H5_DLLVAR hid_t H5P_LST_LINK_ACCESS_g;
+H5_DLLVAR hid_t H5P_LST_FILE_CREATE_ID_g;
+H5_DLLVAR hid_t H5P_LST_FILE_ACCESS_ID_g;
+H5_DLLVAR hid_t H5P_LST_DATASET_CREATE_ID_g;
+H5_DLLVAR hid_t H5P_LST_DATASET_ACCESS_ID_g;
+H5_DLLVAR hid_t H5P_LST_DATASET_XFER_ID_g;
+H5_DLLVAR hid_t H5P_LST_FILE_MOUNT_ID_g;
+H5_DLLVAR hid_t H5P_LST_GROUP_CREATE_ID_g;
+H5_DLLVAR hid_t H5P_LST_GROUP_ACCESS_ID_g;
+H5_DLLVAR hid_t H5P_LST_DATATYPE_CREATE_ID_g;
+H5_DLLVAR hid_t H5P_LST_DATATYPE_ACCESS_ID_g;
+H5_DLLVAR hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g;
+H5_DLLVAR hid_t H5P_LST_OBJECT_COPY_ID_g;
+H5_DLLVAR hid_t H5P_LST_LINK_CREATE_ID_g;
+H5_DLLVAR hid_t H5P_LST_LINK_ACCESS_ID_g;
/*********************/
/* Public Prototypes */
diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c
index 505e35f..cc845af 100644
--- a/src/H5Pstrcpl.c
+++ b/src/H5Pstrcpl.c
@@ -34,6 +34,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
#include "H5Iprivate.h" /* IDs */
#include "H5Ppkg.h" /* Property lists */
@@ -74,10 +75,13 @@ static herr_t H5P__strcrt_reg_prop(H5P_genclass_t *pclass);
const H5P_libclass_t H5P_CLS_STRCRT[1] = {{
"string create", /* Class name for debugging */
H5P_TYPE_STRING_CREATE, /* Class type */
- &H5P_CLS_ROOT_g, /* Parent class ID */
- &H5P_CLS_STRING_CREATE_g, /* Pointer to class ID */
+
+ &H5P_CLS_ROOT_g, /* Parent class */
+ &H5P_CLS_STRING_CREATE_g, /* Pointer to class */
+ &H5P_CLS_STRING_CREATE_ID_g, /* Pointer to class ID */
NULL, /* Pointer to default property list ID */
H5P__strcrt_reg_prop, /* Default property registration routine */
+
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
NULL, /* Class copy callback */
diff --git a/src/H5T.c b/src/H5T.c
index b82bc1d..98ec0d1 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -772,7 +772,6 @@ H5T_init_interface(void)
hsize_t dim[1]={1}; /* Dimension info for array datatype */
herr_t status;
unsigned copied_dtype=1; /* Flag to indicate whether datatype was copied or allocated (for error cleanup) */
- H5P_genclass_t *crt_pclass; /* Property list class for datatype creation properties */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1351,21 +1350,17 @@ H5T_init_interface(void)
if (status<0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to register conversion function(s)")
- /* ========== Datatype Creation Property Class Initialization ============*/
- HDassert(H5P_CLS_DATATYPE_CREATE_g!=-1);
-
- /* Get the pointer to group creation class */
- if(NULL == (crt_pclass = (H5P_genclass_t *)H5I_object(H5P_CLS_DATATYPE_CREATE_g)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
-
/* Register datatype creation property class properties here. See similar
* code in H5D_init_interface(), etc. for example.
*/
/* Only register the default property list if it hasn't been created yet */
- if(H5P_LST_DATATYPE_CREATE_g == (-1)) {
+ if(H5P_LST_DATATYPE_CREATE_ID_g == (-1)) {
+ /* ========== Datatype Creation Property Class Initialization ============*/
+ HDassert(H5P_CLS_DATATYPE_CREATE_g != NULL);
+
/* Register the default datatype creation property list */
- if((H5P_LST_DATATYPE_CREATE_g = H5P_create_id(crt_pclass, FALSE)) < 0)
+ if((H5P_LST_DATATYPE_CREATE_ID_g = H5P_create_id(H5P_CLS_DATATYPE_CREATE_g, FALSE)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class")
} /* end if */
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index bfae624..7359a56 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -651,7 +651,7 @@ H5Tget_create_plist(hid_t dtype_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
/* Copy the default datatype creation property list */
- if(NULL == (tcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATATYPE_CREATE_g)))
+ if(NULL == (tcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATATYPE_CREATE_ID_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get default creation property list")
if((new_tcpl_id = H5P_copy_plist(tcpl_plist, TRUE)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to copy the creation property list")
diff --git a/src/H5Zprivate.h b/src/H5Zprivate.h
index bd5bef0..73d85ac 100644
--- a/src/H5Zprivate.h
+++ b/src/H5Zprivate.h
@@ -51,7 +51,7 @@
/****************************/
/* Structure to store information about each filter's parameters */
-typedef struct {
+typedef struct H5Z_filter_info_t {
H5Z_filter_t id; /*filter identification number */
unsigned flags; /*defn and invocation flags */
char _name[H5Z_COMMON_NAME_LEN]; /*internal filter name */
diff --git a/test/accum.c b/test/accum.c
index 488b866..651ba56 100644
--- a/test/accum.c
+++ b/test/accum.c
@@ -38,18 +38,18 @@
H5F_t * f = NULL;
/* Function Prototypes */
-unsigned test_write_read(void);
-unsigned test_write_read_nonacc_front(void);
-unsigned test_write_read_nonacc_end(void);
-unsigned test_accum_overlap(void);
-unsigned test_accum_overlap_clean(void);
-unsigned test_accum_overlap_size(void);
-unsigned test_accum_non_overlap_size(void);
-unsigned test_accum_adjust(void);
-unsigned test_read_after(void);
-unsigned test_free(void);
-unsigned test_big(void);
-unsigned test_random_write(void);
+unsigned test_write_read(const H5F_io_info_t *fio_info);
+unsigned test_write_read_nonacc_front(const H5F_io_info_t *fio_info);
+unsigned test_write_read_nonacc_end(const H5F_io_info_t *fio_info);
+unsigned test_accum_overlap(const H5F_io_info_t *fio_info);
+unsigned test_accum_overlap_clean(const H5F_io_info_t *fio_info);
+unsigned test_accum_overlap_size(const H5F_io_info_t *fio_info);
+unsigned test_accum_non_overlap_size(const H5F_io_info_t *fio_info);
+unsigned test_accum_adjust(const H5F_io_info_t *fio_info);
+unsigned test_read_after(const H5F_io_info_t *fio_info);
+unsigned test_free(const H5F_io_info_t *fio_info);
+unsigned test_big(const H5F_io_info_t *fio_info);
+unsigned test_random_write(const H5F_io_info_t *fio_info);
/* Helper Function Prototypes */
void accum_printf(void);
@@ -57,9 +57,9 @@ void accum_printf(void);
/* Private Test H5Faccum Function Wrappers */
#define accum_write(a,s,b) H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), H5P_DATASET_XFER_DEFAULT, (b))
#define accum_read(a,s,b) H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), H5P_DATASET_XFER_DEFAULT, (b))
-#define accum_free(a,s) H5F_accum_free(f, H5P_DATASET_XFER_DEFAULT, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s))
-#define accum_flush() H5F_accum_flush(f, H5P_DATASET_XFER_DEFAULT)
-#define accum_reset() H5F_accum_reset(f, H5P_DATASET_XFER_DEFAULT, TRUE)
+#define accum_free(fio_info,a,s) H5F__accum_free(fio_info, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s))
+#define accum_flush(fio_info) H5F__accum_flush(fio_info)
+#define accum_reset(fio_info) H5F__accum_reset(fio_info, TRUE)
/* ================= */
/* Main Test Routine */
@@ -82,6 +82,7 @@ void accum_printf(void);
int
main(void)
{
+ H5F_io_info_t fio_info; /* I/O info for operation */
unsigned nerrors = 0; /* track errors */
hid_t fid = -1;
@@ -98,22 +99,26 @@ main(void)
file a ways. 10MB should do. */
if(H5FD_set_eoa(f->shared->lf, H5FD_MEM_DEFAULT, (haddr_t)(1024*1024*10)) < 0) FAIL_STACK_ERROR
+ /* Set up I/O info for operation */
+ fio_info.f = f;
+ if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(H5P_DATASET_XFER_DEFAULT))) FAIL_STACK_ERROR
+
/* Reset metadata accumulator for the file */
- if(accum_reset() < 0) FAIL_STACK_ERROR
+ if(accum_reset(&fio_info) < 0) FAIL_STACK_ERROR
/* Test Functions */
- nerrors += test_write_read();
- nerrors += test_write_read_nonacc_front();
- nerrors += test_write_read_nonacc_end();
- nerrors += test_accum_overlap();
- nerrors += test_accum_overlap_clean();
- nerrors += test_accum_overlap_size();
- nerrors += test_accum_non_overlap_size();
- nerrors += test_accum_adjust();
- nerrors += test_read_after();
- nerrors += test_free();
- nerrors += test_big();
- nerrors += test_random_write();
+ nerrors += test_write_read(&fio_info);
+ nerrors += test_write_read_nonacc_front(&fio_info);
+ nerrors += test_write_read_nonacc_end(&fio_info);
+ nerrors += test_accum_overlap(&fio_info);
+ nerrors += test_accum_overlap_clean(&fio_info);
+ nerrors += test_accum_overlap_size(&fio_info);
+ nerrors += test_accum_non_overlap_size(&fio_info);
+ nerrors += test_accum_adjust(&fio_info);
+ nerrors += test_read_after(&fio_info);
+ nerrors += test_free(&fio_info);
+ nerrors += test_big(&fio_info);
+ nerrors += test_random_write(&fio_info);
/* End of test code, close and delete file */
if(H5Fclose(fid) < 0) TEST_ERROR
@@ -149,7 +154,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_write_read(void)
+test_write_read(const H5F_io_info_t *fio_info)
{
int i = 0;
int *write_buf, *read_buf;
@@ -172,7 +177,7 @@ test_write_read(void)
if(accum_read(0, 1024, read_buf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(write_buf, read_buf, 1024) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -205,7 +210,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_write_read_nonacc_front(void)
+test_write_read_nonacc_front(const H5F_io_info_t *fio_info)
{
int i = 0;
int *write_buf, *read_buf;
@@ -225,13 +230,13 @@ test_write_read_nonacc_front(void)
/* Do a simple write/read/verify of data */
/* Write 1KB at Address 0 */
if(accum_write(0, 1024, write_buf) < 0) FAIL_STACK_ERROR;
- if(accum_flush() < 0) FAIL_STACK_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(1024, 1024, write_buf) < 0) FAIL_STACK_ERROR;
if(accum_read(0, 1024, read_buf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(write_buf, read_buf, 1024) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -264,7 +269,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_write_read_nonacc_end(void)
+test_write_read_nonacc_end(const H5F_io_info_t *fio_info)
{
int i = 0;
int *write_buf, *read_buf;
@@ -284,13 +289,13 @@ test_write_read_nonacc_end(void)
/* Do a simple write/read/verify of data */
/* Write 1KB at Address 0 */
if(accum_write(1024, 1024, write_buf) < 0) FAIL_STACK_ERROR;
- if(accum_flush() < 0) FAIL_STACK_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(0, 1024, write_buf) < 0) FAIL_STACK_ERROR;
if(accum_read(1024, 1024, read_buf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(write_buf, read_buf, 1024) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -323,7 +328,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_free(void)
+test_free(const H5F_io_info_t *fio_info)
{
int i = 0;
int32_t *wbuf = NULL;
@@ -346,38 +351,38 @@ test_free(void)
if(accum_write(0, 256 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_free(0, 256 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 0, 256 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Free an empty accumulator */
- if(accum_free(0, 256 * 1024 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 0, 256 * 1024 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Write second quarter of the accumulator */
if(accum_write(64 * sizeof(int32_t), 64 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
/* Free the second quarter of the accumulator, the requested area
* is bigger than the data region on the right side. */
- if(accum_free(64 * sizeof(int32_t), 65 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 64 * sizeof(int32_t), 65 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Write half of the accumulator. */
if(accum_write(0, 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
/* Free the first block of 4B */
- if(accum_free(0, sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 0, sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(1 * sizeof(int32_t), 127 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(wbuf + 1, rbuf, 127 * sizeof(int32_t)) != 0) TEST_ERROR;
/* Free the block of 4B at 127*4B */
- if(accum_free(127 * sizeof(int32_t), sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 127 * sizeof(int32_t), sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(1 * sizeof(int32_t), 126 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(wbuf + 1, rbuf, 126 * sizeof(int32_t)) != 0) TEST_ERROR;
/* Free the block of 4B at 2*4B */
- if(accum_free(2 * sizeof(int32_t), sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 2 * sizeof(int32_t), sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(1 * sizeof(int32_t), 1 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
@@ -390,10 +395,10 @@ test_free(void)
* entirely before dirty section */
if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t));
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(68 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 68, wbuf, 4 * sizeof(int32_t));
- if(accum_free(62 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 62 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(66 * sizeof(int32_t), 126 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
@@ -404,10 +409,10 @@ test_free(void)
* completely contains dirty section */
if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t));
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(68 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 68, wbuf, 4 * sizeof(int32_t));
- if(accum_free(62 * sizeof(int32_t), 16 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 62 * sizeof(int32_t), 16 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(78 * sizeof(int32_t), 114 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
@@ -418,10 +423,10 @@ test_free(void)
* before dirty section */
if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t));
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(72 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 72, wbuf, 4 * sizeof(int32_t));
- if(accum_free(66 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 66 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(70 * sizeof(int32_t), 122 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
@@ -432,10 +437,10 @@ test_free(void)
* dirty section, and ends in dirty section */
if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t));
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(72 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 72, wbuf, 4 * sizeof(int32_t));
- if(accum_free(70 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 70 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(74 * sizeof(int32_t), 118 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
@@ -446,10 +451,10 @@ test_free(void)
* contains dirty section */
if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t));
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(72 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 72, wbuf, 4 * sizeof(int32_t));
- if(accum_free(70 * sizeof(int32_t), 8 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 70 * sizeof(int32_t), 8 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(78 * sizeof(int32_t), 114 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
@@ -460,10 +465,10 @@ test_free(void)
* of dirty section, and ends in dirty section */
if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t));
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(72 * sizeof(int32_t), 8 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 72, wbuf, 8 * sizeof(int32_t));
- if(accum_free(72 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 72 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(76 * sizeof(int32_t), 116 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
@@ -476,7 +481,7 @@ test_free(void)
HDfree(expect);
expect = NULL;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -510,7 +515,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_accum_overlap(void)
+test_accum_overlap(const H5F_io_info_t *fio_info)
{
int i = 0;
int32_t *wbuf, *rbuf;
@@ -646,7 +651,7 @@ test_accum_overlap(void)
if(accum_read(112, 6 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(wbuf, rbuf, 6 * sizeof(int32_t)) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -682,7 +687,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_accum_overlap_clean(void)
+test_accum_overlap_clean(const H5F_io_info_t *fio_info)
{
int i = 0;
int32_t *wbuf, *rbuf;
@@ -708,7 +713,7 @@ test_accum_overlap_clean(void)
/* Case 2: End of new piece aligns with start of clean accumulated data */
/* Write 5 2's at address 20 */
/* @0:| 222221111111111| */
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
for(i = 0; i < 5; i++)
wbuf[i] = 2;
if(accum_write(20, 5 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
@@ -748,7 +753,7 @@ test_accum_overlap_clean(void)
/* Case 6: New piece completely within clean accumulated data */
/* Write 3 6's at address 44 */
/* @0:| 333334666511111| */
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
for(i = 0; i < 3; i++)
wbuf[i] = 6;
if(accum_write(44, 3 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
@@ -758,7 +763,7 @@ test_accum_overlap_clean(void)
/* Case 7: New piece overlaps start of clean accumulated data */
/* Write 2 7's at address 16 */
/* @0:| 7733334666511111| */
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
for(i = 0; i < 2; i++)
wbuf[i] = 7;
if(accum_write(16, 2 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
@@ -778,7 +783,7 @@ test_accum_overlap_clean(void)
/* Case 9: Start of new piece aligns with end of clean accumulated data */
/* Write 3 9's at address 80 */
/* @0:| 88883334666511111999| */
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
for(i = 0; i < 3; i++)
wbuf[i] = 9;
if(accum_write(80, 3 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
@@ -788,7 +793,7 @@ test_accum_overlap_clean(void)
/* Case 10: New piece overlaps end of clean accumulated data */
/* Write 3 2's at address 88 */
/* @0:| 888833346665111119922| */
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
for(i = 0; i < 2; i++)
wbuf[i] = 2;
if(accum_write(88, 2 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
@@ -826,7 +831,7 @@ test_accum_overlap_clean(void)
if(accum_read(12, 22 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(wbuf, rbuf, 22 * sizeof(int32_t)) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -861,7 +866,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_accum_non_overlap_size(void)
+test_accum_non_overlap_size(const H5F_io_info_t *fio_info)
{
int i = 0;
int32_t *wbuf, *rbuf;
@@ -893,7 +898,7 @@ test_accum_non_overlap_size(void)
if(accum_read(0, 20 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(wbuf, rbuf, 20 * sizeof(int32_t)) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -928,7 +933,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_accum_overlap_size(void)
+test_accum_overlap_size(const H5F_io_info_t *fio_info)
{
int i = 0;
int32_t *wbuf, *rbuf;
@@ -960,7 +965,7 @@ test_accum_overlap_size(void)
if(accum_read(60, 72 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(wbuf, rbuf, 72 * sizeof(int32_t)) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -1006,7 +1011,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_accum_adjust(void)
+test_accum_adjust(const H5F_io_info_t *fio_info)
{
int i = 0;
int s = 1048576; /* size of buffer */
@@ -1052,7 +1057,7 @@ test_accum_adjust(void)
if(HDmemcmp(wbuf, rbuf, 1024) != 0) TEST_ERROR;
/* Reset accumulator for next case */
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* ================================================================ */
/* Case 2: Prepending large block to large, fully dirty accumulator */
@@ -1081,7 +1086,7 @@ test_accum_adjust(void)
if(HDmemcmp(wbuf, rbuf, 1048571) != 0) TEST_ERROR;
/* Reset accumulator for next case */
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* ========================================================= */
/* Case 3: Appending small block to large, clean accumulator */
@@ -1095,7 +1100,7 @@ test_accum_adjust(void)
/* Flush the accumulator -- we want to test the case when
accumulator contains clean data */
- if(accum_flush() < 0) FAIL_STACK_ERROR
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR
/* Write a small (1KB) block to the end of the accumulator */
/* ==> Accumulator will need more buffer space */
@@ -1116,7 +1121,7 @@ test_accum_adjust(void)
if(HDmemcmp(wbuf, rbuf, 1024) != 0) TEST_ERROR;
/* Reset accumulator for next case */
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* ==================================================================== */
/* Case 4: Appending small block to large, partially dirty accumulator, */
@@ -1130,7 +1135,7 @@ test_accum_adjust(void)
if(accum_write(0, (1024 * 1024) - 5, wbuf) < 0) FAIL_STACK_ERROR;
/* Flush the accumulator to clean it */
- if(accum_flush() < 0) FAIL_STACK_ERROR
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR
/* write to part of the accumulator so just the start of it is dirty */
if(accum_write(0, 5, wbuf) < 0) FAIL_STACK_ERROR;
@@ -1156,7 +1161,7 @@ test_accum_adjust(void)
if(HDmemcmp(wbuf, rbuf, 349523) != 0) TEST_ERROR;
/* Reset accumulator for next case */
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* ==================================================================== */
/* Case 5: Appending small block to large, partially dirty accumulator, */
@@ -1167,7 +1172,7 @@ test_accum_adjust(void)
if(accum_write(0, (1024 * 1024) - 5, wbuf) < 0) FAIL_STACK_ERROR;
/* Flush the accumulator to clean it */
- if(accum_flush() < 0) FAIL_STACK_ERROR
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR
/* write to part of the accumulator so it's dirty, but not entirely dirty */
/* (just the begging few bytes will be clean) */
@@ -1193,7 +1198,7 @@ test_accum_adjust(void)
if(HDmemcmp(wbuf, rbuf, 10) != 0) TEST_ERROR;
/* Reset accumulator for next case */
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* ================================================================= */
/* Case 6: Appending small block to large, fully dirty accumulator */
@@ -1224,7 +1229,7 @@ test_accum_adjust(void)
if(accum_read(1048571, 349523, rbuf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(wbuf, rbuf, 349523) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -1262,7 +1267,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_read_after(void)
+test_read_after(const H5F_io_info_t *fio_info)
{
int i = 0;
int s = 128; /* size of buffer */
@@ -1307,7 +1312,7 @@ test_read_after(void)
if(accum_read(512, 512, rbuf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(wbuf, rbuf, 128) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -1341,7 +1346,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_big(void)
+test_big(const H5F_io_info_t *fio_info)
{
uint8_t *wbuf, *wbuf2, *rbuf, *zbuf; /* Buffers for reading & writing, etc */
unsigned u; /* Local index variable */
@@ -1377,7 +1382,7 @@ test_big(void)
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(0, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR;
HDmemset(rbuf, 0, BIG_BUF_SIZE);
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* Write small section to middle of accumulator */
@@ -1396,7 +1401,7 @@ test_big(void)
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(1024, 1024, zbuf) < 0) FAIL_STACK_ERROR;
HDmemset(rbuf, 0, BIG_BUF_SIZE);
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* Write small section to overlap with end of "big" region */
@@ -1414,7 +1419,7 @@ test_big(void)
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(BIG_BUF_SIZE - 512, 1024, zbuf) < 0) FAIL_STACK_ERROR;
HDmemset(rbuf, 0, BIG_BUF_SIZE);
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* Write small section to overlap with beginning of "big" region */
@@ -1432,7 +1437,7 @@ test_big(void)
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(0, 1024, zbuf) < 0) FAIL_STACK_ERROR;
HDmemset(rbuf, 0, BIG_BUF_SIZE);
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* Write small section to middle of accumulator */
@@ -1454,7 +1459,7 @@ test_big(void)
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(0, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR;
HDmemset(rbuf, 0, BIG_BUF_SIZE);
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* Write small section to overlap with end of "big" region */
@@ -1477,7 +1482,7 @@ test_big(void)
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(0, BIG_BUF_SIZE + 512, zbuf) < 0) FAIL_STACK_ERROR;
HDmemset(rbuf, 0, BIG_BUF_SIZE + 512);
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* Write small section to be past "big" region */
@@ -1505,7 +1510,7 @@ test_big(void)
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(0, BIG_BUF_SIZE + 1536, zbuf) < 0) FAIL_STACK_ERROR;
HDmemset(rbuf, 0, BIG_BUF_SIZE + 1024);
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* Write small section to be past "big" region */
@@ -1533,7 +1538,7 @@ test_big(void)
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(1536, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR;
HDmemset(rbuf, 0, BIG_BUF_SIZE + 1536);
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* Write small section before "big" region */
@@ -1560,7 +1565,7 @@ test_big(void)
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(512, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR;
HDmemset(rbuf, 0, BIG_BUF_SIZE + 512);
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* Write small section before "big" region */
@@ -1588,7 +1593,7 @@ test_big(void)
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(0, BIG_BUF_SIZE + 1536, zbuf) < 0) FAIL_STACK_ERROR;
HDmemset(rbuf, 0, BIG_BUF_SIZE + 1536);
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* Write small section before "big" region */
@@ -1612,7 +1617,7 @@ test_big(void)
if(HDmemcmp(wbuf2, rbuf + 512, BIG_BUF_SIZE) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -1649,7 +1654,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_random_write(void)
+test_random_write(const H5F_io_info_t *fio_info)
{
uint8_t *wbuf, *rbuf; /* Buffers for reading & writing */
unsigned seed = 0; /* Random # seed */
@@ -1749,7 +1754,7 @@ HDfprintf(stderr, "Random # seed was: %u\n", seed);
/* Verify data read back in */
if(HDmemcmp(wbuf, rbuf, RANDOM_BUF_SIZE) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();