summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorM. Scot Breitenfeld <brtnfld@hdfgroup.org>2018-06-04 19:41:12 (GMT)
committerM. Scot Breitenfeld <brtnfld@hdfgroup.org>2018-06-04 19:41:12 (GMT)
commitf484649347152316229f607f782ea269ebbc5994 (patch)
tree9f8ffda1440436cbd01b1c34495533c14ea92039 /src
parentcc611c696fbff4731c4eef3882ef985ac3ebab1d (diff)
parentafc6beb7760d2c7ee13f2456deac3da4e1ae4b2e (diff)
downloadhdf5-f484649347152316229f607f782ea269ebbc5994.zip
hdf5-f484649347152316229f607f782ea269ebbc5994.tar.gz
hdf5-f484649347152316229f607f782ea269ebbc5994.tar.bz2
Merge branch 'develop' into hdf5_1_10.sync
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/H5B.c8
-rw-r--r--src/H5B2dbg.c10
-rw-r--r--src/H5B2pkg.h2
-rw-r--r--src/H5B2test.c33
-rw-r--r--src/H5CX.c280
-rw-r--r--src/H5CXprivate.h7
-rw-r--r--src/H5Dio.c465
-rw-r--r--src/H5Dpkg.h2
-rw-r--r--src/H5Dpublic.h29
-rw-r--r--src/H5Gdeprec.c2
-rw-r--r--src/H5Gloc.c8
-rw-r--r--src/H5Gnode.c3
-rw-r--r--src/H5Gprivate.h2
-rw-r--r--src/H5I.c110
-rw-r--r--src/H5Ipkg.h2
-rw-r--r--src/H5Itest.c42
-rw-r--r--src/H5MF.c199
-rw-r--r--src/H5MFaggr.c261
-rw-r--r--src/H5MFdbg.c25
-rw-r--r--src/H5MFpkg.h24
-rw-r--r--src/H5MFsection.c345
-rw-r--r--src/H5O.c143
-rw-r--r--src/H5Odeprec.c332
-rw-r--r--src/H5Oint.c180
-rw-r--r--src/H5Opkg.h6
-rw-r--r--src/H5Oprivate.h3
-rw-r--r--src/H5Opublic.h40
-rw-r--r--src/H5PB.c34
-rw-r--r--src/H5Pdxpl.c65
-rw-r--r--src/H5R.c16
-rw-r--r--src/H5Rdeprec.c2
-rw-r--r--src/H5Rint.c17
-rw-r--r--src/H5Rpkg.h5
-rw-r--r--src/H5S.c53
-rw-r--r--src/H5Sprivate.h1
-rw-r--r--src/H5vers.txt5
-rw-r--r--src/Makefile.am2
38 files changed, 1399 insertions, 1365 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9ff70f9..9a1f545 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -450,6 +450,7 @@ set (H5O_SOURCES
${HDF5_SRC_DIR}/H5Ocont.c
${HDF5_SRC_DIR}/H5Ocopy.c
${HDF5_SRC_DIR}/H5Odbg.c
+ ${HDF5_SRC_DIR}/H5Odeprec.c
${HDF5_SRC_DIR}/H5Odrvinfo.c
${HDF5_SRC_DIR}/H5Odtype.c
${HDF5_SRC_DIR}/H5Oefl.c
diff --git a/src/H5B.c b/src/H5B.c
index fe09b42..1f19d7b 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -245,7 +245,7 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *addr_p/*out*
NULL == (bt->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for B-tree root node")
if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, (hsize_t)shared->sizeof_rnode)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "file allocation failed for B-tree root node")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "file allocation failed for B-tree root node")
/*
* Cache the new B-tree node.
@@ -320,7 +320,7 @@ H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
/* Get shared info for B-tree */
if(NULL == (rc_shared = (type->get_shared)(f, udata)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared);
HDassert(shared);
@@ -332,7 +332,7 @@ H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
if(NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
rt = bt->nchildren;
while(lt < rt && cmp) {
@@ -1300,7 +1300,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
if((int)(ret_value = H5B__remove_helper(f, bt->child[idx], type,
level + 1, H5B_NKEY(bt, shared, idx)/*out*/,
lt_key_changed/*out*/, udata, H5B_NKEY(bt, shared, idx + 1)/*out*/,
- rt_key_changed/*out*/)) < 0)
+ rt_key_changed/*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "key not found in subtree")
} else if(type->remove) {
/*
diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c
index c4f56e5..0e3ebd5 100644
--- a/src/H5B2dbg.c
+++ b/src/H5B2dbg.c
@@ -109,7 +109,7 @@ H5B2__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
/* Load the B-tree header */
if(NULL == (hdr = H5B2__hdr_protect(f, addr, f, H5AC__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header")
/* Set file pointer for this B-tree operation */
hdr->f = f;
@@ -208,7 +208,7 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
/* Load the B-tree header */
if(NULL == (hdr = H5B2__hdr_protect(f, hdr_addr, f, H5AC__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load v2 B-tree header")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load v2 B-tree header")
/* Set file pointer for this B-tree operation */
hdr->f = f;
@@ -220,7 +220,7 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
node_ptr.addr = addr;
H5_CHECKED_ASSIGN(node_ptr.node_nrec, uint16_t, nrec, unsigned)
if(NULL == (internal = H5B2__protect_internal(hdr, NULL, &node_ptr, (uint16_t)depth, FALSE, H5AC__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree internal node")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree internal node")
/* Print opening message */
HDfprintf(stream, "%*sv2 B-tree Internal Node...\n", indent, "");
@@ -320,7 +320,7 @@ H5B2__leaf_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
/* Load the B-tree header */
if(NULL == (hdr = H5B2__hdr_protect(f, hdr_addr, f, H5AC__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header")
/* Set file pointer for this B-tree operation */
hdr->f = f;
@@ -332,7 +332,7 @@ H5B2__leaf_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
node_ptr.addr = addr;
H5_CHECKED_ASSIGN(node_ptr.node_nrec, uint16_t, nrec, unsigned)
if(NULL == (leaf = H5B2__protect_leaf(hdr, NULL, &node_ptr, FALSE, H5AC__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
/* Print opening message */
HDfprintf(stream, "%*sv2 B-tree Leaf Node...\n", indent, "");
diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h
index 552cebb..27229f1 100644
--- a/src/H5B2pkg.h
+++ b/src/H5B2pkg.h
@@ -467,7 +467,7 @@ H5_DLL herr_t H5B2__assert_leaf2(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf,
/* Testing routines */
#ifdef H5B2_TESTING
-H5_DLL herr_t H5B2_get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr);
+H5_DLL herr_t H5B2__get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr);
H5_DLL int H5B2__get_node_depth_test(H5B2_t *bt2, void *udata);
H5_DLL herr_t H5B2__get_node_info_test(H5B2_t *bt2, void *udata,
H5B2_node_info_test_t *ninfo);
diff --git a/src/H5B2test.c b/src/H5B2test.c
index 49fe3af..0f4a39c 100644
--- a/src/H5B2test.c
+++ b/src/H5B2test.c
@@ -469,12 +469,11 @@ H5B2__test2_debug(FILE *stream, int indent, int fwidth, const void *record,
/*-------------------------------------------------------------------------
- * Function: H5B2_get_root_addr_test
+ * Function: H5B2__get_root_addr_test
*
- * Purpose: Retrieve the root node's address
+ * Purpose: Retrieve the root node's address
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Saturday, February 26, 2005
@@ -482,7 +481,7 @@ H5B2__test2_debug(FILE *stream, int indent, int fwidth, const void *record,
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr)
+H5B2__get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -494,16 +493,15 @@ H5B2_get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr)
*root_addr = bt2->hdr->root.addr;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5B2_get_root_addr_test() */
+} /* H5B2__get_root_addr_test() */
/*-------------------------------------------------------------------------
- * Function: H5B2__get_node_info_test
+ * Function: H5B2__get_node_info_test
*
- * Purpose: Determine information about a node holding a record in the B-tree
+ * Purpose: Determine information about a node holding a record in the B-tree
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, August 31, 2006
@@ -647,15 +645,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5B2__get_node_depth_test
+ * Function: H5B2__get_node_depth_test
*
- * Purpose: Determine the depth of a node holding a record in the B-tree
+ * Purpose: Determine the depth of a node holding a record in the B-tree
*
- * Note: Just a simple wrapper around the H5B2__get_node_info_test() routine
+ * Note: Just a simple wrapper around the H5B2__get_node_info_test() routine
*
- * Return: Success: non-negative depth of the node where the record
- * was found
- * Failure: negative
+ * Return: Success: Non-negative depth of the node where the record
+ * was found
+ *
+ * Failure: -1
*
* Programmer: Quincey Koziol
* Saturday, August 26, 2006
@@ -675,7 +674,7 @@ H5B2__get_node_depth_test(H5B2_t *bt2, void *udata)
/* Get information abou the node */
if(H5B2__get_node_info_test(bt2, udata, &ninfo) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "error looking up node info")
+ HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, (-1), "error looking up node info")
/* Set return value */
ret_value = (int)ninfo.depth;
diff --git a/src/H5CX.c b/src/H5CX.c
index deaf1a1..f809d1c 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -233,24 +233,10 @@ typedef struct H5CX_t {
hbool_t data_transform_valid; /* Whether data transform info is valid */
H5T_vlen_alloc_info_t vl_alloc_info; /* VL datatype alloc info (H5D_XFER_VLEN_*_NAME) */
hbool_t vl_alloc_info_valid; /* Whether VL datatype alloc info is valid */
- hbool_t dcr_flag; /* Direct chunk read flag (H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME) */
- hbool_t dcr_flag_valid; /* Whether direct chunk read flag is valid */
- hsize_t *dcr_offset; /* Direct chunk read offset (H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME) */
- hbool_t dcr_offset_valid; /* Whether direct chunk read offset is valid */
- hbool_t dcw_flag; /* Direct chunk write flag (H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME) */
- hbool_t dcw_flag_valid; /* Whether direct chunk write flag is valid */
- uint32_t dcw_filters; /* Direct chunk write filter flags (H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME) */
- hbool_t dcw_filters_valid; /* Whether direct chunk write filter flags is valid */
- hsize_t *dcw_offset; /* Direct chunk write offset (H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME) */
- hbool_t dcw_offset_valid; /* Whether direct chunk write offset is valid */
- uint32_t dcw_datasize; /* Direct chunk write data size (H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME) */
- hbool_t dcw_datasize_valid; /* Whether direct chunk write data size is valid */
H5T_conv_cb_t dt_conv_cb; /* Datatype conversion struct (H5D_XFER_CONV_CB_NAME) */
hbool_t dt_conv_cb_valid; /* Whether datatype conversion struct is valid */
/* Return-only DXPL properties to return to application */
- uint32_t dcr_filters; /* Direct chunk read filter flags (H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME) */
- hbool_t dcr_filters_set; /* Whether direct chunk read filter flags are set */
#ifdef H5_HAVE_PARALLEL
H5D_mpio_actual_chunk_opt_mode_t mpio_actual_chunk_opt; /* Chunk optimization mode used for parallel I/O (H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME) */
hbool_t mpio_actual_chunk_opt_set; /* Whether chunk optimization mode used for parallel I/O is set */
@@ -321,12 +307,6 @@ typedef struct H5CX_dxpl_cache_t {
H5Z_cb_t filter_cb; /* Filter callback function (H5D_XFER_FILTER_CB_NAME) */
H5Z_data_xform_t *data_transform; /* Data transform info (H5D_XFER_XFORM_NAME) */
H5T_vlen_alloc_info_t vl_alloc_info; /* VL datatype alloc info (H5D_XFER_VLEN_*_NAME) */
- hbool_t dcr_flag; /* Direct chunk read flag (H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME) */
- hsize_t *dcr_offset; /* Direct chunk read offset (H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME) */
- hbool_t dcw_flag; /* Direct chunk write flag (H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME) */
- uint32_t dcw_datasize; /* Direct chunk write data size (H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME) */
- hsize_t *dcw_offset; /* Direct chunk write offset (H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME) */
- uint32_t dcw_filters; /* Direct chunk write filter flags (H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME) */
H5T_conv_cb_t dt_conv_cb; /* Datatype conversion struct (H5D_XFER_CONV_CB_NAME) */
} H5CX_dxpl_cache_t;
@@ -469,27 +449,10 @@ H5CX__init_package(void)
if(H5P_get(dx_plist, H5D_XFER_VLEN_FREE_INFO_NAME, &H5CX_def_dxpl_cache.vl_alloc_info.free_info) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info")
- /* Get direct chunk read info */
- if(H5P_get(dx_plist, H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME, &H5CX_def_dxpl_cache.dcr_flag) < 0)
- HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve direct chunk read flag")
- if(H5P_get(dx_plist, H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME, &H5CX_def_dxpl_cache.dcr_offset) < 0)
- HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve direct chunk read offset")
-
- /* Get direct chunk write info */
- if(H5P_get(dx_plist, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &H5CX_def_dxpl_cache.dcw_flag) < 0)
- HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve direct chunk write flag")
- if(H5P_get(dx_plist, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME, &H5CX_def_dxpl_cache.dcw_filters) < 0)
- HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve direct chunk write filter mask")
- if(H5P_get(dx_plist, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME, &H5CX_def_dxpl_cache.dcw_offset) < 0)
- HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve direct chunk write offset")
- if(H5P_get(dx_plist, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME, &H5CX_def_dxpl_cache.dcw_datasize) < 0)
- HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve direct chunk write data size")
-
/* Get datatype conversion struct */
if(H5P_get(dx_plist, H5D_XFER_CONV_CB_NAME, &H5CX_def_dxpl_cache.dt_conv_cb) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve datatype conversion exception callback")
-
/* Reset the "default LAPL cache" information */
HDmemset(&H5CX_def_lapl_cache, 0, sizeof(H5CX_lapl_cache_t));
@@ -1791,216 +1754,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5CX_get_dcr_flag
- *
- * Purpose: Retrieves the direct chunk read flag for the current API call context.
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * March 6, 2018
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5CX_get_dcr_flag(hbool_t *dcr_flag)
-{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity check */
- HDassert(dcr_flag);
- HDassert(head && *head);
- HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
-
- H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME, dcr_flag)
-
- /* Get the value */
- *dcr_flag = (*head)->ctx.dcr_flag;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5CX_get_dcr_flag() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5CX_get_dcr_offset
- *
- * Purpose: Retrieves the direct chunk read offset for the current API call context.
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * March 6, 2018
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5CX_get_dcr_offset(hsize_t **dcr_offset)
-{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity check */
- HDassert(dcr_offset);
- HDassert(head && *head);
- HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
-
- H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME, dcr_offset)
-
- /* Get the value */
- *dcr_offset = (*head)->ctx.dcr_offset;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5CX_get_dcr_offset() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5CX_get_dcw_flag
- *
- * Purpose: Retrieves the direct chunk write flag for the current API call context.
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * March 6, 2018
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5CX_get_dcw_flag(hbool_t *dcw_flag)
-{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity check */
- HDassert(dcw_flag);
- HDassert(head && *head);
- HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
-
- H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, dcw_flag)
-
- /* Get the value */
- *dcw_flag = (*head)->ctx.dcw_flag;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5CX_get_dcw_flag() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5CX_get_dcw_filters
- *
- * Purpose: Retrieves the direct chunk write filter mask for the current API call context.
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * March 6, 2018
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5CX_get_dcw_filters(uint32_t *dcw_filters)
-{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity check */
- HDassert(dcw_filters);
- HDassert(head && *head);
- HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
-
- H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME, dcw_filters)
-
- /* Get the value */
- *dcw_filters = (*head)->ctx.dcw_filters;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5CX_get_dcw_filters() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5CX_get_dcw_offset
- *
- * Purpose: Retrieves the direct chunk write offset for the current API call context.
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * March 6, 2018
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5CX_get_dcw_offset(hsize_t **dcw_offset)
-{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity check */
- HDassert(dcw_offset);
- HDassert(head && *head);
- HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
-
- H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME, dcw_offset)
-
- /* Get the value */
- *dcw_offset = (*head)->ctx.dcw_offset;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5CX_get_dcw_offset() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5CX_get_dcw_datasize
- *
- * Purpose: Retrieves the direct chunk write data size for the current API call context.
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * March 6, 2018
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5CX_get_dcw_datasize(uint32_t *dcw_datasize)
-{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity check */
- HDassert(dcw_datasize);
- HDassert(head && *head);
- HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
-
- H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME, dcw_datasize)
-
- /* Get the value */
- *dcw_datasize = (*head)->ctx.dcw_datasize;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5CX_get_dcw_datasize() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5CX_get_dt_conv_cb
*
* Purpose: Retrieves the datatype conversion exception callback for the current API call context.
@@ -2358,38 +2111,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_set_nlinks() */
-
-/*-------------------------------------------------------------------------
- * Function: H5CX_set_dcr_filters
- *
- * Purpose: Sets the direct chunk read filter flags for the current API call context.
- *
- * Return: <none>
- *
- * Programmer: Quincey Koziol
- * March 6, 2018
- *
- *-------------------------------------------------------------------------
- */
-void
-H5CX_set_dcr_filters(uint32_t direct_filters)
-{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* Sanity checks */
- HDassert(head && *head);
- HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT ||
- (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
-
- /* Cache the filter mask for later, marking it to set in DXPL when context popped */
- (*head)->ctx.dcr_filters = direct_filters;
- (*head)->ctx.dcr_filters_set = TRUE;
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5CX_set_dcr_filters() */
-
#ifdef H5_HAVE_PARALLEL
/*-------------------------------------------------------------------------
@@ -2755,7 +2476,6 @@ H5CX__pop_common(void)
HDassert(head && *head);
/* Check for cached DXPL properties to return to application */
- H5CX_SET_PROP(H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME, dcr_filters)
#ifdef H5_HAVE_PARALLEL
H5CX_SET_PROP(H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, mpio_actual_chunk_opt)
H5CX_SET_PROP(H5D_MPIO_ACTUAL_IO_MODE_NAME, mpio_actual_io_mode)
diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h
index 3566f11..44a4067 100644
--- a/src/H5CXprivate.h
+++ b/src/H5CXprivate.h
@@ -95,12 +95,6 @@ H5_DLL herr_t H5CX_get_err_detect(H5Z_EDC_t *err_detect);
H5_DLL herr_t H5CX_get_filter_cb(H5Z_cb_t *filter_cb);
H5_DLL herr_t H5CX_get_data_transform(H5Z_data_xform_t **data_transform);
H5_DLL herr_t H5CX_get_vlen_alloc_info(H5T_vlen_alloc_info_t *vl_alloc_info);
-H5_DLL herr_t H5CX_get_dcr_flag(hbool_t *direct_read);
-H5_DLL herr_t H5CX_get_dcr_offset(hsize_t **direct_offset);
-H5_DLL herr_t H5CX_get_dcw_flag(hbool_t *direct_write);
-H5_DLL herr_t H5CX_get_dcw_filters(uint32_t *direct_filters);
-H5_DLL herr_t H5CX_get_dcw_offset(hsize_t **direct_offset);
-H5_DLL herr_t H5CX_get_dcw_datasize(uint32_t *direct_datasize);
H5_DLL herr_t H5CX_get_dt_conv_cb(H5T_conv_cb_t *cb_struct);
/* "Getter" routines for LAPL properties cached in API context */
@@ -127,7 +121,6 @@ H5_DLL herr_t H5CX_set_vlen_alloc_info(H5MM_allocate_t alloc_func,
H5_DLL herr_t H5CX_set_nlinks(size_t nlinks);
/* "Setter" routines for cached DXPL properties that must be returned to application */
-H5_DLL void H5CX_set_dcr_filters(uint32_t direct_filters);
#ifdef H5_HAVE_PARALLEL
H5_DLL void H5CX_set_mpio_actual_chunk_opt(H5D_mpio_actual_chunk_opt_mode_t chunk_opt);
H5_DLL void H5CX_set_mpio_actual_io_mode(H5D_mpio_actual_io_mode_t actual_io_mode);
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 1566b5e..452105e 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -50,7 +50,8 @@
/* Local Prototypes */
/********************/
-/* Setup/teardown routines */
+static herr_t H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset,
+ hsize_t *offset_copy/*out*/);
static herr_t H5D__ioinfo_init(H5D_t *dset, const H5D_type_info_t *type_info,
H5D_storage_t *store, H5D_io_info_t *io_info);
static herr_t H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id,
@@ -80,32 +81,81 @@ H5FL_DEFINE(H5D_chunk_map_t);
/*-------------------------------------------------------------------------
+ * Function: H5D__get_offset_copy
+ *
+ * Purpose: Gets a copy of the user's offset array that is guaraneteed
+ * to be suitable for use by the library.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy)
+{
+ unsigned u;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ HDassert(dset);
+ HDassert(offset);
+ HDassert(offset_copy);
+
+
+ /* The library's chunking code requires the offset to terminate with a zero.
+ * So transfer the offset array to an internal offset array that we
+ * can properly terminate (handled via the calloc call).
+ */
+
+ HDmemset(offset_copy, 0, H5O_LAYOUT_NDIMS * sizeof(hsize_t));
+
+ for (u = 0; u < dset->shared->ndims; u++) {
+ /* Make sure the offset doesn't exceed the dataset's dimensions */
+ if (offset[u] > dset->shared->curr_dims[u])
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset exceeds dimensions of dataset")
+
+ /* Make sure the offset fall right on a chunk's boundary */
+ if (offset[u] % dset->shared->layout.u.chunk.dim[u])
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset doesn't fall on chunks's boundary")
+
+ offset_copy[u] = offset[u];
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+
+} /* end H5D__get_offset_copy() */
+
+
+
+/*-------------------------------------------------------------------------
* Function: H5Dread
*
- * Purpose: Reads (part of) a DSET from the file into application
- * memory BUF. The part of the dataset to read is defined with
- * MEM_SPACE_ID and FILE_SPACE_ID. The data points are
- * converted from their file type to the MEM_TYPE_ID specified.
- * Additional miscellaneous data transfer properties can be
- * passed to this function with the PLIST_ID argument.
+ * Purpose: Reads (part of) a DSET from the file into application
+ * memory BUF. The part of the dataset to read is defined with
+ * MEM_SPACE_ID and FILE_SPACE_ID. The data points are
+ * converted from their file type to the MEM_TYPE_ID specified.
+ * Additional miscellaneous data transfer properties can be
+ * passed to this function with the PLIST_ID argument.
*
- * The FILE_SPACE_ID can be the constant H5S_ALL which indicates
- * that the entire file dataspace is to be referenced.
+ * The FILE_SPACE_ID can be the constant H5S_ALL which indicates
+ * that the entire file dataspace is to be referenced.
*
- * The MEM_SPACE_ID can be the constant H5S_ALL in which case
- * the memory dataspace is the same as the file dataspace
- * defined when the dataset was created.
+ * The MEM_SPACE_ID can be the constant H5S_ALL in which case
+ * the memory dataspace is the same as the file dataspace
+ * defined when the dataset was created.
*
- * The number of elements in the memory dataspace must match
- * the number of elements in the file dataspace.
+ * The number of elements in the memory dataspace must match
+ * the number of elements in the file dataspace.
*
- * The PLIST_ID can be the constant H5P_DEFAULT in which
- * case the default data transfer properties are used.
+ * The PLIST_ID can be the constant H5P_DEFAULT in which
+ * case the default data transfer properties are used.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Thursday, December 4, 1997
+ * Programmer: Robb Matzke
+ * Thursday, December 4, 1997
*
*-------------------------------------------------------------------------
*/
@@ -113,135 +163,136 @@ herr_t
H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t dxpl_id, void *buf/*out*/)
{
- H5D_t *dset = NULL;
- const H5S_t *mem_space = NULL;
- const H5S_t *file_space = NULL;
- hbool_t direct_read = FALSE;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_t *dset = NULL;
+ const H5S_t *mem_space = NULL;
+ const H5S_t *file_space = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iiiiix", dset_id, mem_type_id, mem_space_id, file_space_id,
dxpl_id, buf);
- /* check arguments */
- if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
- if(NULL == dset->oloc.file)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ /* Get dataset pointer */
+ if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID")
+ if (NULL == dset->oloc.file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
- if(mem_space_id < 0 || file_space_id < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ /* Get validated dataspace pointers */
+ if (H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id")
+ if (H5S_get_validated_dataspace(file_space_id, &file_space) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id")
- if(H5S_ALL != mem_space_id) {
- if(NULL == (mem_space = (const H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ /* Get the default dataset transfer property list if the user didn't provide one */
+ if (H5P_DEFAULT == dxpl_id)
+ dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ else
+ if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
- /* Check for valid selection */
- if(H5S_SELECT_VALID(mem_space) != TRUE)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent")
- } /* end if */
+ /* Set DXPL for operation */
+ H5CX_set_dxpl(dxpl_id);
- if(H5S_ALL != file_space_id) {
- if(NULL == (file_space = (const H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ /* Read raw data */
+ if (H5D__read(dset, mem_type_id, mem_space, file_space, buf/*out*/) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
- /* Check for valid selection */
- if(H5S_SELECT_VALID(file_space) != TRUE)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent")
- } /* end if */
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Dread() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Dread_chunk
+ *
+ * Purpose: Reads an entire chunk from the file directly.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Matthew Strong (GE Healthcare)
+ * 14 February 2016
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters,
+ void *buf)
+{
+ H5D_t *dset = NULL;
+ hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE5("e", "ii*h*Iu*x", dset_id, dxpl_id, offset, filters, buf);
+
+ /* Check arguments */
+ if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID")
+ if (NULL == dset->oloc.file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
+ if (H5D_CHUNKED != dset->shared->layout.type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
+ if (!buf)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf cannot be NULL")
+ if (!offset)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset cannot be NULL")
+ if (!filters)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filters cannot be NULL")
/* Get the default dataset transfer property list if the user didn't provide one */
- if(H5P_DEFAULT == dxpl_id)
+ if (H5P_DEFAULT == dxpl_id)
dxpl_id = H5P_DATASET_XFER_DEFAULT;
else
- if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
+ if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID")
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
- /* Retrieve the 'direct read' flag */
- if(H5CX_get_dcr_flag(&direct_read) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting flag for direct chunk read")
-
- /* Set up for direct read of chunk, bypassing filters, etc. */
- if(direct_read) {
- hsize_t *direct_offset; /* Chunk offset from calling routine */
- hsize_t internal_offset[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
- uint32_t direct_filters = 0; /* Filters for chunk */
- unsigned u; /* Local index variable */
-
- /* Sanity check */
- if(H5D_CHUNKED != dset->shared->layout.type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
-
- /* Get the direct chunk offset */
- if(H5CX_get_dcr_offset(&direct_offset) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting offset for direct chunk read")
- HDassert(direct_offset);
-
- /* The library's chunking code requires the offset terminates with a zero. So transfer the
- * offset array to an internal offset array */
- for(u = 0; u < dset->shared->ndims; u++) {
- /* Make sure the offset doesn't exceed the dataset's dimensions */
- if(direct_offset[u] > dset->shared->curr_dims[u])
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset exceeds dimensions of dataset")
-
- /* Make sure the offset fall right on a chunk's boundary */
- if(direct_offset[u] % dset->shared->layout.u.chunk.dim[u])
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset doesn't fall on chunks's boundary")
-
- internal_offset[u] = direct_offset[u];
- } /* end for */
-
- /* Terminate the offset with a zero */
- internal_offset[dset->shared->ndims] = 0;
-
- /* Read the raw chunk */
- if(H5D__chunk_direct_read(dset, internal_offset, &direct_filters, buf) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read chunk directly")
-
- /* Set the chunk filter mask for application */
- H5CX_set_dcr_filters(direct_filters);
- } /* end if */
- else
- /* Read raw data */
- if(H5D__read(dset, mem_type_id, mem_space, file_space, buf/*out*/) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
+ /* Copy the user's offset array so we can be sure it's terminated properly.
+ * (we don't want to mess with the user's buffer).
+ */
+ if (H5D__get_offset_copy(dset, offset, offset_copy) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array")
+
+ /* Read the raw chunk */
+ if (H5D__chunk_direct_read(dset, offset_copy, filters, buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Dread() */
+} /* end H5Dread_chunk() */
/*-------------------------------------------------------------------------
- * Function: H5Dwrite
+ * Function: H5Dwrite
*
- * Purpose: Writes (part of) a DSET from application memory BUF to the
- * file. The part of the dataset to write is defined with the
- * MEM_SPACE_ID and FILE_SPACE_ID arguments. The data points
- * are converted from their current type (MEM_TYPE_ID) to their
- * file datatype. Additional miscellaneous data transfer
- * properties can be passed to this function with the
- * PLIST_ID argument.
+ * Purpose: Writes (part of) a DSET from application memory BUF to the
+ * file. The part of the dataset to write is defined with the
+ * MEM_SPACE_ID and FILE_SPACE_ID arguments. The data points
+ * are converted from their current type (MEM_TYPE_ID) to their
+ * file datatype. Additional miscellaneous data transfer
+ * properties can be passed to this function with the
+ * PLIST_ID argument.
*
- * The FILE_SPACE_ID can be the constant H5S_ALL which indicates
- * that the entire file dataspace is to be referenced.
+ * The FILE_SPACE_ID can be the constant H5S_ALL which indicates
+ * that the entire file dataspace is to be referenced.
*
- * The MEM_SPACE_ID can be the constant H5S_ALL in which case
- * the memory dataspace is the same as the file dataspace
- * defined when the dataset was created.
+ * The MEM_SPACE_ID can be the constant H5S_ALL in which case
+ * the memory dataspace is the same as the file dataspace
+ * defined when the dataset was created.
*
- * The number of elements in the memory dataspace must match
- * the number of elements in the file dataspace.
+ * The number of elements in the memory dataspace must match
+ * the number of elements in the file dataspace.
*
- * The PLIST_ID can be the constant H5P_DEFAULT in which
- * case the default data transfer properties are used.
+ * The PLIST_ID can be the constant H5P_DEFAULT in which
+ * case the default data transfer properties are used.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Thursday, December 4, 1997
+ * Programmer: Robb Matzke
+ * Thursday, December 4, 1997
*
*-------------------------------------------------------------------------
*/
@@ -249,61 +300,40 @@ herr_t
H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t dxpl_id, const void *buf)
{
- H5D_t *dset = NULL;
+ H5D_t *dset = NULL;
const H5S_t *mem_space = NULL;
const H5S_t *file_space = NULL;
- hbool_t direct_write = FALSE;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iiiii*x", dset_id, mem_type_id, mem_space_id, file_space_id,
dxpl_id, buf);
- /* check arguments */
- if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
- if(NULL == dset->oloc.file)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
+ /* Get dataset pointer and ensure it's associated with a file */
+ if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID")
+ if (NULL == dset->oloc.file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
+
+ /* Get validated dataspace pointers */
+ if (H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id")
+ if (H5S_get_validated_dataspace(file_space_id, &file_space) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id")
/* Get the default dataset transfer property list if the user didn't provide one */
- if(H5P_DEFAULT == dxpl_id)
+ if (H5P_DEFAULT == dxpl_id)
dxpl_id = H5P_DATASET_XFER_DEFAULT;
else
- if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
+ if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
- /* Retrieve the 'direct write' flag */
- if(H5CX_get_dcw_flag(&direct_write) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting flag for direct chunk read")
-
- /* Check dataspace selections if this is not a direct write */
- if(!direct_write) {
- if(mem_space_id < 0 || file_space_id < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
-
- if(H5S_ALL != mem_space_id) {
- if(NULL == (mem_space = (const H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
-
- /* Check for valid selection */
- if(H5S_SELECT_VALID(mem_space) != TRUE)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "memory selection+offset not within extent")
- } /* end if */
- if(H5S_ALL != file_space_id) {
- if(NULL == (file_space = (const H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
-
- /* Check for valid selection */
- if(H5S_SELECT_VALID(file_space) != TRUE)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "file selection+offset not within extent")
- } /* end if */
- } /* end if */
-
- if(H5D__pre_write(dset, direct_write, mem_type_id, mem_space, file_space, buf) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't prepare for writing data")
+ /* Write the data */
+ if (H5D__write(dset, mem_type_id, mem_space, file_space, buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
done:
FUNC_LEAVE_API(ret_value)
@@ -311,70 +341,71 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__pre_write
+ * Function: H5Dwrite_chunk
*
- * Purpose: Preparation for writing data.
+ * Purpose: Writes an entire chunk to the file directly.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Raymond Lu
+ * 30 July 2012
*
*-------------------------------------------------------------------------
*/
herr_t
-H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id,
- const H5S_t *mem_space, const H5S_t *file_space, const void *buf)
+H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset,
+ size_t data_size, const void *buf)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_t *dset = NULL;
+ hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
+ uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE6("e", "iiIu*hz*x", dset_id, dxpl_id, filters, offset, data_size, buf);
+
+ /* Check arguments */
+ if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset ID")
+ if (NULL == dset->oloc.file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
+ if (H5D_CHUNKED != dset->shared->layout.type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
+ if (!buf)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf cannot be NULL")
+ if (!offset)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset cannot be NULL")
+ if (0 == data_size)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "data_size cannot be zero")
+
+ /* Make sure data size is less than 4 GiB */
+ data_size_32 = (uint32_t)data_size;
+ if (data_size != (size_t)data_size_32)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid data_size - chunks cannot be > 4 GiB")
- FUNC_ENTER_PACKAGE_VOL
-
- /* Direct chunk write */
- if(direct_write) {
- uint32_t direct_filters;
- hsize_t *direct_offset;
- uint32_t direct_datasize;
- hsize_t internal_offset[H5O_LAYOUT_NDIMS];
- unsigned u; /* Local index variable */
-
- if(H5D_CHUNKED != dset->shared->layout.type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
-
- /* Retrieve parameters for direct chunk write */
- if(H5CX_get_dcw_filters(&direct_filters) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting filter info for direct chunk write")
- if(H5CX_get_dcw_offset(&direct_offset) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting offset info for direct chunk write")
- if(H5CX_get_dcw_datasize(&direct_datasize) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting data size for direct chunk write")
-
- /* The library's chunking code requires the offset terminates with a zero. So transfer the
- * offset array to an internal offset array */
- for(u = 0; u < dset->shared->ndims; u++) {
- /* Make sure the offset doesn't exceed the dataset's dimensions */
- if(direct_offset[u] > dset->shared->curr_dims[u])
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset exceeds dimensions of dataset")
-
- /* Make sure the offset fall right on a chunk's boundary */
- if(direct_offset[u] % dset->shared->layout.u.chunk.dim[u])
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset doesn't fall on chunks's boundary")
-
- internal_offset[u] = direct_offset[u];
- } /* end for */
-
- /* Terminate the offset with a zero */
- internal_offset[dset->shared->ndims] = 0;
-
- /* write raw data */
- if(H5D__chunk_direct_write(dset, direct_filters, internal_offset, direct_datasize, buf) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write chunk directly")
- } /* end if */
+ /* Get the default dataset transfer property list if the user didn't provide one */
+ if (H5P_DEFAULT == dxpl_id)
+ dxpl_id = H5P_DATASET_XFER_DEFAULT;
else
- /* Normal write of raw data */
- if(H5D__write(dset, mem_type_id, mem_space, file_space, buf) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
+ if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID")
+
+ /* Set DXPL for operation */
+ H5CX_set_dxpl(dxpl_id);
+
+ /* Copy the user's offset array so we can be sure it's terminated properly.
+ * (we don't want to mess with the user's buffer).
+ */
+ if (H5D__get_offset_copy(dset, offset, offset_copy) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array")
+
+ /* Write chunk */
+ if (H5D__chunk_direct_write(dset, filters, offset_copy, data_size_32, buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5D__pre_write() */
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Dwrite_chunk() */
/*-------------------------------------------------------------------------
@@ -400,7 +431,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
hbool_t type_info_init = FALSE; /* Whether the datatype info has been initialized */
H5S_t * projected_mem_space = NULL; /* If not NULL, ptr to dataspace containing a */
/* projection of the supplied mem_space to a new */
- /* dataspace with rank equal to that of */
+ /* dataspace with rank equal to that of */
/* file_space. */
/* */
/* This field is only used if */
@@ -428,7 +459,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
if(!mem_space)
mem_space = file_space;
if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dst dataspace has invalid selection")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dst dataspace has invalid selection")
H5_CHECKED_ASSIGN(nelmts, hsize_t, snelmts, hssize_t);
/* Set up datatype info for operation */
@@ -612,7 +643,7 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
hbool_t type_info_init = FALSE; /* Whether the datatype info has been initialized */
H5S_t * projected_mem_space = NULL; /* If not NULL, ptr to dataspace containing a */
/* projection of the supplied mem_space to a new */
- /* dataspace with rank equal to that of */
+ /* dataspace with rank equal to that of */
/* file_space. */
/* */
/* This field is only used if */
@@ -645,7 +676,7 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* Check if we are allowed to write to this file */
if(0 == (H5F_INTENT(dataset->oloc.file) & H5F_ACC_RDWR))
- HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "no write intent on file")
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "no write intent on file")
/* Set up datatype info for operation */
if(H5D__typeinfo_init(dataset, mem_type_id, TRUE, &type_info) < 0)
@@ -691,12 +722,12 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
mem_space = file_space;
if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection")
H5_CHECKED_ASSIGN(nelmts, hsize_t, snelmts, hssize_t);
/* Make certain that the number of elements in each selection is the same */
if(nelmts != (hsize_t)H5S_GET_SELECT_NPOINTS(file_space))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest dataspaces have different number of elements selected")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest dataspaces have different number of elements selected")
/* Check for a NULL buffer, after the H5S_ALL dataspace selection has been handled */
if(NULL == buf) {
@@ -934,7 +965,7 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write,
/* Get the memory & dataset datatypes */
if(NULL == (type_info->mem_type = (const H5T_t *)H5I_object_verify(mem_type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
type_info->dset_type = dset->shared->type;
if(do_write) {
@@ -959,11 +990,11 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write,
* turns off background preservation.
*/
if(NULL == (type_info->tpath = H5T_path_find(src_type, dst_type)))
- HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatype")
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatype")
/* Retrieve info from API context */
if(H5CX_get_data_transform(&data_transform) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data transform info")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data transform info")
/* Precompute some useful information */
type_info->src_type_size = H5T_get_size(src_type);
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 126a3c0..b887b87 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -583,8 +583,6 @@ H5_DLL herr_t H5D__refresh(hid_t dset_id, H5D_t *dataset);
H5_DLL herr_t H5D__format_convert(H5D_t *dataset);
/* Internal I/O routines */
-H5_DLL herr_t H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id,
- const H5S_t *mem_space, const H5S_t *file_space, const void *buf);
H5_DLL herr_t H5D__read(H5D_t *dataset, hid_t mem_type_id,
const H5S_t *mem_space, const H5S_t *file_space, void *buf/*out*/);
H5_DLL herr_t H5D__write(H5D_t *dataset, hid_t mem_type_id,
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index 790674a..a1ccda0 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -35,17 +35,6 @@
/* Bit flags for the H5Pset_chunk_opts() and H5Pget_chunk_opts() */
#define H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS (0x0002u)
-/* Property names for H5DOwrite_chunk */
-#define H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME "direct_chunk_flag"
-#define H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME "direct_chunk_filters"
-#define H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME "direct_chunk_offset"
-#define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME "direct_chunk_datasize"
-
-/* Property names for H5DOread_chunk */
-#define H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME "direct_chunk_read_flag"
-#define H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME "direct_chunk_read_offset"
-#define H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME "direct_chunk_read_filters"
-
/*******************/
/* Public Typedefs */
/*******************/
@@ -157,6 +146,10 @@ H5_DLL herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t plist_id, void *buf/*out*/);
H5_DLL herr_t H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t plist_id, const void *buf);
+H5_DLL herr_t H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters,
+ const hsize_t *offset, size_t data_size, const void *buf);
+H5_DLL herr_t H5Dread_chunk(hid_t dset_id, hid_t dxpl_id,
+ const hsize_t *offset, uint32_t *filters, void *buf);
H5_DLL herr_t H5Diterate(void *buf, hid_t type_id, hid_t space_id,
H5D_operator_t op, void *operator_data);
H5_DLL herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf);
@@ -185,7 +178,19 @@ H5_DLL herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type);
/* Macros */
#define H5D_CHUNK_BTREE H5D_CHUNK_IDX_BTREE
-
+/* Formerly used to support the H5DOread/write_chunk() API calls.
+ * These symbols are no longer used in the library.
+ */
+/* Property names for H5DOwrite_chunk */
+#define H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME "direct_chunk_flag"
+#define H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME "direct_chunk_filters"
+#define H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME "direct_chunk_offset"
+#define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME "direct_chunk_datasize"
+/* Property names for H5DOread_chunk */
+#define H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME "direct_chunk_read_flag"
+#define H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME "direct_chunk_read_offset"
+#define H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME "direct_chunk_read_filters"
+
/* Typedefs */
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index fc346f8..f6c6d8f 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -1118,7 +1118,7 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, c
/* Go retrieve the object information */
/* (don't need index & heap info) */
HDassert(obj_loc);
- if(H5O_get_info(obj_loc->oloc, FALSE, &oinfo) < 0)
+ if(H5O_get_info(obj_loc->oloc, &oinfo, H5O_INFO_BASIC|H5O_INFO_TIME|H5O_INFO_HDR) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info")
/* Get mapped object type */
diff --git a/src/H5Gloc.c b/src/H5Gloc.c
index 7273a89..f5a14a1 100644
--- a/src/H5Gloc.c
+++ b/src/H5Gloc.c
@@ -76,7 +76,7 @@ typedef struct {
/* User data for getting an object's info in a group */
typedef struct {
/* downward */
- hbool_t want_ih_info; /* Whether to retrieve the index & heap info */
+ unsigned fields; /* which fields in H5O_info_t struct to fill in */
/* upward */
H5O_info_t *oinfo; /* Object information to retrieve */
@@ -684,7 +684,7 @@ H5G_loc_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUS
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist")
/* Query object information */
- if(H5O_get_info(obj_loc->oloc, udata->want_ih_info, udata->oinfo) < 0)
+ if(H5O_get_info(obj_loc->oloc, udata->oinfo, udata->fields) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object info")
done:
@@ -710,7 +710,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_loc_info(const H5G_loc_t *loc, const char *name, hbool_t want_ih_info, H5O_info_t *oinfo/*out*/)
+H5G_loc_info(const H5G_loc_t *loc, const char *name, H5O_info_t *oinfo/*out*/, unsigned fields)
{
H5G_loc_info_t udata; /* User data for traversal callback */
herr_t ret_value = SUCCEED; /* Return value */
@@ -723,7 +723,7 @@ H5G_loc_info(const H5G_loc_t *loc, const char *name, hbool_t want_ih_info, H5O_i
HDassert(oinfo);
/* Set up user data for locating object */
- udata.want_ih_info = want_ih_info;
+ udata.fields = fields;
udata.oinfo = oinfo;
/* Traverse group hierarchy to locate object */
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 2ae3d538..72b3633 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -1274,7 +1274,8 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr,
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get link name")
/* Check if the object pointed by the soft link exists in the source file */
- if(H5G_loc_info(&grp_loc, link_name, FALSE, &oinfo) >= 0) {
+ /* Only basic information is needed */
+ if(H5G_loc_info(&grp_loc, link_name, &oinfo, H5O_INFO_BASIC) >= 0) {
tmp_src_ent.header = oinfo.addr;
src_ent = &tmp_src_ent;
} /* end if */
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index 427f14b..95dfef5 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -277,7 +277,7 @@ H5_DLL herr_t H5G_loc_find_by_idx(const H5G_loc_t *loc, const char *group_name,
H5G_loc_t *obj_loc/*out*/);
H5_DLL htri_t H5G_loc_exists(const H5G_loc_t *loc, const char *name);
H5_DLL herr_t H5G_loc_info(const H5G_loc_t *loc, const char *name,
- hbool_t want_ih_info, H5O_info_t *oinfo/*out*/);
+ H5O_info_t *oinfo/*out*/, unsigned fields);
H5_DLL herr_t H5G_loc_set_comment(const H5G_loc_t *loc, const char *name,
const char *comment);
H5_DLL ssize_t H5G_loc_get_comment(const H5G_loc_t *loc, const char *name,
diff --git a/src/H5I.c b/src/H5I.c
index 5117394..66082de 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -31,8 +31,8 @@
#include "H5private.h" /* Generic Functions */
#include "H5ACprivate.h" /* Metadata cache */
#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
#include "H5Ipkg.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Oprivate.h" /* Object headers */
@@ -738,10 +738,10 @@ H5I_register(H5I_type_t type, const void *object, hbool_t app_ref)
/* Create the struct & its ID */
new_id = H5I_MAKE(type, type_ptr->nextid);
- id_ptr->id = new_id;
- id_ptr->count = 1; /* initial reference count */
- id_ptr->app_count = !!app_ref;
- id_ptr->obj_ptr = object;
+ id_ptr->id = new_id;
+ id_ptr->count = 1; /* initial reference count */
+ id_ptr->app_count = !!app_ref;
+ id_ptr->obj_ptr = object;
/* Insert into the type */
if (H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0)
@@ -784,6 +784,7 @@ H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t
FUNC_ENTER_NOAPI(FAIL)
/* Check arguments */
+ HDassert(object);
/* Make sure ID is not already in use */
if(NULL != (id_ptr = H5I__find_id(id)))
@@ -808,10 +809,10 @@ H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t
HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Create the struct & insert requested ID */
- id_ptr->id = id;
- id_ptr->count = 1; /*initial reference count*/
- id_ptr->app_count = !!app_ref;
- id_ptr->obj_ptr = object;
+ id_ptr->id = id;
+ id_ptr->count = 1; /* initial reference count*/
+ id_ptr->app_count = !!app_ref;
+ id_ptr->obj_ptr = object;
/* Insert into the type */
if(H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0)
@@ -862,51 +863,45 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5I_object
+ * Function: H5I_object
*
- * Purpose: Find an object pointer for the specified ID.
+ * Purpose: Find an object pointer for the specified ID.
*
- * Return: Success: Non-null object pointer associated with the
- * specified ID.
- * Failure: NULL
+ * Return: Success: Non-null object pointer associated with the
+ * specified ID
*
- * Programmer: Unknown
+ * Failure: NULL
*
*-------------------------------------------------------------------------
*/
void *
H5I_object(hid_t id)
{
- H5I_id_info_t *id_ptr; /*ptr to the new atom */
- void *ret_value = NULL; /*return value */
+ H5I_id_info_t *id_ptr; /* Pointer to the new atom */
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOERR
/* General lookup of the ID */
if(NULL != (id_ptr = H5I__find_id(id))) {
/* Get the object pointer to return */
- /* (Casting away const OK -QAK) */
- ret_value = (void *)id_ptr->obj_ptr;
- } /* end if */
+ ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5I_object() */
/*-------------------------------------------------------------------------
- * Function: H5Iobject_verify
- *
- * Purpose: Find an object pointer for the specified ID, verifying that
- * its in a particular type. Public interface to
- * H5I_object_verify.
+ * Function: H5Iobject_verify
*
- * Return: Success: Non-null object pointer associated with the
- * specified ID.
- * Failure: NULL
+ * Purpose: Find an object pointer for the specified ID, verifying that
+ * its in a particular type. Public interface to
+ * H5I_object_verify.
*
- * Programmer: Nathaniel Furrer
- * James Laird
- * Friday, April 23, 2004
+ * Return: Success: Non-null object pointer associated with the
+ * specified ID.
+ * Failure: NULL
*
*-------------------------------------------------------------------------
*/
@@ -932,14 +927,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5I_object_verify
+ * Function: H5I_object_verify
*
- * Purpose: Find an object pointer for the specified ID, verifying that
- * its in a particular type.
+ * Purpose: Find an object pointer for the specified ID, verifying that
+ * its in a particular type.
*
- * Return: Success: Non-null object pointer associated with the
- * specified ID.
- * Failure: NULL
+ * Return: Success: Non-null object pointer associated with the
+ * specified ID.
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* Wednesday, July 31, 2002
@@ -949,8 +944,8 @@ done:
void *
H5I_object_verify(hid_t id, H5I_type_t id_type)
{
- H5I_id_info_t *id_ptr = NULL; /*ptr to the new atom */
- void *ret_value = NULL; /*return value */
+ H5I_id_info_t *id_ptr = NULL; /* Pointer to the new atom */
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOERR
@@ -959,9 +954,8 @@ H5I_object_verify(hid_t id, H5I_type_t id_type)
/* Verify that the type of the ID is correct & lookup the ID */
if(id_type == H5I_TYPE(id) && NULL != (id_ptr = H5I__find_id(id))) {
/* Get the object pointer to return */
- /* (Casting away const OK -QAK) */
- ret_value = (void *)id_ptr->obj_ptr;
- } /* end if */
+ ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* H5I_object_verify() */
@@ -1867,8 +1861,8 @@ done:
* function, and then sets return value, based on the result of
* that callback.
*
- * Return: Success: Non-negative on success
- * Failure: Negative
+ * Return: Success: H5_ITER_CONT (0) or H5_ITER_STOP (1)
+ * Failure: H5_ITER_ERROR (-1)
*
*-------------------------------------------------------------------------
*/
@@ -1925,8 +1919,8 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
herr_t
H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_ref)
{
- H5I_id_type_t *type_ptr; /*ptr to the type */
- herr_t ret_value = SUCCEED; /*return value */
+ H5I_id_type_t *type_ptr; /* Pointer to the type */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1941,9 +1935,9 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re
herr_t iter_status; /* Iteration status */
/* Set up iterator user data */
- iter_udata.user_func = func;
- iter_udata.user_udata = udata;
- iter_udata.app_ref = app_ref;
+ iter_udata.user_func = func;
+ iter_udata.user_udata = udata;
+ iter_udata.app_ref = app_ref;
/* Iterate over IDs */
if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0)
@@ -2020,16 +2014,16 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size)
H5G_loc_t loc; /* Object location */
ssize_t ret_value; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE3("Zs", "ixz", id, name, size);
/* Get object location */
if(H5G_loc(id, &loc) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location")
/* Call internal routine to retrieve object's name */
if((ret_value = H5I__get_name(&loc, name, size)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name")
done:
FUNC_LEAVE_API(ret_value)
@@ -2047,15 +2041,15 @@ done:
* Return: Success: The length of the name
* Failure: -1
*
- * Programmer: Quincey Koziol
- * January 9, 2018
+ * Programmer: Quincey Koziol
+ * January 9, 2018
*
*-------------------------------------------------------------------------
*/
static ssize_t
H5I__get_name(const H5G_loc_t *loc, char *name, size_t size)
{
- ssize_t ret_value = FAIL; /* Return value */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_STATIC_VOL
@@ -2064,7 +2058,7 @@ H5I__get_name(const H5G_loc_t *loc, char *name, size_t size)
/* Retrieve object's name */
if((ret_value = H5G_get_name(loc, name, size, NULL)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name")
done:
FUNC_LEAVE_NOAPI_VOL(ret_value)
@@ -2086,7 +2080,7 @@ done:
hid_t
H5Iget_file_id(hid_t obj_id)
{
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("i", "i", obj_id);
diff --git a/src/H5Ipkg.h b/src/H5Ipkg.h
index 16d7d67..2c1d81f 100644
--- a/src/H5Ipkg.h
+++ b/src/H5Ipkg.h
@@ -67,7 +67,7 @@
/* Testing functions */
#ifdef H5I_TESTING
-H5_DLL ssize_t H5I_get_name_test(hid_t id, char *name/*out*/, size_t size,
+H5_DLL ssize_t H5I__get_name_test(hid_t id, char *name/*out*/, size_t size,
hbool_t *cached);
#endif /* H5I_TESTING */
diff --git a/src/H5Itest.c b/src/H5Itest.c
index 426c026..4b54835 100644
--- a/src/H5Itest.c
+++ b/src/H5Itest.c
@@ -28,12 +28,12 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Gprivate.h" /* Groups */
-#include "H5Ipkg.h" /* IDs */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Ipkg.h" /* IDs */
/****************/
@@ -63,44 +63,44 @@
/*-------------------------------------------------------------------------
- * Function: H5I_get_name_test
+ * Function: H5I__get_name_test
*
- * Purpose: Testing version of H5Iget_name()
+ * Purpose: Testing version of H5Iget_name()
*
- * Return: Success: The length of name.
- * Failure: -1
+ * Return: Success: The length of name.
+ * Failure: -1
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, July 27, 2010
*
*-------------------------------------------------------------------------
*/
ssize_t
-H5I_get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached)
+H5I__get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached)
{
- H5G_loc_t loc; /* Object location */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
- ssize_t ret_value = -1; /* Return value */
+ H5G_loc_t loc; /* Object location */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ ssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* Get object location */
if(H5G_loc(id, &loc) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location")
/* Set API context */
if(H5CX_push() < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTSET, (-1), "can't set API context")
api_ctx_pushed = TRUE;
/* Call internal group routine to retrieve object's name */
if((ret_value = H5G_get_name(&loc, name, size, cached)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name")
done:
if(api_ctx_pushed && H5CX_pop() < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context")
+ HDONE_ERROR(H5E_SYM, H5E_CANTRESET, (-1), "can't reset API context")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_get_name_test() */
+} /* end H5I__get_name_test() */
diff --git a/src/H5MF.c b/src/H5MF.c
index 59ee1fc..64e91c8 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -97,6 +97,9 @@ static herr_t H5MF__close_fstype(H5F_t *f, H5F_mem_page_t type);
static herr_t H5MF__delete_fstype(H5F_t *f, H5F_mem_page_t type);
static herr_t H5MF__close_delete_fstype(H5F_t *f, H5F_mem_page_t type);
+/* Callbacks */
+static herr_t H5MF__sects_cb(H5FS_section_info_t *_sect, void *_udata);
+
/*********************/
/* Package Variables */
@@ -232,7 +235,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5MF_alloc_to_fs_type
+ * Function: H5MF__alloc_to_fs_type
*
* Purpose: Map "alloc_type" to the free-space manager type
*
@@ -244,9 +247,9 @@ done:
*-------------------------------------------------------------------------
*/
void
-H5MF_alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type)
+H5MF__alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
HDassert(f);
HDassert(fs_type);
@@ -271,7 +274,7 @@ H5MF_alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_pag
*fs_type = (H5F_mem_page_t)H5MF_ALLOC_TO_FS_AGGR_TYPE(f, alloc_type);
FUNC_LEAVE_NOAPI_VOID
-} /* end H5MF_alloc_to_fs_type() */
+} /* end H5MF__alloc_to_fs_type() */
/*-------------------------------------------------------------------------
@@ -379,10 +382,10 @@ H5MF__create_fstype(H5F_t *f, H5F_mem_page_t type)
H5MF_FSPACE_SECT_CLS_LARGE };
H5FS_create_t fs_create; /* Free space creation parameters */
hsize_t alignment; /* Alignment to use */
- hsize_t threshold; /* Threshold to use */
+ hsize_t threshold; /* Threshold to use */
H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
- H5AC_ring_t fsm_ring; /* Ring of FSM */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_ring_t fsm_ring; /* Ring of FSM */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC_TAG(H5AC__FREESPACE_TAG)
@@ -509,7 +512,7 @@ static herr_t
H5MF__delete_fstype(H5F_t *f, H5F_mem_page_t type)
{
H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
- H5AC_ring_t fsm_ring; /* Ring of FSM */
+ H5AC_ring_t fsm_ring = H5AC_RING_INV; /* Ring of FSM */
haddr_t tmp_fs_addr; /* Temporary holder for free space manager address */
herr_t ret_value = SUCCEED; /* Return value */
@@ -628,10 +631,10 @@ herr_t
H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_section_t *node)
{
H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
- H5AC_ring_t fsm_ring; /* Ring of FSM */
- H5MF_sect_ud_t udata; /* User data for callback */
- H5F_mem_page_t fs_type; /* Free space type (mapped from allocation type) */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_ring_t fsm_ring = H5AC_RING_INV; /* Ring of FSM */
+ H5MF_sect_ud_t udata; /* User data for callback */
+ H5F_mem_page_t fs_type; /* Free space type (mapped from allocation type) */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(H5AC__FREESPACE_TAG)
@@ -639,7 +642,7 @@ H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_sectio
HDassert(fspace);
HDassert(node);
- H5MF_alloc_to_fs_type(f, alloc_type, node->sect_info.size, &fs_type);
+ H5MF__alloc_to_fs_type(f, alloc_type, node->sect_info.size, &fs_type);
/* Construct user data for callbacks */
udata.f = f;
@@ -688,7 +691,7 @@ H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace,
haddr_t *addr)
{
H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
- H5AC_ring_t fsm_ring; /* Ring of FSM */
+ H5AC_ring_t fsm_ring = H5AC_RING_INV; /* Ring of FSM */
H5MF_free_section_t *node; /* Free space section pointer */
htri_t ret_value = FAIL; /* Whether an existing free list node was found */
@@ -728,7 +731,7 @@ HDfprintf(stderr, "%s: freeing node\n", FUNC);
#endif /* H5MF_ALLOC_DEBUG_MORE */
/* Free section node */
- if(H5MF_sect_free((H5FS_section_info_t *)node) < 0)
+ if(H5MF__sect_free((H5FS_section_info_t *)node) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node")
} /* end if */
else {
@@ -776,7 +779,7 @@ haddr_t
H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size)
{
H5AC_ring_t fsm_ring = H5AC_RING_INV; /* free space manager ring */
- H5AC_ring_t orig_ring; /* Original ring value */
+ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
H5F_mem_page_t fs_type; /* Free space type (mapped from allocation type) */
haddr_t ret_value = HADDR_UNDEF; /* Return value */
@@ -797,7 +800,7 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "tidy of self referential fsm hack failed")
} /* end if */
- H5MF_alloc_to_fs_type(f, alloc_type, size, &fs_type);
+ H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type);
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: Check 1.0\n", FUNC);
@@ -862,7 +865,7 @@ done:
HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size);
#endif /* H5MF_ALLOC_DEBUG */
#ifdef H5MF_ALLOC_DEBUG_DUMP
-H5MF_sects_dump(f, stderr);
+H5MF__sects_dump(f, stderr);
#endif /* H5MF_ALLOC_DEBUG_DUMP */
FUNC_LEAVE_NOAPI_TAG(ret_value)
@@ -903,7 +906,7 @@ H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size)
HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size);
#endif /* H5MF_ALLOC_DEBUG */
- H5MF_alloc_to_fs_type(f, alloc_type, size, &ptype);
+ H5MF__alloc_to_fs_type(f, alloc_type, size, &ptype);
switch(ptype) {
case H5F_MEM_PAGE_GENERIC:
@@ -936,7 +939,7 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "can't initialize file free space")
/* Create free space section for the fragment */
- if(NULL == (node = H5MF_sect_new(H5MF_FSPACE_SECT_LARGE, ret_value + size, frag_size)))
+ if(NULL == (node = H5MF__sect_new(H5MF_FSPACE_SECT_LARGE, ret_value + size, frag_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "can't initialize free space section")
/* Add the fragment to the large free-space manager */
@@ -967,7 +970,7 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "can't initialize file free space")
HDassert(f->shared->fs_man[ptype]);
- if(NULL == (node = H5MF_sect_new(H5MF_FSPACE_SECT_SMALL, (new_page + size), (f->shared->fs_page_size - size))))
+ if(NULL == (node = H5MF__sect_new(H5MF_FSPACE_SECT_SMALL, (new_page + size), (f->shared->fs_page_size - size))))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "can't initialize free space section")
/* Add the remaining space in the page to the manager */
@@ -997,12 +1000,12 @@ done:
HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size);
#endif /* H5MF_ALLOC_DEBUG */
#ifdef H5MF_ALLOC_DEBUG_DUMP
-H5MF_sects_dump(f, stderr);
+H5MF__sects_dump(f, stderr);
#endif /* H5MF_ALLOC_DEBUG_DUMP */
/* Release section node, if allocated and not added to section list or merged */
if(node)
- if(H5MF_sect_free((H5FS_section_info_t *)node) < 0)
+ if(H5MF__sect_free((H5FS_section_info_t *)node) < 0)
HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, HADDR_UNDEF, "can't free section node")
FUNC_LEAVE_NOAPI_TAG(ret_value)
@@ -1110,7 +1113,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "tidy of self referential fsm hack failed")
} /* end if */
- H5MF_alloc_to_fs_type(f, alloc_type, size, &fs_type);
+ H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type);
/* Set the ring type in the API context */
if(H5MF__fsm_type_is_self_referential(f, fs_type))
@@ -1197,7 +1200,7 @@ HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", FUNC, a
/* Create the free-space section for the freed section */
ctype = H5MF_SECT_CLASS_TYPE(f, size);
- if(NULL == (node = H5MF_sect_new(ctype, addr, size)))
+ if(NULL == (node = H5MF__sect_new(ctype, addr, size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space section")
/* If size of the freed section is larger than threshold, add it to the free space manager */
@@ -1242,14 +1245,14 @@ done:
/* Release section node, if allocated and not added to section list or merged */
if(node)
- if(H5MF_sect_free((H5FS_section_info_t *)node) < 0)
+ if(H5MF__sect_free((H5FS_section_info_t *)node) < 0)
HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node")
#ifdef H5MF_ALLOC_DEBUG
HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value);
#endif /* H5MF_ALLOC_DEBUG */
#ifdef H5MF_ALLOC_DEBUG_DUMP
-H5MF_sects_dump(f, stderr);
+H5MF__sects_dump(f, stderr);
#endif /* H5MF_ALLOC_DEBUG_DUMP */
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5MF_xfree() */
@@ -1334,7 +1337,7 @@ HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_r
} /* end if */
/* Get free space type from allocation type */
- H5MF_alloc_to_fs_type(f, alloc_type, size, &fs_type);
+ H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type);
/* Set the ring type in the API context */
if(H5MF__fsm_type_is_self_referential(f, fs_type))
@@ -1365,7 +1368,7 @@ HDfprintf(stderr, "%s: extended = %t\n", FUNC, ret_value);
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space")
/* Create free space section for the fragment */
- if(NULL == (node = H5MF_sect_new(H5MF_FSPACE_SECT_LARGE, end + extra_requested, frag_size)))
+ if(NULL == (node = H5MF__sect_new(H5MF_FSPACE_SECT_LARGE, end + extra_requested, frag_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space section")
/* Add the fragment to the large-sized free-space manager */
@@ -1436,7 +1439,7 @@ done:
HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value);
#endif /* H5MF_ALLOC_DEBUG */
#ifdef H5MF_ALLOC_DEBUG_DUMP
-H5MF_sects_dump(f, stderr);
+H5MF__sects_dump(f, stderr);
#endif /* H5MF_ALLOC_DEBUG_DUMP */
FUNC_LEAVE_NOAPI_TAG(ret_value)
@@ -1464,9 +1467,9 @@ H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size)
H5MF_sect_ud_t udata; /* User data for callback */
H5FS_section_class_t *sect_cls; /* Section class */
H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
- H5AC_ring_t fsm_ring; /* Ring of FSM */
- H5F_mem_page_t fs_type; /* Free space type */
- htri_t ret_value = FALSE; /* Return value */
+ H5AC_ring_t fsm_ring = H5AC_RING_INV; /* Ring of FSM */
+ H5F_mem_page_t fs_type; /* Free space type */
+ htri_t ret_value = FALSE; /* Return value */
FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL)
#ifdef H5MF_ALLOC_DEBUG
@@ -1485,7 +1488,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN
HDassert(sect_cls);
/* Get free space type from allocation type */
- H5MF_alloc_to_fs_type(f, alloc_type, size, &fs_type);
+ H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type);
/* Set the ring type in the API context */
if(H5MF__fsm_type_is_self_referential(f, fs_type))
@@ -1495,7 +1498,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN
H5AC_set_ring(fsm_ring, &orig_ring);
/* Create free-space section for block */
- if(NULL == (node = H5MF_sect_new(sect_cls->type, addr, size)))
+ if(NULL == (node = H5MF__sect_new(sect_cls->type, addr, size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space section")
/* Construct user data for callbacks */
@@ -1522,7 +1525,7 @@ done:
H5AC_set_ring(orig_ring, NULL);
/* Free section node allocated */
- if(node && H5MF_sect_free((H5FS_section_info_t *)node) < 0)
+ if(node && H5MF__sect_free((H5FS_section_info_t *)node) < 0)
HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node")
#ifdef H5MF_ALLOC_DEBUG
@@ -1561,10 +1564,11 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
if(H5F_PAGED_AGGR(f)) {
if((ret_value = H5MF__close_pagefs(f)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't close free-space managers for 'page' file space")
- } /* end if */
- else
+ }
+ else {
if((ret_value = H5MF__close_aggrfs(f)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't close free-space managers for 'aggr' file space")
+ }
done:
#ifdef H5MF_ALLOC_DEBUG
@@ -1650,8 +1654,8 @@ herr_t
H5MF_try_close(H5F_t *f)
{
H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
- H5AC_ring_t curr_ring; /* Current ring value */
- H5AC_ring_t needed_ring; /* Ring value needed for this iteration */
+ H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */
+ H5AC_ring_t needed_ring = H5AC_RING_INV; /* Ring value needed for this iteration */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL)
@@ -1689,7 +1693,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
/* Set the ring type in the API context. In most cases, we will
* need H5AC_RING_RDFSM, so initialy set the ring in
- * the DXPL to that value. We will alter this later if needed.
+ * the context to that value. We will alter this later if needed.
*/
H5AC_set_ring(H5AC_RING_RDFSM, &orig_ring);
curr_ring = H5AC_RING_RDFSM;
@@ -1706,6 +1710,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
needed_ring = H5AC_RING_MDFSM;
else
needed_ring = H5AC_RING_RDFSM;
+
if(needed_ring != curr_ring ) {
H5AC_set_ring(needed_ring, NULL);
curr_ring = needed_ring;
@@ -1727,6 +1732,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
needed_ring = H5AC_RING_MDFSM;
else
needed_ring = H5AC_RING_RDFSM;
+
if(needed_ring != curr_ring) {
H5AC_set_ring(needed_ring, NULL);
curr_ring = needed_ring;
@@ -1765,10 +1771,10 @@ static herr_t
H5MF__close_aggrfs(H5F_t *f)
{
H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
- H5AC_ring_t curr_ring; /* Current ring value */
- H5AC_ring_t needed_ring; /* Ring value needed for this iteration. */
+ H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */
+ H5AC_ring_t needed_ring = H5AC_RING_INV; /* Ring value needed for this iteration. */
H5FD_mem_t type; /* Memory type for iteration */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC_TAG(H5AC__FREESPACE_TAG)
#ifdef H5MF_ALLOC_DEBUG
@@ -1783,7 +1789,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
/* Set the ring type in the API context. In most cases, we will
* need H5AC_RING_RDFSM, so initialy set the ring in
- * the DXPL to that value. We will alter this later if needed.
+ * the context to that value. We will alter this later if needed.
*/
H5AC_set_ring(H5AC_RING_RDFSM, &orig_ring);
curr_ring = H5AC_RING_RDFSM;
@@ -1842,6 +1848,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
needed_ring = H5AC_RING_MDFSM;
else
needed_ring = H5AC_RING_RDFSM;
+
if(needed_ring != curr_ring) {
H5AC_set_ring(needed_ring, NULL);
curr_ring = needed_ring;
@@ -1929,8 +1936,8 @@ static herr_t
H5MF__close_pagefs(H5F_t *f)
{
H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
- H5AC_ring_t curr_ring; /* Current ring value */
- H5AC_ring_t needed_ring; /* Ring value needed for this iteration. */
+ H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */
+ H5AC_ring_t needed_ring = H5AC_RING_INV; /* Ring value needed for this iteration. */
H5F_mem_page_t ptype; /* Memory type for iteration */
H5O_fsinfo_t fsinfo; /* File space info message */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1950,7 +1957,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
/* Set the ring type in the API context. In most cases, we will
* need H5AC_RING_RDFSM, so initialy set the ring in
- * the DXPL to that value. We will alter this later if needed.
+ * the context to that value. We will alter this later if needed.
*/
H5AC_set_ring(H5AC_RING_RDFSM, &orig_ring);
curr_ring = H5AC_RING_RDFSM;
@@ -2005,6 +2012,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
needed_ring = H5AC_RING_MDFSM;
else
needed_ring = H5AC_RING_RDFSM;
+
if(needed_ring != curr_ring) {
H5AC_set_ring(needed_ring, NULL);
curr_ring = needed_ring;
@@ -2102,8 +2110,8 @@ static herr_t
H5MF__close_shrink_eoa(H5F_t *f)
{
H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
- H5AC_ring_t curr_ring; /* Current ring value */
- H5AC_ring_t needed_ring; /* Ring value needed for this iteration. */
+ H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */
+ H5AC_ring_t needed_ring = H5AC_RING_INV; /* Ring value needed for this iteration. */
H5F_mem_t type;
H5F_mem_page_t ptype; /* Memory type for iteration */
hbool_t eoa_shrank; /* Whether an EOA shrink occurs */
@@ -2139,6 +2147,7 @@ H5MF__close_shrink_eoa(H5F_t *f)
needed_ring = H5AC_RING_MDFSM;
else
needed_ring = H5AC_RING_RDFSM;
+
if(needed_ring != curr_ring) {
H5AC_set_ring(needed_ring, NULL);
curr_ring = needed_ring;
@@ -2162,6 +2171,7 @@ H5MF__close_shrink_eoa(H5F_t *f)
needed_ring = H5AC_RING_MDFSM;
else
needed_ring = H5AC_RING_RDFSM;
+
if(needed_ring != curr_ring) {
H5AC_set_ring(needed_ring, NULL);
curr_ring = needed_ring;
@@ -2222,9 +2232,9 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size)
htri_t fs_started[H5F_MEM_PAGE_NTYPES]; /* Indicate whether the free-space manager has been started */
haddr_t fs_eoa[H5FD_MEM_NTYPES]; /* EAO for each free-space manager */
H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
- H5AC_ring_t curr_ring; /* Current ring value */
- H5AC_ring_t needed_ring; /* Ring value needed for this iteration. */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */
+ H5AC_ring_t needed_ring = H5AC_RING_INV; /* Ring value needed for this iteration. */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL)
@@ -2235,7 +2245,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size)
/* Set the ring type in the API context. In most cases, we will
* need H5AC_RING_RDFSM, so initialy set the ring in
- * the DXPL to that value. We will alter this later if needed.
+ * the context to that value. We will alter this later if needed.
*/
H5AC_set_ring(H5AC_RING_RDFSM, &orig_ring);
curr_ring = H5AC_RING_RDFSM;
@@ -2256,11 +2266,11 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size)
if(!H5F_PAGED_AGGR(f)) {
/* Retrieve metadata aggregator info, if available */
- if(H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0)
+ if(H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats")
/* Retrieve 'small data' aggregator info, if available */
- if(H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size) < 0)
+ if(H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats")
} /* end if */
@@ -2342,7 +2352,8 @@ done:
* Purpose: To retrieve free-space section information for
* paged or non-paged aggregation
*
- * Return: SUCCEED/FAIL
+ * Return: Success: Number of free sections
+ * Failure: -1
*
* Programmer: Vailin Choi; Dec 2012
*
@@ -2352,15 +2363,15 @@ ssize_t
H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info)
{
H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
- H5AC_ring_t curr_ring; /* Current ring value */
- H5AC_ring_t needed_ring; /* Ring value needed for this iteration. */
+ H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */
+ H5AC_ring_t needed_ring = H5AC_RING_INV; /* Ring value needed for this iteration. */
size_t total_sects = 0; /* Total number of sections */
H5MF_sect_iter_ud_t sect_udata; /* User data for callback */
H5F_mem_page_t start_type, end_type; /* Memory types to iterate over */
H5F_mem_page_t ty; /* Memory type for iteration */
ssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL)
+ FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, (-1))
/* check args */
HDassert(f);
@@ -2382,11 +2393,11 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t
if(f->shared->first_alloc_dealloc) {
if(H5AC_cache_image_pending(f)) {
if(H5AC_force_cache_image_load(f) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "forced cache image load failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, (-1), "forced cache image load failed")
} /* end if */
else {
if(H5MF_tidy_self_referential_fsm_hack(f) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "tidy of self referential fsm hack failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, (-1), "tidy of self referential fsm hack failed")
} /* end else */
} /* end if */
@@ -2409,7 +2420,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t
/* Set the ring type in the API context. In most cases, we will
* need H5AC_RING_RDFSM, so initialy set the ring in
- * the DXPL to that value. We will alter this later if needed.
+ * the context to that value. We will alter this later if needed.
*/
H5AC_set_ring(H5AC_RING_RDFSM, &orig_ring);
curr_ring = H5AC_RING_RDFSM;
@@ -2431,7 +2442,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t
if(!f->shared->fs_man[ty] && H5F_addr_defined(f->shared->fs_addr[ty])) {
if(H5MF__open_fstype(f, ty) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't open the free space manager")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, (-1), "can't open the free space manager")
HDassert(f->shared->fs_man[ty]);
fs_started = TRUE;
} /* end if */
@@ -2439,7 +2450,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t
/* Check if there's free space sections of this type */
if(f->shared->fs_man[ty])
if(H5MF__get_free_sects(f, f->shared->fs_man[ty], &sect_udata, &nums) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't get section info for the free space manager")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, (-1), "can't get section info for the free space manager")
/* Increment total # of sections */
total_sects += nums;
@@ -2447,7 +2458,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t
/* Close the free space manager of this type, if we started it here */
if(fs_started)
if(H5MF__close_fstype(f, ty) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCLOSEOBJ, FAIL, "can't close file free space")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCLOSEOBJ, (-1), "can't close file free space")
if((H5F_PAGED_AGGR(f)) && (type != H5FD_MEM_DEFAULT))
ty = (H5F_mem_page_t)(ty + H5FD_MEM_NTYPES - 2);
} /* end for */
@@ -2465,7 +2476,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5MF_sects_cb()
+ * Function: H5MF__sects_cb()
*
* Purpose: Iterator callback for each free-space section
* Retrieve address and size into user data
@@ -2478,12 +2489,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5MF_sects_cb(H5FS_section_info_t *_sect, void *_udata)
+H5MF__sects_cb(H5FS_section_info_t *_sect, void *_udata)
{
H5MF_free_section_t *sect = (H5MF_free_section_t *)_sect;
H5MF_sect_iter_ud_t *udata = (H5MF_sect_iter_ud_t *)_udata;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
if(udata->sect_idx < udata->sect_count) {
udata->sects[udata->sect_idx].addr = sect->sect_info.addr;
@@ -2492,7 +2503,7 @@ H5MF_sects_cb(H5FS_section_info_t *_sect, void *_udata)
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5MF_sects_cb() */
+} /* H5MF__sects_cb() */
/*-------------------------------------------------------------------------
@@ -2513,7 +2524,7 @@ H5MF__get_free_sects(H5F_t *f, H5FS_t *fspace, H5MF_sect_iter_ud_t *sect_udata,
hsize_t hnums = 0; /* # of sections */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(f);
@@ -2529,7 +2540,7 @@ H5MF__get_free_sects(H5F_t *f, H5FS_t *fspace, H5MF_sect_iter_ud_t *sect_udata,
/* Check if we should retrieve the section info */
if(sect_udata->sects && *nums > 0)
/* Iterate over all the free space sections of this type, adding them to the user's section info */
- if(H5FS_sect_iterate(f, fspace, H5MF_sects_cb, sect_udata) < 0)
+ if(H5FS_sect_iterate(f, fspace, H5MF__sects_cb, sect_udata) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_BADITER, FAIL, "can't iterate over sections")
done:
@@ -2648,8 +2659,8 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled)
H5O_fsinfo_t fsinfo; /* Free space manager info message */
H5FS_stat_t fs_stat; /* Information for free-space manager */
H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
- H5AC_ring_t curr_ring; /* Current ring value */
- H5AC_ring_t needed_ring; /* Ring value needed for this iteration. */
+ H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */
+ H5AC_ring_t needed_ring = H5AC_RING_INV; /* Ring value needed for this iteration */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL)
@@ -2744,7 +2755,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled)
break;
for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5F_mem_t, mem_type)) {
- H5MF_alloc_to_fs_type(f, mem_type, alloc_size, &fsm_type);
+ H5MF__alloc_to_fs_type(f, mem_type, alloc_size, &fsm_type);
if(pass_count == 0) { /* this is the first pass */
HDassert(fsm_type > H5F_MEM_PAGE_DEFAULT);
@@ -2781,6 +2792,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled)
needed_ring = H5AC_RING_MDFSM;
else
needed_ring = H5AC_RING_RDFSM;
+
if(needed_ring != curr_ring) {
H5AC_set_ring(needed_ring, NULL);
curr_ring = needed_ring;
@@ -2888,7 +2900,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled)
break;
for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5F_mem_t, mem_type)) {
- H5MF_alloc_to_fs_type(f, mem_type, alloc_size, &fsm_type);
+ H5MF__alloc_to_fs_type(f, mem_type, alloc_size, &fsm_type);
if(pass_count == 0) { /* this is the first pass */
HDassert(fsm_type > H5F_MEM_PAGE_DEFAULT);
@@ -2906,6 +2918,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled)
needed_ring = H5AC_RING_MDFSM;
else
needed_ring = H5AC_RING_RDFSM;
+
if(needed_ring != curr_ring) {
H5AC_set_ring(needed_ring, NULL);
curr_ring = needed_ring;
@@ -3136,8 +3149,8 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled)
/* should only be called if file is opened R/W */
HDassert(H5F_INTENT(f) & H5F_ACC_RDWR);
- H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fs_type);
- H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fs_type);
+ H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fs_type);
+ H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fs_type);
HDassert(sm_fshdr_fs_type > H5F_MEM_PAGE_DEFAULT);
HDassert(sm_fshdr_fs_type < H5F_MEM_PAGE_LARGE_SUPER);
@@ -3153,8 +3166,8 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled)
sm_sinfo_fspace = f->shared->fs_man[sm_fssinfo_fs_type];
if(H5F_PAGED_AGGR(f)) {
- H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fs_type);
- H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fs_type);
+ H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fs_type);
+ H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fs_type);
HDassert(lg_fshdr_fs_type >= H5F_MEM_PAGE_LARGE_SUPER);
HDassert(lg_fshdr_fs_type < H5F_MEM_PAGE_NTYPES);
@@ -3398,7 +3411,7 @@ H5MF__fsm_type_is_self_referential(H5F_t *f, H5F_mem_page_t fsm_type)
H5F_mem_page_t lg_fssinfo_fsm;
hbool_t result = FALSE;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(f);
@@ -3406,12 +3419,12 @@ H5MF__fsm_type_is_self_referential(H5F_t *f, H5F_mem_page_t fsm_type)
HDassert(fsm_type >= H5F_MEM_PAGE_DEFAULT);
HDassert(fsm_type < H5F_MEM_PAGE_NTYPES);
- H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm);
- H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm);
+ H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm);
+ H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm);
if(H5F_PAGED_AGGR(f)) {
- H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm);
- H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm);
+ H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm);
+ H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm);
result = (fsm_type == sm_fshdr_fsm) || (fsm_type == sm_fssinfo_fsm)
|| (fsm_type == lg_fshdr_fsm) || (fsm_type == lg_fssinfo_fsm);
@@ -3460,15 +3473,15 @@ H5MF__fsm_is_self_referential(H5F_t *f, H5FS_t *fspace)
HDassert(f->shared);
HDassert(fspace);
- H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm);
- H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm);
+ H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm);
+ H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm);
if(H5F_PAGED_AGGR(f)) {
H5F_mem_page_t lg_fshdr_fsm;
H5F_mem_page_t lg_fssinfo_fsm;
- H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm);
- H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm);
+ H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm);
+ H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm);
result = (fspace == f->shared->fs_man[sm_fshdr_fsm]) ||
(fspace == f->shared->fs_man[sm_fssinfo_fsm]) ||
@@ -3609,8 +3622,8 @@ H5MF_tidy_self_referential_fsm_hack(H5F_t *f)
* this -- we can use the regular I/O methods even if
* paged aggregation and page buffering is enabled.
*/
- H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fs_type);
- H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fs_type);
+ H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fs_type);
+ H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fs_type);
HDassert(sm_fshdr_fs_type > H5F_MEM_PAGE_DEFAULT);
HDassert(sm_fshdr_fs_type < H5F_MEM_PAGE_LARGE_SUPER);
@@ -3648,8 +3661,8 @@ H5MF_tidy_self_referential_fsm_hack(H5F_t *f)
} /* end if */
if(H5F_PAGED_AGGR(f)) {
- H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fs_type);
- H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fs_type);
+ H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fs_type);
+ H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fs_type);
HDassert(lg_fshdr_fs_type >= H5F_MEM_PAGE_LARGE_SUPER);
HDassert(lg_fshdr_fs_type < H5F_MEM_PAGE_NTYPES);
diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c
index cd80a10..5ab1834 100644
--- a/src/H5MFaggr.c
+++ b/src/H5MFaggr.c
@@ -59,6 +59,8 @@ static herr_t H5MF__aggr_free(H5F_t *f, H5FD_mem_t type,
H5F_blk_aggr_t *aggr);
static haddr_t H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr,
H5F_blk_aggr_t *other_aggr, H5FD_mem_t type, hsize_t size);
+static herr_t H5MF__aggr_reset(H5F_t *f, H5F_blk_aggr_t *aggr);
+static htri_t H5MF__aggr_can_shrink_eoa(H5F_t *f, H5FD_mem_t type, H5F_blk_aggr_t *aggr);
/*********************/
@@ -179,7 +181,7 @@ HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size);
/*
* If the aggregation feature is enabled for this file and strategy is not H5F_FILE_SPACE_NONE,
* allocate "generic" space and sub-allocate out of that, if possible.
- * Otherwise just allocate through H5F_alloc().
+ * Otherwise just allocate through H5F__alloc().
*/
if((f->shared->feature_flags & aggr->feature_flag) && f->shared->fs_strategy != H5F_FSPACE_STRATEGY_NONE) {
haddr_t aggr_frag_addr = HADDR_UNDEF; /* Address of aggregrator fragment */
@@ -193,18 +195,18 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz
#endif /* H5MF_AGGR_DEBUG */
/* Turn off alignment if allocation < threshold */
- alignment = H5F_ALIGNMENT(f);
- if(!((alignment > 1) && (size >= H5F_THRESHOLD(f))))
- alignment = 0; /* no alignment */
+ alignment = H5F_ALIGNMENT(f);
+ if(!((alignment > 1) && (size >= H5F_THRESHOLD(f))))
+ alignment = 0; /* no alignment */
/* Generate fragment if aggregator is mis-aligned */
- if(alignment && H5F_addr_gt(aggr->addr, 0) && (aggr_mis_align = (aggr->addr + H5F_BASE_ADDR(f)) % alignment)) {
- aggr_frag_addr = aggr->addr;
- aggr_frag_size = alignment - aggr_mis_align;
- } /* end if */
+ if(alignment && H5F_addr_gt(aggr->addr, 0) && (aggr_mis_align = (aggr->addr + H5F_BASE_ADDR(f)) % alignment)) {
+ aggr_frag_addr = aggr->addr;
+ aggr_frag_size = alignment - aggr_mis_align;
+ } /* end if */
- alloc_type = aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA ? H5FD_MEM_DEFAULT : H5FD_MEM_DRAW;
- other_alloc_type = other_aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA ? H5FD_MEM_DEFAULT : H5FD_MEM_DRAW;
+ alloc_type = aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA ? H5FD_MEM_DEFAULT : H5FD_MEM_DRAW;
+ other_alloc_type = other_aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA ? H5FD_MEM_DEFAULT : H5FD_MEM_DRAW;
/* Check if the space requested is larger than the space left in the block */
if((size + aggr_frag_size) > aggr->size) {
@@ -212,73 +214,74 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz
/* Check if the block asked for is too large for 'normal' aggregator block */
if(size >= aggr->alloc_size) {
- hsize_t ext_size = size + aggr_frag_size;
+ hsize_t ext_size = size + aggr_frag_size;
/* Check for overlapping into file's temporary allocation space */
if(H5F_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space")
- if((aggr->addr > 0) && (extended = H5F__try_extend(f, alloc_type, (aggr->addr + aggr->size), ext_size)) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space")
- else if (extended) {
- /* aggr->size is unchanged */
- ret_value = aggr->addr + aggr_frag_size;
- aggr->addr += ext_size;
- aggr->tot_size += ext_size;
- } else {
+ if((aggr->addr > 0) && (extended = H5F__try_extend(f, alloc_type, (aggr->addr + aggr->size), ext_size)) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space")
+ else if(extended) {
+ /* aggr->size is unchanged */
+ ret_value = aggr->addr + aggr_frag_size;
+ aggr->addr += ext_size;
+ aggr->tot_size += ext_size;
+ }
+ else {
/* Release "other" aggregator, if it exists, is at the end of the allocated space,
* has allocated more than one block and the unallocated space is greater than its
* allocation block size.
*/
- if((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) &&
- (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) {
+ if((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) &&
+ (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) {
if(H5MF__aggr_free(f, other_alloc_type, other_aggr) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block")
- } /* end if */
+ } /* end if */
/* Allocate space from the VFD (i.e. at the end of the file) */
- if(HADDR_UNDEF == (ret_value = H5F__alloc(f, alloc_type, size, &eoa_frag_addr, &eoa_frag_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space")
+ if(HADDR_UNDEF == (ret_value = H5F__alloc(f, alloc_type, size, &eoa_frag_addr, &eoa_frag_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space")
} /* end else */
} /* end if */
- else {
- hsize_t ext_size = aggr->alloc_size;
+ else {
+ hsize_t ext_size = aggr->alloc_size;
/* Allocate another block */
#ifdef H5MF_AGGR_DEBUG
HDfprintf(stderr, "%s: Allocating block\n", FUNC);
#endif /* H5MF_AGGR_DEBUG */
- if(aggr_frag_size > (ext_size - size))
- ext_size += (aggr_frag_size - (ext_size - size));
+ if(aggr_frag_size > (ext_size - size))
+ ext_size += (aggr_frag_size - (ext_size - size));
/* Check for overlapping into file's temporary allocation space */
if(H5F_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space")
- if((aggr->addr > 0) && (extended = H5F__try_extend(f, alloc_type, (aggr->addr + aggr->size), ext_size)) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space")
- else if(extended) {
- aggr->addr += aggr_frag_size;
- aggr->size += (ext_size - aggr_frag_size);
- aggr->tot_size += ext_size;
- } /* end else-if */
- else {
+ if((aggr->addr > 0) && (extended = H5F__try_extend(f, alloc_type, (aggr->addr + aggr->size), ext_size)) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space")
+ else if(extended) {
+ aggr->addr += aggr_frag_size;
+ aggr->size += (ext_size - aggr_frag_size);
+ aggr->tot_size += ext_size;
+ } /* end else-if */
+ else {
haddr_t new_space; /* Address of new space allocated */
/* Release "other" aggregator, if it exists, is at the end of the allocated space,
* has allocated more than one block and the unallocated space is greater than its
* allocation block size.
*/
- if((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) &&
- (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) {
+ if((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) &&
+ (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) {
if(H5MF__aggr_free(f, other_alloc_type, other_aggr) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block")
- } /* end if */
+ } /* end if */
/* Allocate space from the VFD (i.e. at the end of the file) */
- if(HADDR_UNDEF == (new_space = H5F__alloc(f, alloc_type, aggr->alloc_size, &eoa_frag_addr, &eoa_frag_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space")
+ if(HADDR_UNDEF == (new_space = H5F__alloc(f, alloc_type, aggr->alloc_size, &eoa_frag_addr, &eoa_frag_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space")
/* Return the unused portion of the block to a free list */
if(aggr->size > 0)
@@ -307,32 +310,32 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
} /* end else */
} /* end else */
- /* Allocate space out of the metadata block */
- ret_value = aggr->addr;
- aggr->size -= size;
- aggr->addr += size;
+ /* Allocate space out of the metadata block */
+ ret_value = aggr->addr;
+ aggr->size -= size;
+ aggr->addr += size;
} /* end else */
- /* Freeing any possible fragment due to file allocation */
- if(eoa_frag_size)
- if(H5MF_xfree(f, alloc_type, eoa_frag_addr, eoa_frag_size) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment")
+ /* Freeing any possible fragment due to file allocation */
+ if(eoa_frag_size)
+ if(H5MF_xfree(f, alloc_type, eoa_frag_addr, eoa_frag_size) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment")
- /* Freeing any possible fragment due to alignment in the block after extension */
+ /* Freeing any possible fragment due to alignment in the block after extension */
if(extended && aggr_frag_size)
- if(H5MF_xfree(f, alloc_type, aggr_frag_addr, aggr_frag_size) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment")
+ if(H5MF_xfree(f, alloc_type, aggr_frag_addr, aggr_frag_size) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment")
} /* end if */
else {
/* Allocate space out of the block */
- ret_value = aggr->addr + aggr_frag_size;
- aggr->size -= (size + aggr_frag_size);
- aggr->addr += (size + aggr_frag_size);
-
- /* free any possible fragment */
- if(aggr_frag_size)
- if(H5MF_xfree(f, alloc_type, aggr_frag_addr, aggr_frag_size) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment")
+ ret_value = aggr->addr + aggr_frag_size;
+ aggr->size -= (size + aggr_frag_size);
+ aggr->addr += (size + aggr_frag_size);
+
+ /* free any possible fragment */
+ if(aggr_frag_size)
+ if(H5MF_xfree(f, alloc_type, aggr_frag_addr, aggr_frag_size) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment")
} /* end else */
} /* end if */
else {
@@ -341,10 +344,10 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space")
/* Check if fragment was generated */
- if(eoa_frag_size)
+ if(eoa_frag_size)
/* Put fragment on the free list */
- if(H5MF_xfree(f, type, eoa_frag_addr, eoa_frag_size) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment")
+ if(H5MF_xfree(f, type, eoa_frag_addr, eoa_frag_size) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment")
} /* end else */
/* Sanity check for overlapping into file's temporary allocation space */
@@ -403,53 +406,53 @@ H5MF__aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr,
/* Check if this aggregator is active */
if(f->shared->feature_flags & aggr->feature_flag) {
/*
- * If the block being tested adjoins the beginning of the aggregator
+ * If the block being tested adjoins the beginning of the aggregator
* block, check if the aggregator can accomodate the extension.
*/
if(H5F_addr_eq(blk_end, aggr->addr)) {
- haddr_t eoa; /* EOA for the file */
-
- /* Get the EOA for the file */
- if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, type)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "Unable to get eoa")
-
- /* If the aggregator is at the end of file: */
- if(H5F_addr_eq(eoa, aggr->addr + aggr->size)) {
- /* If extra_requested is below percentage threshold, extend block into the aggregator. */
- if(extra_requested <= (hsize_t)(EXTEND_THRESHOLD * (float)aggr->size)) {
- aggr->size -= extra_requested;
- aggr->addr += extra_requested;
-
- /* Indicate success */
- HGOTO_DONE(TRUE);
- } /* end if */
- /*
- * If extra_requested is above percentage threshold:
- * 1) "bubble" up the aggregator by aggr->alloc_size or extra_requested
- * 2) extend the block into the aggregator
- */
- else {
- hsize_t extra = (extra_requested < aggr->alloc_size) ? aggr->alloc_size : extra_requested;
+ haddr_t eoa; /* EOA for the file */
+
+ /* Get the EOA for the file */
+ if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, type)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "Unable to get eoa")
+
+ /* If the aggregator is at the end of file: */
+ if(H5F_addr_eq(eoa, aggr->addr + aggr->size)) {
+ /* If extra_requested is below percentage threshold, extend block into the aggregator. */
+ if(extra_requested <= (hsize_t)(EXTEND_THRESHOLD * (float)aggr->size)) {
+ aggr->size -= extra_requested;
+ aggr->addr += extra_requested;
+
+ /* Indicate success */
+ HGOTO_DONE(TRUE);
+ } /* end if */
+ /*
+ * If extra_requested is above percentage threshold:
+ * 1) "bubble" up the aggregator by aggr->alloc_size or extra_requested
+ * 2) extend the block into the aggregator
+ */
+ else {
+ hsize_t extra = (extra_requested < aggr->alloc_size) ? aggr->alloc_size : extra_requested;
if((ret_value = H5F__try_extend(f, type, (aggr->addr + aggr->size), extra)) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending file")
- else if(ret_value == TRUE) {
- /* Shift the aggregator block by the extra requested */
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending file")
+ else if(ret_value == TRUE) {
+ /* Shift the aggregator block by the extra requested */
/* (allocates the space for the extra_requested) */
- aggr->addr += extra_requested;
+ aggr->addr += extra_requested;
- /* Add extra to the aggregator's total allocated amount */
- aggr->tot_size += extra;
+ /* Add extra to the aggregator's total allocated amount */
+ aggr->tot_size += extra;
/* Account for any space added to the aggregator */
/* (either 0 (if extra_requested > aggr->alloc_size) or
* (aggr->alloc_size - extra_requested) -QAK
*/
- aggr->size += extra;
- aggr->size -= extra_requested;
- } /* end else-if */
- } /* end else */
- } /* end if */
+ aggr->size += extra;
+ aggr->size -= extra_requested;
+ } /* end else-if */
+ } /* end else */
+ } /* end if */
else {
/* The aggreator is not at end of file */
/* Check if aggregator has enough internal space to satisfy the extension. */
@@ -461,8 +464,8 @@ H5MF__aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr,
/* Indicate success */
HGOTO_DONE(TRUE);
} /* end if */
- } /* end else */
- } /* end if */
+ } /* end else */
+ } /* end if */
} /* end if */
done:
@@ -471,7 +474,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5MF_aggr_can_absorb
+ * Function: H5MF__aggr_can_absorb
*
* Purpose: Check if a section adjoins an aggregator block and one can
* absorb the other.
@@ -486,12 +489,12 @@ done:
*-------------------------------------------------------------------------
*/
htri_t
-H5MF_aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr,
+H5MF__aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr,
const H5MF_free_section_t *sect, H5MF_shrink_type_t *shrink)
{
htri_t ret_value = FALSE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Check args */
HDassert(f);
@@ -506,7 +509,7 @@ H5MF_aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr,
if(H5F_addr_eq((sect->sect_info.addr + sect->sect_info.size), aggr->addr)
|| H5F_addr_eq((aggr->addr + aggr->size), sect->sect_info.addr)) {
#ifdef H5MF_AGGR_DEBUG
-HDfprintf(stderr, "%s: section {%a, %Hu} adjoins aggr = {%a, %Hu}\n", "H5MF_aggr_can_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, aggr->size);
+HDfprintf(stderr, "%s: section {%a, %Hu} adjoins aggr = {%a, %Hu}\n", "H5MF__aggr_can_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, aggr->size);
#endif /* H5MF_AGGR_DEBUG */
/* Check if aggregator would get too large and should be absorbed into section */
if((aggr->size + sect->sect_info.size) >= aggr->alloc_size)
@@ -521,11 +524,11 @@ HDfprintf(stderr, "%s: section {%a, %Hu} adjoins aggr = {%a, %Hu}\n", "H5MF_aggr
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5MF_aggr_can_absorb() */
+} /* end H5MF__aggr_can_absorb() */
/*-------------------------------------------------------------------------
- * Function: H5MF_aggr_absorb
+ * Function: H5MF__aggr_absorb
*
* Purpose: Absorb a free space section into an aggregator block or
* vice versa.
@@ -539,10 +542,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5MF_aggr_absorb(const H5F_t H5_ATTR_UNUSED *f, H5F_blk_aggr_t *aggr, H5MF_free_section_t *sect,
+H5MF__aggr_absorb(const H5F_t H5_ATTR_UNUSED *f, H5F_blk_aggr_t *aggr, H5MF_free_section_t *sect,
hbool_t allow_sect_absorb)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Check args */
HDassert(f);
@@ -556,7 +559,7 @@ H5MF_aggr_absorb(const H5F_t H5_ATTR_UNUSED *f, H5F_blk_aggr_t *aggr, H5MF_free_
/* Check if the section adjoins the beginning or end of the aggregator */
if(H5F_addr_eq((sect->sect_info.addr + sect->sect_info.size), aggr->addr)) {
#ifdef H5MF_AGGR_DEBUG
-HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins front of section = {%a, %Hu}\n", "H5MF_aggr_absorb", aggr->addr, aggr->size, sect->sect_info.addr, sect->sect_info.size);
+HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins front of section = {%a, %Hu}\n", "H5MF__aggr_absorb", aggr->addr, aggr->size, sect->sect_info.addr, sect->sect_info.size);
#endif /* H5MF_AGGR_DEBUG */
/* Absorb aggregator onto end of section */
sect->sect_info.size += aggr->size;
@@ -566,7 +569,7 @@ HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins front of section = {%a, %Hu}\n", "
HDassert(H5F_addr_eq((aggr->addr + aggr->size), sect->sect_info.addr));
#ifdef H5MF_AGGR_DEBUG
-HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins end of section = {%a, %Hu}\n", "H5MF_aggr_absorb", aggr->addr, aggr->size, sect->sect_info.addr, sect->sect_info.size);
+HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins end of section = {%a, %Hu}\n", "H5MF__aggr_absorb", aggr->addr, aggr->size, sect->sect_info.addr, sect->sect_info.size);
#endif /* H5MF_AGGR_DEBUG */
/* Absorb aggregator onto beginning of section */
sect->sect_info.addr -= aggr->size;
@@ -582,7 +585,7 @@ HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins end of section = {%a, %Hu}\n", "H5
/* Check if the section adjoins the beginning or end of the aggregator */
if(H5F_addr_eq((sect->sect_info.addr + sect->sect_info.size), aggr->addr)) {
#ifdef H5MF_AGGR_DEBUG
-HDfprintf(stderr, "%s: section {%a, %Hu} adjoins front of aggr = {%a, %Hu}\n", "H5MF_aggr_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, aggr->size);
+HDfprintf(stderr, "%s: section {%a, %Hu} adjoins front of aggr = {%a, %Hu}\n", "H5MF__aggr_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, aggr->size);
#endif /* H5MF_AGGR_DEBUG */
/* Absorb section onto front of aggregator */
aggr->addr -= sect->sect_info.size;
@@ -598,7 +601,7 @@ HDfprintf(stderr, "%s: section {%a, %Hu} adjoins front of aggr = {%a, %Hu}\n", "
HDassert(H5F_addr_eq((aggr->addr + aggr->size), sect->sect_info.addr));
#ifdef H5MF_AGGR_DEBUG
-HDfprintf(stderr, "%s: section {%a, %Hu} adjoins end of aggr = {%a, %Hu}\n", "H5MF_aggr_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, aggr->size);
+HDfprintf(stderr, "%s: section {%a, %Hu} adjoins end of aggr = {%a, %Hu}\n", "H5MF__aggr_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, aggr->size);
#endif /* H5MF_AGGR_DEBUG */
/* Absorb section onto end of aggregator */
aggr->size += sect->sect_info.size;
@@ -608,11 +611,11 @@ HDfprintf(stderr, "%s: section {%a, %Hu} adjoins end of aggr = {%a, %Hu}\n", "H5
} /* end else */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5MF_aggr_absorb() */
+} /* end H5MF__aggr_absorb() */
/*-------------------------------------------------------------------------
- * Function: H5MF_aggr_query
+ * Function: H5MF__aggr_query
*
* Purpose: Query a block aggregator's current address & size info
*
@@ -625,10 +628,10 @@ HDfprintf(stderr, "%s: section {%a, %Hu} adjoins end of aggr = {%a, %Hu}\n", "H5
*-------------------------------------------------------------------------
*/
herr_t
-H5MF_aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, haddr_t *addr,
+H5MF__aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, haddr_t *addr,
hsize_t *size)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Check args */
HDassert(f);
@@ -644,7 +647,7 @@ H5MF_aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, haddr_t *addr,
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5MF_aggr_query() */
+} /* end H5MF__aggr_query() */
/*-------------------------------------------------------------------------
@@ -737,11 +740,11 @@ H5MF_free_aggrs(H5F_t *f)
HDassert(f->shared->lf);
/* Retrieve metadata aggregator info, if available */
- if(H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0)
+ if(H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats")
/* Retrieve 'small data' aggregator info, if available */
- if(H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size) < 0)
+ if(H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats")
/* Make certain we release the aggregator that's later in the file first */
@@ -774,7 +777,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5MF_aggr_can_shrink_eoa
+ * Function: H5MF__aggr_can_shrink_eoa
*
* Purpose: Check if the remaining space in the aggregator is at EOA
*
@@ -786,12 +789,12 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5MF_aggr_can_shrink_eoa(H5F_t *f, H5FD_mem_t type, H5F_blk_aggr_t *aggr)
+H5MF__aggr_can_shrink_eoa(H5F_t *f, H5FD_mem_t type, H5F_blk_aggr_t *aggr)
{
haddr_t eoa = HADDR_UNDEF; /* EOA for the file */
htri_t ret_value = FALSE; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(f);
@@ -808,7 +811,7 @@ H5MF_aggr_can_shrink_eoa(H5F_t *f, H5FD_mem_t type, H5F_blk_aggr_t *aggr)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_aggr_can_shrink_eoa() */
+} /* H5MF__aggr_can_shrink_eoa() */
/*-------------------------------------------------------------------------
@@ -882,17 +885,17 @@ H5MF_aggrs_try_shrink_eoa(H5F_t *f)
HDassert(f);
HDassert(f->shared);
- if((ma_status = H5MF_aggr_can_shrink_eoa(f, H5FD_MEM_DEFAULT, &(f->shared->meta_aggr))) < 0)
+ if((ma_status = H5MF__aggr_can_shrink_eoa(f, H5FD_MEM_DEFAULT, &(f->shared->meta_aggr))) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats")
if(ma_status > 0)
- if(H5MF__aggr_free(f, H5FD_MEM_DEFAULT, &(f->shared->meta_aggr)) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa")
+ if(H5MF__aggr_free(f, H5FD_MEM_DEFAULT, &(f->shared->meta_aggr)) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa")
- if((sda_status = H5MF_aggr_can_shrink_eoa(f, H5FD_MEM_DRAW, &(f->shared->sdata_aggr))) < 0)
+ if((sda_status = H5MF__aggr_can_shrink_eoa(f, H5FD_MEM_DRAW, &(f->shared->sdata_aggr))) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats")
if(sda_status > 0)
- if(H5MF__aggr_free(f, H5FD_MEM_DRAW, &(f->shared->sdata_aggr)) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa")
+ if(H5MF__aggr_free(f, H5FD_MEM_DRAW, &(f->shared->sdata_aggr)) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa")
ret_value = (ma_status || sda_status);
diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c
index 592ca87..eedb72e 100644
--- a/src/H5MFdbg.c
+++ b/src/H5MFdbg.c
@@ -67,6 +67,7 @@ typedef struct {
/* Local Prototypes */
/********************/
+static herr_t H5MF__sects_debug_cb(H5FS_section_info_t *_sect, void *_udata);
/*********************/
/* Package Variables */
@@ -84,7 +85,7 @@ typedef struct {
/*-------------------------------------------------------------------------
- * Function: H5MF_sects_debug_cb
+ * Function: H5MF__sects_debug_cb
*
* Purpose: Prints debugging info about a free space section for a file
*
@@ -97,13 +98,13 @@ typedef struct {
*-------------------------------------------------------------------------
*/
static herr_t
-H5MF_sects_debug_cb(H5FS_section_info_t *_sect, void *_udata)
+H5MF__sects_debug_cb(H5FS_section_info_t *_sect, void *_udata)
{
H5MF_free_section_t *sect = (H5MF_free_section_t *)_sect; /* Section to dump info */
H5MF_debug_iter_ud_t *udata = (H5MF_debug_iter_ud_t *)_udata; /* User data for callbacks */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/*
* Check arguments.
@@ -136,7 +137,7 @@ H5MF_sects_debug_cb(H5FS_section_info_t *_sect, void *_udata)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5MF_sects_debug_cb() */
+} /* end H5MF__sects_debug_cb() */
/*-------------------------------------------------------------------------
@@ -184,7 +185,7 @@ H5MF_sects_debug(H5F_t *f, haddr_t fs_addr, FILE *stream, int indent, int fwidth
udata.fwidth = fwidth;
/* Iterate over all the free space sections */
- if(H5FS_sect_iterate(f, f->shared->fs_man[type], H5MF_sects_debug_cb, &udata) < 0)
+ if(H5FS_sect_iterate(f, f->shared->fs_man[type], H5MF__sects_debug_cb, &udata) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space")
/* Close the free space information */
@@ -201,7 +202,7 @@ done:
#ifdef H5MF_ALLOC_DEBUG_DUMP
/*-------------------------------------------------------------------------
- * Function: H5MF_sects_dump
+ * Function: H5MF__sects_dump
*
* Purpose: Prints debugging info about free space sections for a file.
*
@@ -221,7 +222,7 @@ H5MF_sects_dump(H5F_t *f, FILE *stream)
int fwidth = 50; /* Field width */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL)
+ FUNC_ENTER_PACKAGE_TAG(H5AC__FREESPACE_TAG, FAIL)
#ifdef H5MF_ALLOC_DEBUG
HDfprintf(stderr, "%s: Dumping file free space sections\n", FUNC);
#endif /* H5MF_ALLOC_DEBUG */
@@ -234,7 +235,7 @@ HDfprintf(stderr, "%s: Dumping file free space sections\n", FUNC);
/* Retrieve the 'eoa' for the file */
if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed")
#ifdef H5MF_ALLOC_DEBUG
HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %a\n", FUNC, eoa);
#endif /* H5MF_ALLOC_DEBUG */
@@ -276,13 +277,13 @@ HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %a\n", FUNC, eoa);
hsize_t sda_size = 0; /* Size of "small data aggregator" */
/* Retrieve metadata aggregator info, if available */
- H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
+ H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
#ifdef H5MF_ALLOC_DEBUG
HDfprintf(stderr, "%s: ma_addr = %a, ma_size = %Hu, end of ma = %a\n", FUNC, ma_addr, ma_size, (haddr_t)((ma_addr + ma_size) - 1));
#endif /* H5MF_ALLOC_DEBUG */
/* Retrieve 'small data' aggregator info, if available */
- H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size);
+ H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size);
#ifdef H5MF_ALLOC_DEBUG
HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, sda_addr, sda_size, (haddr_t)((sda_addr + sda_size) - 1));
#endif /* H5MF_ALLOC_DEBUG */
@@ -303,7 +304,7 @@ HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC,
HDfprintf(stream, "%*sSections:\n", indent + 3, "");
/* If there is a free space manager for this type, iterate over them */
- if(f->shared->fs.aggr.fs_man[atype]) {
+ if(f->shared->fs_man[atype]) {
H5MF_debug_iter_ud_t udata; /* User data for callbacks */
/* Prepare user data for section iteration callback */
@@ -327,6 +328,6 @@ HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC,
done:
HDfprintf(stderr, "%s: Done dumping file free space sections\n", FUNC);
FUNC_LEAVE_NOAPI_TAG(ret_value)
-} /* end H5MF_sects_dump() */
+} /* end H5MF__sects_dump() */
#endif /* H5MF_ALLOC_DEBUG_DUMP */
diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h
index fbf9ee8..ec4aab4 100644
--- a/src/H5MFpkg.h
+++ b/src/H5MFpkg.h
@@ -12,12 +12,12 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
- * Tuesday, January 8, 2008
+ * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Tuesday, January 8, 2008
*
- * Purpose: This file contains declarations which are visible only within
- * the H5MF package. Source files outside the H5MF package should
- * include H5MFprivate.h instead.
+ * Purpose: This file contains declarations which are visible only within
+ * the H5MF package. Source files outside the H5MF package should
+ * include H5MFprivate.h instead.
*/
#if !(defined H5MF_FRIEND || defined H5MF_MODULE)
#error "Do not include this file outside the H5MF package!"
@@ -186,24 +186,24 @@ H5_DLL herr_t H5MF__start_fstype(H5F_t *f, H5F_mem_page_t type);
H5_DLL htri_t H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, haddr_t *addr);
H5_DLL herr_t H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_section_t *node);
-H5_DLL herr_t H5MF_sects_dump(H5F_t *f, FILE *stream);
+H5_DLL herr_t H5MF__sects_dump(H5F_t *f, FILE *stream);
-H5_DLL void H5MF_alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type);
+H5_DLL void H5MF__alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type);
/* 'simple/small/large' section routines */
-H5_DLL H5MF_free_section_t *H5MF_sect_new(unsigned ctype, haddr_t sect_off,
+H5_DLL H5MF_free_section_t *H5MF__sect_new(unsigned ctype, haddr_t sect_off,
hsize_t sect_size);
-H5_DLL herr_t H5MF_sect_free(H5FS_section_info_t *sect);
+H5_DLL herr_t H5MF__sect_free(H5FS_section_info_t *sect);
/* Block aggregator routines */
H5_DLL htri_t H5MF__aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr,
H5FD_mem_t type, haddr_t abs_blk_end, hsize_t extra_requested);
-H5_DLL htri_t H5MF_aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr,
+H5_DLL htri_t H5MF__aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr,
const H5MF_free_section_t *sect, H5MF_shrink_type_t *shrink);
-H5_DLL herr_t H5MF_aggr_absorb(const H5F_t *f, H5F_blk_aggr_t *aggr,
+H5_DLL herr_t H5MF__aggr_absorb(const H5F_t *f, H5F_blk_aggr_t *aggr,
H5MF_free_section_t *sect, hbool_t allow_sect_absorb);
-H5_DLL herr_t H5MF_aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr,
+H5_DLL herr_t H5MF__aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr,
haddr_t *addr, hsize_t *size);
/* Testing routines */
diff --git a/src/H5MFsection.c b/src/H5MFsection.c
index fe140a7..3ebc5c8 100644
--- a/src/H5MFsection.c
+++ b/src/H5MFsection.c
@@ -56,44 +56,40 @@
/********************/
/* 'simple/small/large' section callbacks */
-static H5FS_section_info_t *H5MF_sect_deserialize(const H5FS_section_class_t *cls,
+static H5FS_section_info_t *H5MF__sect_deserialize(const H5FS_section_class_t *cls,
const uint8_t *buf, haddr_t sect_addr, hsize_t sect_size, unsigned *des_flags);
-static herr_t H5MF_sect_valid(const H5FS_section_class_t *cls,
+static herr_t H5MF__sect_valid(const H5FS_section_class_t *cls,
const H5FS_section_info_t *sect);
-static H5FS_section_info_t *H5MF_sect_split(H5FS_section_info_t *sect,
+static H5FS_section_info_t *H5MF__sect_split(H5FS_section_info_t *sect,
hsize_t frag_size);
/* 'simple' section callbacks */
-static htri_t H5MF_sect_simple_can_merge(const H5FS_section_info_t *sect1,
+static htri_t H5MF__sect_simple_can_merge(const H5FS_section_info_t *sect1,
const H5FS_section_info_t *sect2, void *udata);
-static herr_t H5MF_sect_simple_merge(H5FS_section_info_t **sect1,
+static herr_t H5MF__sect_simple_merge(H5FS_section_info_t **sect1,
H5FS_section_info_t *sect2, void *udata);
-static htri_t H5MF_sect_simple_can_shrink(const H5FS_section_info_t *_sect,
+static htri_t H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect,
void *udata);
-static herr_t H5MF_sect_simple_shrink(H5FS_section_info_t **_sect,
+static herr_t H5MF__sect_simple_shrink(H5FS_section_info_t **_sect,
void *udata);
/* 'small' section callbacks */
-static herr_t H5MF_sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata);
-static htri_t H5MF_sect_small_can_merge(const H5FS_section_info_t *sect1,
+static herr_t H5MF__sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata);
+static htri_t H5MF__sect_small_can_merge(const H5FS_section_info_t *sect1,
const H5FS_section_info_t *sect2, void *udata);
-static herr_t H5MF_sect_small_merge(H5FS_section_info_t **sect1,
+static herr_t H5MF__sect_small_merge(H5FS_section_info_t **sect1,
H5FS_section_info_t *sect2, void *udata);
-static htri_t H5MF_sect_small_can_shrink(const H5FS_section_info_t *_sect,
- void *udata);
-static herr_t H5MF_sect_small_shrink(H5FS_section_info_t **_sect,
- void *udata);
/* 'large' section callbacks */
-static htri_t H5MF_sect_large_can_merge(const H5FS_section_info_t *sect1,
+static htri_t H5MF__sect_large_can_merge(const H5FS_section_info_t *sect1,
const H5FS_section_info_t *sect2, void *udata);
-static herr_t H5MF_sect_large_merge(H5FS_section_info_t **sect1,
+static herr_t H5MF__sect_large_merge(H5FS_section_info_t **sect1,
H5FS_section_info_t *sect2, void *udata);
-static htri_t H5MF_sect_large_can_shrink(const H5FS_section_info_t *_sect,
+static htri_t H5MF__sect_large_can_shrink(const H5FS_section_info_t *_sect,
void *udata);
-static herr_t H5MF_sect_large_shrink(H5FS_section_info_t **_sect,
+static herr_t H5MF__sect_large_shrink(H5FS_section_info_t **_sect,
void *udata);
/*********************/
@@ -115,14 +111,14 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1] = {{
/* Object methods */
NULL, /* Add section */
NULL, /* Serialize section */
- H5MF_sect_deserialize, /* Deserialize section */
- H5MF_sect_simple_can_merge, /* Can sections merge? */
- H5MF_sect_simple_merge, /* Merge sections */
- H5MF_sect_simple_can_shrink, /* Can section shrink container?*/
- H5MF_sect_simple_shrink, /* Shrink container w/section */
- H5MF_sect_free, /* Free section */
- H5MF_sect_valid, /* Check validity of section */
- H5MF_sect_split, /* Split section node for alignment */
+ H5MF__sect_deserialize, /* Deserialize section */
+ H5MF__sect_simple_can_merge, /* Can sections merge? */
+ H5MF__sect_simple_merge, /* Merge sections */
+ H5MF__sect_simple_can_shrink, /* Can section shrink container?*/
+ H5MF__sect_simple_shrink, /* Shrink container w/section */
+ H5MF__sect_free, /* Free section */
+ H5MF__sect_valid, /* Check validity of section */
+ H5MF__sect_split, /* Split section node for alignment */
NULL, /* Dump debugging for section */
}};
@@ -139,16 +135,16 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1] = {{
NULL, /* Terminate section class */
/* Object methods */
- H5MF_sect_small_add, /* Add section */
+ H5MF__sect_small_add, /* Add section */
NULL, /* Serialize section */
- H5MF_sect_deserialize, /* Deserialize section */
- H5MF_sect_small_can_merge, /* Can sections merge? */
- H5MF_sect_small_merge, /* Merge sections */
- NULL, /* Can section shrink container?*/
- NULL, /* Shrink container w/section */
- H5MF_sect_free, /* Free section */
- H5MF_sect_valid, /* Check validity of section */
- H5MF_sect_split, /* Split section node for alignment */
+ H5MF__sect_deserialize, /* Deserialize section */
+ H5MF__sect_small_can_merge, /* Can sections merge? */
+ H5MF__sect_small_merge, /* Merge sections */
+ NULL, /* Can section shrink container?*/
+ NULL, /* Shrink container w/section */
+ H5MF__sect_free, /* Free section */
+ H5MF__sect_valid, /* Check validity of section */
+ H5MF__sect_split, /* Split section node for alignment */
NULL, /* Dump debugging for section */
}};
@@ -167,14 +163,14 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1] = {{
/* Object methods */
NULL, /* Add section */
NULL, /* Serialize section */
- H5MF_sect_deserialize, /* Deserialize section */
- H5MF_sect_large_can_merge, /* Can sections merge? */
- H5MF_sect_large_merge, /* Merge sections */
- H5MF_sect_large_can_shrink, /* Can section shrink container?*/
- H5MF_sect_large_shrink, /* Shrink container w/section */
- H5MF_sect_free, /* Free section */
- H5MF_sect_valid, /* Check validity of section */
- H5MF_sect_split, /* Split section node for alignment */
+ H5MF__sect_deserialize, /* Deserialize section */
+ H5MF__sect_large_can_merge, /* Can sections merge? */
+ H5MF__sect_large_merge, /* Merge sections */
+ H5MF__sect_large_can_shrink, /* Can section shrink container?*/
+ H5MF__sect_large_shrink, /* Shrink container w/section */
+ H5MF__sect_free, /* Free section */
+ H5MF__sect_valid, /* Check validity of section */
+ H5MF__sect_split, /* Split section node for alignment */
NULL, /* Dump debugging for section */
}};
@@ -196,7 +192,7 @@ H5FL_DEFINE(H5MF_free_section_t);
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_new
+ * Function: H5MF__sect_new
*
* Purpose: Create a new section of "ctype" and return it to the caller
*
@@ -209,12 +205,12 @@ H5FL_DEFINE(H5MF_free_section_t);
*-------------------------------------------------------------------------
*/
H5MF_free_section_t *
-H5MF_sect_new(unsigned ctype, haddr_t sect_off, hsize_t sect_size)
+H5MF__sect_new(unsigned ctype, haddr_t sect_off, hsize_t sect_size)
{
H5MF_free_section_t *sect; /* 'Simple' free space section to add */
H5MF_free_section_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Check arguments. */
HDassert(sect_size);
@@ -236,11 +232,11 @@ H5MF_sect_new(unsigned ctype, haddr_t sect_off, hsize_t sect_size)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5MF_sect_new() */
+} /* end H5MF__sect_new() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_free
+ * Function: H5MF__sect_free
*
* Purpose: Free a 'simple/small/large' section node
*
@@ -253,11 +249,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5MF_sect_free(H5FS_section_info_t *_sect)
+H5MF__sect_free(H5FS_section_info_t *_sect)
{
H5MF_free_section_t *sect = (H5MF_free_section_t *)_sect; /* File free section */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Check arguments. */
HDassert(sect);
@@ -266,11 +262,11 @@ H5MF_sect_free(H5FS_section_info_t *_sect)
sect = H5FL_FREE(H5MF_free_section_t, sect);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5MF_sect_free() */
+} /* H5MF__sect_free() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_deserialize
+ * Function: H5MF__sect_deserialize
*
* Purpose: Deserialize a buffer into a "live" section
*
@@ -283,14 +279,14 @@ H5MF_sect_free(H5FS_section_info_t *_sect)
*-------------------------------------------------------------------------
*/
static H5FS_section_info_t *
-H5MF_sect_deserialize(const H5FS_section_class_t *cls,
+H5MF__sect_deserialize(const H5FS_section_class_t *cls,
const uint8_t H5_ATTR_UNUSED *buf, haddr_t sect_addr,
hsize_t sect_size, unsigned H5_ATTR_UNUSED *des_flags)
{
H5MF_free_section_t *sect; /* New section */
H5FS_section_info_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(cls);
@@ -298,7 +294,7 @@ H5MF_sect_deserialize(const H5FS_section_class_t *cls,
HDassert(sect_size);
/* Create free space section for block */
- if(NULL == (sect = H5MF_sect_new(cls->type, sect_addr, sect_size)))
+ if(NULL == (sect = H5MF__sect_new(cls->type, sect_addr, sect_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't initialize free space section")
/* Set return value */
@@ -306,11 +302,11 @@ H5MF_sect_deserialize(const H5FS_section_class_t *cls,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_deserialize() */
+} /* H5MF__sect_deserialize() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_valid
+ * Function: H5MF__sect_valid
*
* Purpose: Check the validity of a section
*
@@ -323,7 +319,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5MF_sect_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls,
+H5MF__sect_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls,
const H5FS_section_info_t
#ifdef NDEBUG
H5_ATTR_UNUSED
@@ -334,17 +330,17 @@ H5MF_sect_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls,
const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */
#endif /* NDEBUG */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments. */
HDassert(sect);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5MF_sect_valid() */
+} /* H5MF__sect_valid() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_split
+ * Function: H5MF__sect_split
*
* Purpose: Split SECT into 2 sections: fragment for alignment & the aligned section
* SECT's addr and size are updated to point to the aligned section
@@ -357,14 +353,14 @@ H5MF_sect_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls,
*-------------------------------------------------------------------------
*/
static H5FS_section_info_t *
-H5MF_sect_split(H5FS_section_info_t *sect, hsize_t frag_size)
+H5MF__sect_split(H5FS_section_info_t *sect, hsize_t frag_size)
{
H5MF_free_section_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Allocate space for new section */
- if(NULL == (ret_value = H5MF_sect_new(sect->type, sect->addr, frag_size)))
+ if(NULL == (ret_value = H5MF__sect_new(sect->type, sect->addr, frag_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't initialize free space section")
/* Set new section's info */
@@ -373,14 +369,14 @@ H5MF_sect_split(H5FS_section_info_t *sect, hsize_t frag_size)
done:
FUNC_LEAVE_NOAPI((H5FS_section_info_t *)ret_value)
-} /* end H5MF_sect_split() */
+} /* end H5MF__sect_split() */
/*
* "simple" section callbacks
*/
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_simple_can_merge
+ * Function: H5MF__sect_simple_can_merge
*
* Purpose: Can two sections of this type merge?
*
@@ -395,14 +391,14 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5MF_sect_simple_can_merge(const H5FS_section_info_t *_sect1,
+H5MF__sect_simple_can_merge(const H5FS_section_info_t *_sect1,
const H5FS_section_info_t *_sect2, void H5_ATTR_UNUSED *_udata)
{
const H5MF_free_section_t *sect1 = (const H5MF_free_section_t *)_sect1; /* File free section */
const H5MF_free_section_t *sect2 = (const H5MF_free_section_t *)_sect2; /* File free section */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments. */
HDassert(sect1);
@@ -414,11 +410,11 @@ H5MF_sect_simple_can_merge(const H5FS_section_info_t *_sect1,
ret_value = H5F_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_simple_can_merge() */
+} /* H5MF__sect_simple_can_merge() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_simple_merge
+ * Function: H5MF__sect_simple_merge
*
* Purpose: Merge two sections of this type
*
@@ -433,14 +429,14 @@ H5MF_sect_simple_can_merge(const H5FS_section_info_t *_sect1,
*-------------------------------------------------------------------------
*/
static herr_t
-H5MF_sect_simple_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
+H5MF__sect_simple_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
void H5_ATTR_UNUSED *_udata)
{
H5MF_free_section_t **sect1 = (H5MF_free_section_t **)_sect1; /* File free section */
H5MF_free_section_t *sect2 = (H5MF_free_section_t *)_sect2; /* File free section */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(sect1);
@@ -453,16 +449,16 @@ H5MF_sect_simple_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2
(*sect1)->sect_info.size += sect2->sect_info.size;
/* Get rid of second section */
- if(H5MF_sect_free((H5FS_section_info_t *)sect2) < 0)
+ if(H5MF__sect_free((H5FS_section_info_t *)sect2) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_simple_merge() */
+} /* H5MF__sect_simple_merge() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_simple_can_shrink
+ * Function: H5MF__sect_simple_can_shrink
*
* Purpose: Can this section shrink the container?
*
@@ -475,7 +471,7 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5MF_sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
+H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
{
const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */
H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
@@ -483,7 +479,7 @@ H5MF_sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
haddr_t end; /* End of section to extend */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(sect);
@@ -518,7 +514,7 @@ HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect-
htri_t status; /* Status from aggregator adjoin */
/* See if section can absorb the aggregator & vice versa */
- if((status = H5MF_aggr_can_absorb(udata->f, &(udata->f->shared->meta_aggr), sect, &(udata->shrink))) < 0)
+ if((status = H5MF__aggr_can_absorb(udata->f, &(udata->f->shared->meta_aggr), sect, &(udata->shrink))) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "error merging section with aggregation block")
else if(status > 0) {
/* Set the aggregator to operate on */
@@ -537,7 +533,7 @@ HDfprintf(stderr, "%s: section {%a, %Hu}, adjoins metadata aggregator\n", FUNC,
htri_t status; /* Status from aggregator adjoin */
/* See if section can absorb the aggregator & vice versa */
- if((status = H5MF_aggr_can_absorb(udata->f, &(udata->f->shared->sdata_aggr), sect, &(udata->shrink))) < 0)
+ if((status = H5MF__aggr_can_absorb(udata->f, &(udata->f->shared->sdata_aggr), sect, &(udata->shrink))) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "error merging section with aggregation block")
else if(status > 0) {
/* Set the aggregator to operate on */
@@ -557,11 +553,11 @@ HDfprintf(stderr, "%s: section {%a, %Hu}, adjoins small data aggregator\n", FUNC
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_simple_can_shrink() */
+} /* H5MF__sect_simple_can_shrink() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_simple_shrink
+ * Function: H5MF__sect_simple_shrink
*
* Purpose: Shrink container with section
*
@@ -574,13 +570,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5MF_sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata)
+H5MF__sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata)
{
H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* File free section */
H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(sect);
@@ -601,14 +597,14 @@ H5MF_sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata)
HDassert(udata->aggr);
/* Absorb the section into the aggregator or vice versa */
- if(H5MF_aggr_absorb(udata->f, udata->aggr, *sect, udata->allow_sect_absorb) < 0)
+ if(H5MF__aggr_absorb(udata->f, udata->aggr, *sect, udata->allow_sect_absorb) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "can't absorb section into aggregator or vice versa")
} /* end else */
/* Check for freeing section */
if(udata->shrink != H5MF_SHRINK_SECT_ABSORB_AGGR) {
/* Free section */
- if(H5MF_sect_free((H5FS_section_info_t *)*sect) < 0)
+ if(H5MF__sect_free((H5FS_section_info_t *)*sect) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node")
/* Mark section as freed, for free space manager */
@@ -617,7 +613,7 @@ H5MF_sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_simple_shrink() */
+} /* H5MF__sect_simple_shrink() */
/*
* "small" section callbacks
@@ -625,7 +621,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_small_add
+ * Function: H5MF__sect_small_add
*
* Purpose: Perform actions on a small "meta" action before adding it to the free space manager:
* 1) Drop the section if it is at page end and its size <= page end threshold
@@ -640,7 +636,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5MF_sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata)
+H5MF__sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata)
{
H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* Fractal heap free section */
H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
@@ -648,7 +644,7 @@ H5MF_sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata)
hsize_t rem, prem;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: Entering, section {%a, %Hu}\n", FUNC, (*sect)->sect_info.addr, (*sect)->sect_info.size);
@@ -664,7 +660,7 @@ HDfprintf(stderr, "%s: Entering, section {%a, %Hu}\n", FUNC, (*sect)->sect_info.
/* Drop the section if it is at page end and its size is <= pgend threshold */
if(!rem && (*sect)->sect_info.size <= H5F_PGEND_META_THRES(udata->f) && (*flags & H5FS_ADD_RETURNED_SPACE)) {
- if(H5MF_sect_free((H5FS_section_info_t *)(*sect)) < 0)
+ if(H5MF__sect_free((H5FS_section_info_t *)(*sect)) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node")
*sect = NULL;
*flags &= (unsigned)~H5FS_ADD_RETURNED_SPACE;
@@ -684,122 +680,11 @@ HDfprintf(stderr, "%s: section is adjusted {%a, %Hu}\n", FUNC, (*sect)->sect_inf
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_small_add() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5MF_sect_small_can_shrink
- *
- * Purpose: Can this section shrink the container?
- *
- * Note: A small section is allowed to shrink only at closing.
- *
- * Note: This is unused currently, to maintain the invariant that the
- * file size is always a multiple of the page size.
- *
- * (This function should probably be deleted, or the invariant
- * relaxed)
- *
- * Return: Success: non-negative (TRUE/FALSE)
- * Failure: negative
- *
- * Programmer: Vailin Choi; Dec 2012
- *
- *-------------------------------------------------------------------------
- */
-static htri_t
-H5MF_sect_small_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
-{
- const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */
- H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
- haddr_t eoa; /* End of address space in the file */
- haddr_t end; /* End of section to extend */
- htri_t ret_value = FALSE; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check arguments. */
- HDassert(sect);
- HDassert(udata);
- HDassert(udata->f);
-
- /* Retrieve the end of the file's address space */
- if(HADDR_UNDEF == (eoa = H5FD_get_eoa(udata->f->shared->lf, udata->alloc_type)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed")
-
- /* Compute address of end of section to check */
- end = sect->sect_info.addr + sect->sect_info.size;
-
- /* Check if the section is exactly at the end of the allocated space in the file */
- if(H5F_addr_eq(end, eoa) && sect->sect_info.size == udata->f->shared->fs_page_size) {
- udata->shrink = H5MF_SHRINK_EOA;
-
-#ifdef H5MF_ALLOC_DEBUG_MORE
-HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect->sect_info.addr, sect->sect_info.size, eoa);
-#endif /* H5MF_ALLOC_DEBUG_MORE */
-
- /* Indicate shrinking can occur */
- HGOTO_DONE(TRUE)
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_small_can_shrink() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5MF_sect_small_shrink
- *
- * Purpose: Shrink container with section
- *
- * Note: This is unused currently, to maintain the invariant that the
- * file size is always a multiple of the page size.
- *
- * (This function should probably be deleted, or the invariant
- * relaxed)
- *
- * Return: Success: non-negative
- * Failure: negative
- *
- * Programmer: Vailin Choi; Dec 2012
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5MF_sect_small_shrink(H5FS_section_info_t **_sect, void *_udata)
-{
- H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* File free section */
- H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check arguments. */
- HDassert(sect);
- HDassert((*sect)->sect_info.type == H5MF_FSPACE_SECT_SMALL);
- HDassert(udata);
- HDassert(udata->f);
- HDassert(udata->shrink == H5MF_SHRINK_EOA);
- HDassert(H5F_INTENT(udata->f) & H5F_ACC_RDWR);
-
- /* Release section's space at EOA */
- if(H5F__free(udata->f, udata->alloc_type, (*sect)->sect_info.addr, (*sect)->sect_info.size) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "driver free request failed")
-
- /* Free section */
- if(H5MF_sect_free((H5FS_section_info_t *)*sect) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node")
-
- /* Mark section as freed, for free space manager */
- *sect = NULL;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_small_shrink() */
+} /* H5MF__sect_small_add() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_small_can_merge
+ * Function: H5MF__sect_small_can_merge
*
* Purpose: Can two sections of this type merge?
*
@@ -814,7 +699,7 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5MF_sect_small_can_merge(const H5FS_section_info_t *_sect1,
+H5MF__sect_small_can_merge(const H5FS_section_info_t *_sect1,
const H5FS_section_info_t *_sect2, void *_udata)
{
const H5MF_free_section_t *sect1 = (const H5MF_free_section_t *)_sect1; /* File free section */
@@ -822,7 +707,7 @@ H5MF_sect_small_can_merge(const H5FS_section_info_t *_sect1,
H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
htri_t ret_value = FALSE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments. */
HDassert(sect1);
@@ -842,11 +727,11 @@ HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value);
#endif /* H5MF_ALLOC_DEBUG_MORE */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_small_can_merge() */
+} /* H5MF__sect_small_can_merge() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_small_merge
+ * Function: H5MF__sect_small_merge
*
* Purpose: Merge two sections of this type
*
@@ -862,7 +747,7 @@ HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value);
*-------------------------------------------------------------------------
*/
static herr_t
-H5MF_sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
+H5MF__sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
void *_udata)
{
H5MF_free_section_t **sect1 = (H5MF_free_section_t **)_sect1; /* File free section */
@@ -870,7 +755,7 @@ H5MF_sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(sect1);
@@ -894,18 +779,18 @@ H5MF_sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
if(H5PB_remove_entry(udata->f, (*sect1)->sect_info.addr) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free merged section")
- if(H5MF_sect_free((H5FS_section_info_t *)(*sect1)) < 0)
+ if(H5MF__sect_free((H5FS_section_info_t *)(*sect1)) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node")
*sect1 = NULL;
} /* end if */
/* Get rid of second section */
- if(H5MF_sect_free((H5FS_section_info_t *)sect2) < 0)
+ if(H5MF__sect_free((H5FS_section_info_t *)sect2) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_small_merge() */
+} /* H5MF__sect_small_merge() */
/*
* "Large" section callbacks
@@ -913,7 +798,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_large_can_merge (same as H5MF_sect_simple_can_merge)
+ * Function: H5MF__sect_large_can_merge (same as H5MF__sect_simple_can_merge)
*
* Purpose: Can two sections of this type merge?
*
@@ -927,14 +812,14 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5MF_sect_large_can_merge(const H5FS_section_info_t *_sect1,
+H5MF__sect_large_can_merge(const H5FS_section_info_t *_sect1,
const H5FS_section_info_t *_sect2, void H5_ATTR_UNUSED *_udata)
{
const H5MF_free_section_t *sect1 = (const H5MF_free_section_t *)_sect1; /* File free section */
const H5MF_free_section_t *sect2 = (const H5MF_free_section_t *)_sect2; /* File free section */
htri_t ret_value = FALSE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments. */
HDassert(sect1);
@@ -949,11 +834,11 @@ HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value);
#endif /* H5MF_ALLOC_DEBUG_MORE */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_large_can_merge() */
+} /* H5MF__sect_large_can_merge() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_large_merge (same as H5MF_sect_simple_merge)
+ * Function: H5MF__sect_large_merge (same as H5MF__sect_simple_merge)
*
* Purpose: Merge two sections of this type
*
@@ -967,14 +852,14 @@ HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value);
*-------------------------------------------------------------------------
*/
static herr_t
-H5MF_sect_large_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
+H5MF__sect_large_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
void H5_ATTR_UNUSED *_udata)
{
H5MF_free_section_t **sect1 = (H5MF_free_section_t **)_sect1; /* File free section */
H5MF_free_section_t *sect2 = (H5MF_free_section_t *)_sect2; /* File free section */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(sect1);
@@ -987,16 +872,16 @@ H5MF_sect_large_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
(*sect1)->sect_info.size += sect2->sect_info.size;
/* Get rid of second section */
- if(H5MF_sect_free((H5FS_section_info_t *)sect2) < 0)
+ if(H5MF__sect_free((H5FS_section_info_t *)sect2) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_large_merge() */
+} /* H5MF__sect_large_merge() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_large_can_shrink
+ * Function: H5MF__sect_large_can_shrink
*
* Purpose: Can this section shrink the container?
*
@@ -1008,7 +893,7 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5MF_sect_large_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
+H5MF__sect_large_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
{
const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */
H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
@@ -1016,7 +901,7 @@ H5MF_sect_large_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
haddr_t end; /* End of section to extend */
htri_t ret_value = FALSE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(sect);
@@ -1045,11 +930,11 @@ HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect-
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_large_can_shrink() */
+} /* H5MF__sect_large_can_shrink() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_large_shrink
+ * Function: H5MF__sect_large_shrink
*
* Purpose: Shrink a large-sized section
*
@@ -1061,14 +946,14 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5MF_sect_large_shrink(H5FS_section_info_t **_sect, void *_udata)
+H5MF__sect_large_shrink(H5FS_section_info_t **_sect, void *_udata)
{
H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* File free section */
H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
hsize_t frag_size = 0; /* Fragment size */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(sect);
@@ -1091,7 +976,7 @@ H5MF_sect_large_shrink(H5FS_section_info_t **_sect, void *_udata)
(*sect)->sect_info.size = frag_size;
else {
/* Free section */
- if(H5MF_sect_free((H5FS_section_info_t *)*sect) < 0)
+ if(H5MF__sect_free((H5FS_section_info_t *)*sect) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node")
/* Mark section as freed, for free space manager */
@@ -1100,5 +985,5 @@ H5MF_sect_large_shrink(H5FS_section_info_t **_sect, void *_udata)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_large_shrink() */
+} /* H5MF__sect_large_shrink() */
diff --git a/src/H5O.c b/src/H5O.c
index f700ac9..c5db814 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -435,63 +435,70 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Oget_info
+ * Function: H5Oget_info2
*
- * Purpose: Retrieve information about an object.
+ * Purpose: Retrieve information about an object.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * NOTE: Add a parameter "fields" to indicate selection of object info.
*
- * Programmer: Quincey Koziol
- * November 21 2006
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Neil Fortner
+ * July 7 2010
*
*-------------------------------------------------------------------------
*/
herr_t
-H5Oget_info(hid_t loc_id, H5O_info_t *oinfo)
+H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields)
{
- H5G_loc_t loc; /* Location of group */
+ H5G_loc_t loc; /* Location of group */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*x", loc_id, oinfo);
+ H5TRACE3("e", "i*xIu", loc_id, oinfo, fields);
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!oinfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ if(fields & ~H5O_INFO_ALL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
/* Retrieve the object's information */
- if(H5O__get_info_by_name(&loc, ".", oinfo/*out*/) < 0)
+ if(H5O__get_info_by_name(&loc, ".", oinfo/*out*/, fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Oget_info() */
+} /* end H5Oget_info2() */
-/*-------------------------------------------------------------------------
- * Function: H5Oget_info_by_name
- *
- * Purpose: Retrieve information about an object.
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * November 21 2006
- *
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Function: H5Oget_info_by_name2
+ *
+ * Purpose: Retrieve information about an object.
+ *
+ * NOTE: Add a parameter "fields" to indicate selection of object info.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Neil Fortner
+ * July 7 2010
+ *
+ *-------------------------------------------------------------------------
+ */
herr_t
-H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id)
+H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo,
+ unsigned fields, hid_t lapl_id)
{
H5G_loc_t loc; /* Location of group */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE4("e", "i*s*xi", loc_id, name, oinfo, lapl_id);
+ H5TRACE5("e", "i*s*xIui", loc_id, name, oinfo, fields, lapl_id);
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
@@ -500,44 +507,48 @@ H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lap
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
if(!oinfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ if(fields & ~H5O_INFO_ALL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
/* Retrieve the object's information */
- if(H5O__get_info_by_name(&loc, name, oinfo/*out*/) < 0)
+ if(H5O__get_info_by_name(&loc, name, oinfo/*out*/, fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name)
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Oget_info_by_name() */
+} /* end H5Oget_info_by_name2() */
/*-------------------------------------------------------------------------
- * Function: H5Oget_info_by_idx
+ * Function: H5Oget_info_by_idx2
*
- * Purpose: Retrieve information about an object, according to the order
+ * Purpose: Retrieve information about an object, according to the order
* of an index.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * NOTE: Add a parameter "fields" to indicate selection of object info.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
*
* Programmer: Quincey Koziol
- * November 26 2006
+ * November 26 2006
*
*-------------------------------------------------------------------------
*/
herr_t
-H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, hid_t lapl_id)
+H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields, hid_t lapl_id)
{
H5G_loc_t loc; /* Location of group */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE7("e", "i*sIiIoh*xi", loc_id, group_name, idx_type, order, n, oinfo,
- lapl_id);
+ H5TRACE8("e", "i*sIiIoh*xIui", loc_id, group_name, idx_type, order, n, oinfo,
+ fields, lapl_id);
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
@@ -550,18 +561,20 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(!oinfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ if(fields & ~H5O_INFO_ALL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
/* Retrieve the object's information */
- if(H5O__get_info_by_idx(&loc, group_name, idx_type, order, n, oinfo) < 0)
+ if(H5O__get_info_by_idx(&loc, group_name, idx_type, order, n, oinfo, fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Oget_info_by_idx() */
+} /* end H5Oget_info_by_idx2() */
/*-------------------------------------------------------------------------
@@ -737,9 +750,9 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Ovisit
+ * Function: H5Ovisit2
*
- * Purpose: Recursively visit an object and all the objects reachable
+ * Purpose: Recursively visit an object and all the objects reachable
* from it. If the starting object is a group, all the objects
* linked to from that group will be visited. Links within
* each group are visited according to the order within the
@@ -755,27 +768,30 @@ done:
* iteration index and iteration order given) will be used to in
* the callback about the object.
*
- * Return: Success: The return value of the first operator that
+ * NOTE: Add a a parameter "fields" to indicate selection of
+ * object info to be retrieved to the callback "op".
+ *
+ * Return: Success: The return value of the first operator that
* returns non-zero, or zero if all members were
* processed with no operator returning non-zero.
*
- * Failure: Negative if something goes wrong within the
+ * Failure: Negative if something goes wrong within the
* library, or the negative value returned by one
* of the operators.
*
* Programmer: Quincey Koziol
- * November 25 2007
+ * November 25 2007
*
*-------------------------------------------------------------------------
*/
herr_t
-H5Ovisit(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
- H5O_iterate_t op, void *op_data)
+H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
+ H5O_iterate_t op, void *op_data, unsigned fields)
{
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "iIiIox*x", obj_id, idx_type, order, op, op_data);
+ H5TRACE6("e", "iIiIox*xIu", obj_id, idx_type, order, op, op_data, fields);
/* Check args */
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
@@ -784,20 +800,22 @@ H5Ovisit(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(!op)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
+ if(fields & ~H5O_INFO_ALL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
/* Call internal object visitation routine */
- if((ret_value = H5O__visit(obj_id, ".", idx_type, order, op, op_data)) < 0)
+ if((ret_value = H5O__visit(obj_id, ".", idx_type, order, op, op_data, fields)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Ovisit() */
+} /* end H5Ovisit2() */
/*-------------------------------------------------------------------------
- * Function: H5Ovisit_by_name
+ * Function: H5Ovisit_by_name2
*
- * Purpose: Recursively visit an object and all the objects reachable
+ * Purpose: Recursively visit an object and all the objects reachable
* from it. If the starting object is a group, all the objects
* linked to from that group will be visited. Links within
* each group are visited according to the order within the
@@ -813,28 +831,31 @@ done:
* iteration index and iteration order given) will be used to in
* the callback about the object.
*
- * Return: Success: The return value of the first operator that
+ * NOTE: Add a a parameter "fields" to indicate selection of
+ * object info to be retrieved to the callback "op".
+ *
+ * Return: Success: The return value of the first operator that
* returns non-zero, or zero if all members were
* processed with no operator returning non-zero.
*
- * Failure: Negative if something goes wrong within the
+ * Failure: Negative if something goes wrong within the
* library, or the negative value returned by one
* of the operators.
*
* Programmer: Quincey Koziol
- * November 24 2007
+ * November 24 2007
*
*-------------------------------------------------------------------------
*/
herr_t
-H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
- H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id)
+H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
+ H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields, hid_t lapl_id)
{
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE7("e", "i*sIiIox*xi", loc_id, obj_name, idx_type, order, op, op_data,
- lapl_id);
+ H5TRACE8("e", "i*sIiIox*xIui", loc_id, obj_name, idx_type, order, op, op_data,
+ fields, lapl_id);
/* Check args */
if(!obj_name || !*obj_name)
@@ -845,18 +866,20 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(!op)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
+ if(fields & ~H5O_INFO_ALL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
/* Call internal object visitation routine */
- if((ret_value = H5O__visit(loc_id, obj_name, idx_type, order, op, op_data)) < 0)
+ if((ret_value = H5O__visit(loc_id, obj_name, idx_type, order, op, op_data, fields)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Ovisit_by_name() */
+} /* end H5Ovisit_by_name2() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c
new file mode 100644
index 0000000..876579d
--- /dev/null
+++ b/src/H5Odeprec.c
@@ -0,0 +1,332 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*-------------------------------------------------------------------------
+ *
+ * Purpose: Deprecated functions from the H5O interface. These
+ * functions are here for compatibility purposes and may be
+ * removed in the future. Applications should switch to the
+ * newer APIs.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5Omodule.h" /* This source code file is part of the H5O module */
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Opkg.h" /* Object headers */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Oget_info1
+ *
+ * Purpose: Retrieve information about an object.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo)
+{
+ H5G_loc_t loc; /* Location of group */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*x", loc_id, oinfo);
+
+ /* Check args */
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(!oinfo)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+
+ /* Retrieve the object's information */
+ if(H5O__get_info_by_name(&loc, ".", oinfo/*out*/, H5O_INFO_ALL) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Oget_info1() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Oget_info_by_name1
+ *
+ * Purpose: Retrieve information about an object.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id)
+{
+ H5G_loc_t loc; /* Location of group */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE4("e", "i*s*xi", loc_id, name, oinfo, lapl_id);
+
+ /* Check args */
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(!name || !*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ if(!oinfo)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+
+ /* Verify access property list and set up collective metadata if appropriate */
+ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
+
+ /* Retrieve the object's information */
+ if(H5O__get_info_by_name(&loc, name, oinfo/*out*/, H5O_INFO_ALL) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name)
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Oget_info_by_name1() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Oget_info_by_idx1
+ *
+ * Purpose: Retrieve information about an object, according to the order
+ * of an index.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * November 26 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, hid_t lapl_id)
+{
+ H5G_loc_t loc; /* Location of group */
+ H5G_loc_t obj_loc; /* Location used to open group */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
+ hbool_t loc_found = FALSE; /* Entry at 'name' found */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE7("e", "i*sIiIoh*xi", loc_id, group_name, idx_type, order, n, oinfo,
+ lapl_id);
+
+ /* Check args */
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(!group_name || !*group_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ if(!oinfo)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+
+ /* Verify access property list and set up collective metadata if appropriate */
+ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
+
+ /* Retrieve the object's information */
+ if(H5O__get_info_by_idx(&loc, group_name, idx_type, order, n, oinfo, H5O_INFO_ALL) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
+
+done:
+ /* Release the object location */
+ if(loc_found && H5G_loc_free(&obj_loc) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Oget_info_by_idx1() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Ovisit1
+ *
+ * Purpose: Recursively visit an object and all the objects reachable
+ * from it. If the starting object is a group, all the objects
+ * linked to from that group will be visited. Links within
+ * each group are visited according to the order within the
+ * specified index (unless the specified index does not exist for
+ * a particular group, then the "name" index is used).
+ *
+ * NOTE: Soft links and user-defined links are ignored during
+ * this operation.
+ *
+ * NOTE: Each _object_ reachable from the initial group will only
+ * be visited once. If multiple hard links point to the same
+ * object, the first link to the object's path (according to the
+ * iteration index and iteration order given) will be used to in
+ * the callback about the object.
+ *
+ * Return: Success: The return value of the first operator that
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
+ *
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
+ *
+ * Programmer: Quincey Koziol
+ * November 25 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
+ H5O_iterate_t op, void *op_data)
+{
+ herr_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE5("e", "iIiIox*x", obj_id, idx_type, order, op, op_data);
+
+ /* Check args */
+ if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ if(!op)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
+
+ /* Call internal object visitation routine */
+ if((ret_value = H5O__visit(obj_id, ".", idx_type, order, op, op_data, H5O_INFO_ALL)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Ovisit1() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Ovisit_by_name1
+ *
+ * Purpose: Recursively visit an object and all the objects reachable
+ * from it. If the starting object is a group, all the objects
+ * linked to from that group will be visited. Links within
+ * each group are visited according to the order within the
+ * specified index (unless the specified index does not exist for
+ * a particular group, then the "name" index is used).
+ *
+ * NOTE: Soft links and user-defined links are ignored during
+ * this operation.
+ *
+ * NOTE: Each _object_ reachable from the initial group will only
+ * be visited once. If multiple hard links point to the same
+ * object, the first link to the object's path (according to the
+ * iteration index and iteration order given) will be used to in
+ * the callback about the object.
+ *
+ * Return: Success: The return value of the first operator that
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
+ *
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
+ *
+ * Programmer: Quincey Koziol
+ * November 24 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
+ H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id)
+{
+ herr_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE7("e", "i*sIiIox*xi", loc_id, obj_name, idx_type, order, op, op_data,
+ lapl_id);
+
+ /* Check args */
+ if(!obj_name || !*obj_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ if(!op)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
+
+ /* Verify access property list and set up collective metadata if appropriate */
+ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
+
+ /* Call internal object visitation routine */
+ if((ret_value = H5O__visit(loc_id, obj_name, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Ovisit_by_name1() */
+
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
diff --git a/src/H5Oint.c b/src/H5Oint.c
index c9e82c0..2752a25 100644
--- a/src/H5Oint.c
+++ b/src/H5Oint.c
@@ -61,6 +61,7 @@ typedef struct {
H5SL_t *visited; /* Skip list for tracking visited nodes */
H5O_iterate_t op; /* Application callback */
void *op_data; /* Application's op data */
+ unsigned fields; /* Selection of object info */
} H5O_iter_visit_ud_t;
@@ -2211,20 +2212,22 @@ H5O__get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr)
/*-------------------------------------------------------------------------
- * Function: H5O_get_info
+ * Function: H5O_get_info
*
- * Purpose: Retrieve the information for an object
+ * Purpose: Retrieve the information for an object
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Note: Add a parameter "fields" to indicate selection of object info.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
- * November 21 2006
+ * Programmer: Quincey Koziol
+ * November 21 2006
*
*-------------------------------------------------------------------------
*/
herr_t
-H5O_get_info(const H5O_loc_t *loc, hbool_t want_ih_info, H5O_info_t *oinfo)
+H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields)
{
const H5O_obj_class_t *obj_class; /* Class of object for header */
H5O_t *oh = NULL; /* Object header */
@@ -2240,76 +2243,83 @@ H5O_get_info(const H5O_loc_t *loc, hbool_t want_ih_info, H5O_info_t *oinfo)
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
- /* Reset the object info structure */
- HDmemset(oinfo, 0, sizeof(*oinfo));
-
- /* Retrieve the file's fileno */
- H5F_GET_FILENO(loc->file, oinfo->fileno);
-
- /* Set the object's address */
- oinfo->addr = loc->addr;
-
/* Get class for object */
if(NULL == (obj_class = H5O__obj_class_real(oh)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine object class")
- /* Retrieve the type of the object */
- oinfo->type = obj_class->type;
+ /* Reset the object info structure */
+ HDmemset(oinfo, 0, sizeof(*oinfo));
- /* Set the object's reference count */
- oinfo->rc = oh->nlink;
+ /* Get basic information, if requested */
+ if(fields & H5O_INFO_BASIC) {
+ /* Retrieve the file's fileno */
+ H5F_GET_FILENO(loc->file, oinfo->fileno);
- /* Get modification time for object */
- if(oh->version > H5O_VERSION_1) {
- oinfo->atime = oh->atime;
- oinfo->mtime = oh->mtime;
- oinfo->ctime = oh->ctime;
- oinfo->btime = oh->btime;
- } /* end if */
- else {
- htri_t exists; /* Flag if header message of interest exists */
+ /* Set the object's address */
+ oinfo->addr = loc->addr;
- /* No information for access & modification fields */
- /* (we stopped updating the "modification time" header message for
- * raw data changes, so the "modification time" header message
- * is closest to the 'change time', in POSIX terms - QAK)
- */
- oinfo->atime = 0;
- oinfo->mtime = 0;
- oinfo->btime = 0;
-
- /* Might be information for modification time */
- if((exists = H5O_msg_exists_oh(oh, H5O_MTIME_ID)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME message")
- if(exists > 0) {
- /* Get "old style" modification time info */
- if(NULL == H5O_msg_read_oh(loc->file, oh, H5O_MTIME_ID, &oinfo->ctime))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME message")
+ /* Retrieve the type of the object */
+ oinfo->type = obj_class->type;
+
+ /* Set the object's reference count */
+ oinfo->rc = oh->nlink;
+ }
+
+ /* Get time information, if requested */
+ if(fields & H5O_INFO_TIME) {
+ if(oh->version > H5O_VERSION_1) {
+ oinfo->atime = oh->atime;
+ oinfo->mtime = oh->mtime;
+ oinfo->ctime = oh->ctime;
+ oinfo->btime = oh->btime;
} /* end if */
else {
- /* Check for "new style" modification time info */
- if((exists = H5O_msg_exists_oh(oh, H5O_MTIME_NEW_ID)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME_NEW message")
- if(exists > 0) {
- /* Get "new style" modification time info */
- if(NULL == H5O_msg_read_oh(loc->file, oh, H5O_MTIME_NEW_ID, &oinfo->ctime))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME_NEW message")
+ htri_t exists; /* Flag if header message of interest exists */
+
+ /* No information for access & modification fields */
+ /* (we stopped updating the "modification time" header message for
+ * raw data changes, so the "modification time" header message
+ * is closest to the 'change time', in POSIX terms - QAK)
+ */
+ oinfo->atime = 0;
+ oinfo->mtime = 0;
+ oinfo->btime = 0;
+
+ /* Might be information for modification time */
+ if((exists = H5O_msg_exists_oh(oh, H5O_MTIME_ID)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME message")
+ if(exists > 0) {
+ /* Get "old style" modification time info */
+ if(NULL == H5O_msg_read_oh(loc->file, oh, H5O_MTIME_ID, &oinfo->ctime))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME message")
} /* end if */
- else
- oinfo->ctime = 0;
- } /* end else */
- } /* end else */
+ else {
+ /* Check for "new style" modification time info */
+ if((exists = H5O_msg_exists_oh(oh, H5O_MTIME_NEW_ID)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME_NEW message")
+ if(exists > 0) {
+ /* Get "new style" modification time info */
+ if(NULL == H5O_msg_read_oh(loc->file, oh, H5O_MTIME_NEW_ID, &oinfo->ctime))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME_NEW message")
+ } /* end if */
+ else
+ oinfo->ctime = 0;
+ } /* end else */
+ } /* end else */
+ } /* end if */
- /* Get the information for the object header */
- if(H5O__get_hdr_info_real(oh, &oinfo->hdr) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info")
+ /* Get the information for the object header, if requested */
+ if(fields & H5O_INFO_HDR)
+ if(H5O__get_hdr_info_real(oh, &oinfo->hdr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info")
/* Retrieve # of attributes */
- if(H5O_attr_count_real(loc->file, oh, &oinfo->num_attrs) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute count")
+ if(fields & H5O_INFO_NUM_ATTRS)
+ if(H5O_attr_count_real(loc->file, oh, &oinfo->num_attrs) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute count")
/* Get B-tree & heap metadata storage size, if requested */
- if(want_ih_info) {
+ if(fields & H5O_INFO_META_SIZE) {
/* Check for 'bh_info' callback for this type of object */
if(obj_class->bh_info)
/* Call the object's class 'bh_info' routine */
@@ -2317,9 +2327,10 @@ H5O_get_info(const H5O_loc_t *loc, hbool_t want_ih_info, H5O_info_t *oinfo)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object's btree & heap info")
/* Get B-tree & heap info for any attributes */
- if(oinfo->num_attrs > 0)
+ if(!(fields & H5O_INFO_NUM_ATTRS) || oinfo->num_attrs > 0) {
if(H5O__attr_bh_info(loc->file, oh, &oinfo->meta_size.attr) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute btree & heap info")
+ } /* end if */
} /* end if */
done:
@@ -2338,16 +2349,18 @@ done:
* Note: This routine is needed so that there's a non-API routine
* that can set up VOL / SWMR info (which need a DXPL).
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Note: Add a parameter "fields" to indicate selection of object info.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
*
* Programmer: Quincey Koziol
- * December 28, 2017
+ * December 28, 2017
*
*-------------------------------------------------------------------------
*/
herr_t
-H5O__get_info_by_name(const H5G_loc_t *loc, const char *name, H5O_info_t *oinfo)
+H5O__get_info_by_name(const H5G_loc_t *loc, const char *name, H5O_info_t *oinfo, unsigned fields)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2359,7 +2372,7 @@ H5O__get_info_by_name(const H5G_loc_t *loc, const char *name, H5O_info_t *oinfo)
HDassert(oinfo);
/* Retrieve the object's information */
- if(H5G_loc_info(loc, name, TRUE, oinfo/*out*/) < 0)
+ if(H5G_loc_info(loc, name, oinfo/*out*/, fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info")
done:
@@ -2376,17 +2389,19 @@ done:
* Note: This routine is needed so that there's a non-API routine
* that can set up VOL / SWMR info (which need a DXPL).
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Note: Add a parameter "fields" to indicate selection of object info.
*
- * Programmer: Quincey Koziol
- * December 28, 2017
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * December 28, 2017
*
*-------------------------------------------------------------------------
*/
herr_t
H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo)
+ H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields)
{
H5G_loc_t obj_loc; /* Location used to open group */
H5G_name_t obj_path; /* Opened object group hier. path */
@@ -2412,7 +2427,7 @@ H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t id
loc_found = TRUE;
/* Retrieve the object's information */
- if(H5O_get_info(obj_loc.oloc, TRUE, oinfo) < 0)
+ if(H5O_get_info(obj_loc.oloc, oinfo, fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info")
done:
@@ -2793,7 +2808,7 @@ H5O__visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t *li
H5O_info_t oinfo; /* Object info */
/* Get the object's info */
- if(H5O_get_info(&obj_oloc, TRUE, &oinfo) < 0)
+ if(H5O_get_info(&obj_oloc, &oinfo, udata->fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get object info")
/* Make the application callback */
@@ -2833,7 +2848,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O__visit
*
- * Purpose: Recursively visit an object and all the objects reachable
+ * Purpose: Recursively visit an object and all the objects reachable
* from it. If the starting object is a group, all the objects
* linked to from that group will be visited. Links within
* each group are visited according to the order within the
@@ -2849,22 +2864,24 @@ done:
* iteration index and iteration order given) will be used to in
* the callback about the object.
*
- * Return: Success: The return value of the first operator that
+ * Note: Add a parameter "fields" to indicate selection of object info.
+ *
+ * Return: Success: The return value of the first operator that
* returns non-zero, or zero if all members were
* processed with no operator returning non-zero.
*
- * Failure: Negative if something goes wrong within the
+ * Failure: Negative if something goes wrong within the
* library, or the negative value returned by one
* of the operators.
*
* Programmer: Quincey Koziol
- * November 24 2007
+ * November 24 2007
*
*-------------------------------------------------------------------------
*/
herr_t
H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
- H5_iter_order_t order, H5O_iterate_t op, void *op_data)
+ H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields)
{
H5O_iter_visit_ud_t udata; /* User data for callback */
H5G_loc_t loc; /* Location of reference object */
@@ -2896,7 +2913,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
loc_found = TRUE;
/* Get the object's info */
- if(H5O_get_info(&obj_oloc, TRUE, &oinfo) < 0)
+ if(H5O_get_info(&obj_oloc, &oinfo, fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info")
/* Open the object */
@@ -2925,6 +2942,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
udata.start_loc = &start_loc;
udata.op = op;
udata.op_data = op_data;
+ udata.fields = fields;
/* Create skip list to store visited object information */
if((udata.visited = H5SL_create(H5SL_TYPE_OBJ, NULL)) == NULL)
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index f535e50..616f96b 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -567,15 +567,15 @@ H5_DLL int H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted);
H5_DLL herr_t H5O__link(const H5O_loc_t *loc, int adjust);
H5_DLL htri_t H5O__exists_by_name(const H5G_loc_t *loc, const char *name);
H5_DLL herr_t H5O__get_info_by_name(const H5G_loc_t *loc, const char *name,
- H5O_info_t *oinfo);
+ H5O_info_t *oinfo, unsigned fields);
H5_DLL herr_t H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo);
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields);
H5_DLL herr_t H5O__set_comment_by_name(const H5G_loc_t *loc, const char *name,
const char *comment);
H5_DLL ssize_t H5O__get_comment_by_name(const H5G_loc_t *loc, const char *name,
char *comment, size_t bufsize);
H5_DLL herr_t H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
- H5_iter_order_t order, H5O_iterate_t op, void *op_data);
+ H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields);
H5_DLL herr_t H5O__inc_rc(H5O_t *oh);
H5_DLL herr_t H5O__dec_rc(H5O_t *oh);
H5_DLL herr_t H5O__free(H5O_t *oh);
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 696fd38..10063d5 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -881,8 +881,7 @@ H5_DLL herr_t H5O_bogus_oh(H5F_t *f, H5O_t *oh, unsigned mesg_id, unsigned mesg_
#endif /* H5O_ENABLE_BOGUS */
H5_DLL herr_t H5O_delete(H5F_t *f, haddr_t addr);
H5_DLL herr_t H5O_get_hdr_info(const H5O_loc_t *oloc, H5O_hdr_info_t *hdr);
-H5_DLL herr_t H5O_get_info(const H5O_loc_t *oloc, hbool_t want_ih_info,
- H5O_info_t *oinfo);
+H5_DLL herr_t H5O_get_info(const H5O_loc_t *oloc, H5O_info_t *oinfo, unsigned fields);
H5_DLL herr_t H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type);
H5_DLL herr_t H5O_get_create_plist(const H5O_loc_t *loc, struct H5P_genplist_t *oc_plist);
H5_DLL hid_t H5O_open_name(const H5G_loc_t *loc, const char *name, hbool_t app_ref);
diff --git a/src/H5Opublic.h b/src/H5Opublic.h
index 8d6dda4..da2910d 100644
--- a/src/H5Opublic.h
+++ b/src/H5Opublic.h
@@ -73,6 +73,17 @@
#define H5O_SHMESG_MAX_NINDEXES 8
#define H5O_SHMESG_MAX_LIST_SIZE 5000
+/* Flags for H5Oget_info.
+ * Theses flags determine which fields will be filled in in the H5O_info_t
+ * struct.
+ */
+#define H5O_INFO_BASIC 0x0001u /* Fill in the fileno, addr, type, and rc fields */
+#define H5O_INFO_TIME 0x0002u /* Fill in the atime, mtime, ctime, and btime fields */
+#define H5O_INFO_NUM_ATTRS 0x0004u /* Fill in the num_attrs field */
+#define H5O_INFO_HDR 0x0008u /* Fill in the hdr field */
+#define H5O_INFO_META_SIZE 0x0010u /* Fill in the meta_size field */
+#define H5O_INFO_ALL (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS | H5O_INFO_HDR | H5O_INFO_META_SIZE)
+
/*******************/
/* Public Typedefs */
/*******************/
@@ -156,12 +167,12 @@ H5_DLL hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr);
H5_DLL hid_t H5Oopen_by_idx(hid_t loc_id, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id);
H5_DLL htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id);
-H5_DLL herr_t H5Oget_info(hid_t loc_id, H5O_info_t *oinfo);
-H5_DLL herr_t H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo,
- hid_t lapl_id);
-H5_DLL herr_t H5Oget_info_by_idx(hid_t loc_id, const char *group_name,
+H5_DLL herr_t H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields);
+H5_DLL herr_t H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo,
+ unsigned fields, hid_t lapl_id);
+H5_DLL herr_t H5Oget_info_by_idx2(hid_t loc_id, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo,
- hid_t lapl_id);
+ unsigned fields, hid_t lapl_id);
H5_DLL herr_t H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name,
hid_t lcpl_id, hid_t lapl_id);
H5_DLL herr_t H5Oincr_refcount(hid_t object_id);
@@ -174,11 +185,11 @@ H5_DLL herr_t H5Oset_comment_by_name(hid_t loc_id, const char *name,
H5_DLL ssize_t H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize);
H5_DLL ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name,
char *comment, size_t bufsize, hid_t lapl_id);
-H5_DLL herr_t H5Ovisit(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
- H5O_iterate_t op, void *op_data);
-H5_DLL herr_t H5Ovisit_by_name(hid_t loc_id, const char *obj_name,
+H5_DLL herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
+ H5O_iterate_t op, void *op_data, unsigned fields);
+H5_DLL herr_t H5Ovisit_by_name2(hid_t loc_id, const char *obj_name,
H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op,
- void *op_data, hid_t lapl_id);
+ void *op_data, unsigned fields, hid_t lapl_id);
H5_DLL herr_t H5Oclose(hid_t object_id);
H5_DLL herr_t H5Oflush(hid_t obj_id);
H5_DLL herr_t H5Orefresh(hid_t oid);
@@ -205,7 +216,18 @@ typedef struct H5O_stat_t {
} H5O_stat_t;
/* Function prototypes */
+H5_DLL herr_t H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo);
+H5_DLL herr_t H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo,
+ hid_t lapl_id);
+H5_DLL herr_t H5Oget_info_by_idx1(hid_t loc_id, const char *group_name,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo,
+ hid_t lapl_id);
+H5_DLL herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
+ H5O_iterate_t op, void *op_data);
+H5_DLL herr_t H5Ovisit_by_name1(hid_t loc_id, const char *obj_name,
+ H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op,
+ void *op_data, hid_t lapl_id);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
#ifdef __cplusplus
diff --git a/src/H5PB.c b/src/H5PB.c
index dab69f4..a325ad1 100644
--- a/src/H5PB.c
+++ b/src/H5PB.c
@@ -254,23 +254,23 @@ H5PB_print_stats(const H5PB_t *page_buf)
printf("PAGE BUFFER STATISTICS:\n");
- printf("******* METADATA\n");
- printf("\t Total Accesses: %u\n", page_buf->accesses[0]);
- printf("\t Hits: %u\n", page_buf->hits[0]);
- printf("\t Misses: %u\n", page_buf->misses[0]);
- printf("\t Evictions: %u\n", page_buf->evictions[0]);
- printf("\t Bypasses: %u\n", page_buf->bypasses[0]);
- printf("\t Hit Rate = %f%%\n", ((double)page_buf->hits[0]/(page_buf->accesses[0] - page_buf->bypasses[0]))*100);
- printf("*****************\n\n");
-
- printf("******* RAWDATA\n");
- printf("\t Total Accesses: %u\n", page_buf->accesses[1]);
- printf("\t Hits: %u\n", page_buf->hits[1]);
- printf("\t Misses: %u\n", page_buf->misses[1]);
- printf("\t Evictions: %u\n", page_buf->evictions[1]);
- printf("\t Bypasses: %u\n", page_buf->bypasses[1]);
- printf("\t Hit Rate = %f%%\n", ((double)page_buf->hits[1]/(page_buf->accesses[1]-page_buf->bypasses[0]))*100);
- printf("*****************\n\n");
+ HDprintf("******* METADATA\n");
+ HDprintf("\t Total Accesses: %u\n", page_buf->accesses[0]);
+ HDprintf("\t Hits: %u\n", page_buf->hits[0]);
+ HDprintf("\t Misses: %u\n", page_buf->misses[0]);
+ HDprintf("\t Evictions: %u\n", page_buf->evictions[0]);
+ HDprintf("\t Bypasses: %u\n", page_buf->bypasses[0]);
+ HDprintf("\t Hit Rate = %f%%\n", ((double)page_buf->hits[0]/(page_buf->accesses[0] - page_buf->bypasses[0]))*100);
+ HDprintf("*****************\n\n");
+
+ HDprintf("******* RAWDATA\n");
+ HDprintf("\t Total Accesses: %u\n", page_buf->accesses[1]);
+ HDprintf("\t Hits: %u\n", page_buf->hits[1]);
+ HDprintf("\t Misses: %u\n", page_buf->misses[1]);
+ HDprintf("\t Evictions: %u\n", page_buf->evictions[1]);
+ HDprintf("\t Bypasses: %u\n", page_buf->bypasses[1]);
+ HDprintf("\t Hit Rate = %f%%\n", ((double)page_buf->hits[1]/(page_buf->accesses[1]-page_buf->bypasses[0]))*100);
+ HDprintf("*****************\n\n");
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5PB_print_stats */
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index a527510..0daed29 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -152,22 +152,6 @@
#define H5D_XFER_XFORM_COPY H5P__dxfr_xform_copy
#define H5D_XFER_XFORM_CMP H5P__dxfr_xform_cmp
#define H5D_XFER_XFORM_CLOSE H5P__dxfr_xform_close
-/* Definitions for properties of direct chunk write */
-#define H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_SIZE sizeof(hbool_t)
-#define H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_DEF FALSE
-#define H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_SIZE sizeof(uint32_t)
-#define H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_DEF 0
-#define H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_SIZE sizeof(hsize_t *)
-#define H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_DEF NULL
-#define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_SIZE sizeof(uint32_t)
-#define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_DEF 0
-/* Definitions for properties of direct chunk read */
-#define H5D_XFER_DIRECT_CHUNK_READ_FLAG_SIZE sizeof(hbool_t)
-#define H5D_XFER_DIRECT_CHUNK_READ_FLAG_DEF FALSE
-#define H5D_XFER_DIRECT_CHUNK_READ_FILTERS_SIZE sizeof(uint32_t)
-#define H5D_XFER_DIRECT_CHUNK_READ_FILTERS_DEF 0
-#define H5D_XFER_DIRECT_CHUNK_READ_OFFSET_SIZE sizeof(hsize_t *)
-#define H5D_XFER_DIRECT_CHUNK_READ_OFFSET_DEF NULL
/******************/
@@ -266,13 +250,6 @@ static const H5Z_EDC_t H5D_def_enable_edc_g = H5D_XFER_EDC_DEF; /* De
static const H5Z_cb_t H5D_def_filter_cb_g = H5D_XFER_FILTER_CB_DEF; /* Default value for filter callback */
static const H5T_conv_cb_t H5D_def_conv_cb_g = H5D_XFER_CONV_CB_DEF; /* Default value for datatype conversion callback */
static const void *H5D_def_xfer_xform_g = H5D_XFER_XFORM_DEF; /* Default value for data transform */
-static const hbool_t H5D_def_direct_chunk_flag_g = H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_DEF; /* Default value for the flag of direct chunk write */
-static const uint32_t H5D_def_direct_chunk_filters_g = H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_DEF; /* Default value for the filters of direct chunk write */
-static const hsize_t *H5D_def_direct_chunk_offset_g = H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_DEF; /* Default value for the offset of direct chunk write */
-static const uint32_t H5D_def_direct_chunk_datasize_g = H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_DEF; /* Default value for the datasize of direct chunk write */
-static const hbool_t direct_chunk_read_flag = H5D_XFER_DIRECT_CHUNK_READ_FLAG_DEF; /* Default value for the flag of direct chunk read */
-static const hsize_t *direct_chunk_read_offset = H5D_XFER_DIRECT_CHUNK_READ_OFFSET_DEF; /* Default value for the offset of direct chunk read */
-static const uint32_t direct_chunk_read_filters = H5D_XFER_DIRECT_CHUNK_READ_FILTERS_DEF; /* Default value for the filters of direct chunk read */
/*-------------------------------------------------------------------------
@@ -423,48 +400,6 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass)
H5D_XFER_XFORM_DEL, H5D_XFER_XFORM_COPY, H5D_XFER_XFORM_CMP, H5D_XFER_XFORM_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- /* Register the property of flag for direct chunk write */
- /* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_SIZE, &H5D_def_direct_chunk_flag_g,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
- /* Register the property of filter for direct chunk write */
- /* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_SIZE, &H5D_def_direct_chunk_filters_g,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
- /* Register the property of offset for direct chunk write */
- /* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_SIZE, &H5D_def_direct_chunk_offset_g,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
- /* Register the property of datasize for direct chunk write */
- /* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_SIZE, &H5D_def_direct_chunk_datasize_g,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
- /* Register the property of flag for direct chunk read */
- /* (Note: this property should not have an encode/decode callback) */
- if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME, H5D_XFER_DIRECT_CHUNK_READ_FLAG_SIZE, &direct_chunk_read_flag,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
- /* Register the property of filter for direct chunk read */
- /* (Note: this property should not have an encode/decode callback) */
- if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME, H5D_XFER_DIRECT_CHUNK_READ_FILTERS_SIZE, &direct_chunk_read_filters,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
- /* Register the property of offset for direct chunk read */
- /* (Note: this property should not have an encode/decode callback) */
- if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME, H5D_XFER_DIRECT_CHUNK_READ_OFFSET_SIZE, &direct_chunk_read_offset,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__dxfr_reg_prop() */
diff --git a/src/H5R.c b/src/H5R.c
index ab73b59..95abc32 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -141,7 +141,7 @@ done:
void *ref; IN: Reference to open.
RETURNS
- Valid ID on success, Negative on failure
+ Valid ID on success, H5I_INVALID_HID on failure
DESCRIPTION
Given a reference to some object, open that object and return an ID for
that object.
@@ -203,7 +203,7 @@ done:
void *ref; IN: Reference to open.
RETURNS
- Valid ID on success, Negative on failure
+ Valid ID on success, H5I_INVALID_HID on failure
DESCRIPTION
Given a reference to some object, creates a copy of the dataset pointed
to's dataspace and defines a selection in the copy which is the region
@@ -311,7 +311,7 @@ done:
when passing in the size)
RETURNS
- Non-negative length of the path on success, Negative on failure
+ Non-negative length of the path on success, -1 on failure
DESCRIPTION
Given a reference to some object, determine a path to the object
referenced in the file.
@@ -335,23 +335,23 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name,
H5F_t *file; /* File object */
ssize_t ret_value; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE5("Zs", "iRt*x*sz", id, ref_type, _ref, name, size);
/* Check args */
if (H5G_loc(id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location")
if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type")
if (_ref == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference pointer")
/* Get the file pointer from the entry */
file = loc.oloc->file;
/* Get name */
if((ret_value = H5R__get_name(file, id, ref_type, _ref, name, size)) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object path")
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to determine object path")
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c
index 2f41f7d..fb62430 100644
--- a/src/H5Rdeprec.c
+++ b/src/H5Rdeprec.c
@@ -141,7 +141,7 @@ done:
* ref IN: Reference to open
*
* Return: Success: Valid HDF5 ID
- * Failure: Negative
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
diff --git a/src/H5Rint.c b/src/H5Rint.c
index df9037728..e3b11c0 100644
--- a/src/H5Rint.c
+++ b/src/H5Rint.c
@@ -587,7 +587,7 @@ done:
H5F_t *file; IN: File the object being dereferenced is within
H5R_type_t ref_type; IN: Type of reference to query
void *ref; IN: Reference to query.
- H5O_type_t *obj_type; OUT: The type of the object, set on success
+ H5O_type_t *obj_type; OUT: The type of the object, set on success
RETURNS
Non-negative on success/Negative on failure
@@ -678,12 +678,12 @@ done:
hid_t lapl_id; IN: LAPL to use for operation
hid_t id; IN: Location ID given for reference
H5R_type_t ref_type; IN: Type of reference
- void *ref; IN: Reference to query.
+ void *_ref; IN: Reference to query.
char *name; OUT: Buffer to place name of object referenced
size_t size; IN: Size of name buffer
RETURNS
- Non-negative length of the path on success, Negative on failure
+ Non-negative length of the path on success, -1 on failure
DESCRIPTION
Given a reference to some object, determine a path to the object
referenced in the file.
@@ -732,7 +732,7 @@ H5R__get_name(H5F_t *f, hid_t id, H5R_type_t ref_type, const void *_ref,
/* Get the dataset region from the heap (allocate inside routine) */
if ((buf = (uint8_t *)H5HG_read(oloc.file, &hobjid, NULL, NULL)) == NULL)
- HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information")
+ HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, (-1), "Unable to read dataset region information")
/* Get the object oid for the dataset */
p = buf;
@@ -747,22 +747,21 @@ H5R__get_name(H5F_t *f, hid_t id, H5R_type_t ref_type, const void *_ref,
case H5R_BADTYPE:
case H5R_MAXTYPE:
default:
- HDassert("unknown reference type" && 0);
- HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)")
+ HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, (-1), "internal error (unknown reference type)")
} /* end switch */
/* Retrieve file ID for name search */
if ((file_id = H5I_get_file_id(id, FALSE)) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve file ID")
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't retrieve file ID")
/* Get name, length, etc. */
if ((ret_value = H5G_get_name_by_addr(file_id, &oloc, name, size)) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't determine name")
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't determine name")
done:
/* Close file ID used for search */
if (file_id > 0 && H5I_dec_ref(file_id) < 0)
- HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "can't decrement ref count of temp ID")
+ HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, (-1), "can't decrement ref count of temp ID")
FUNC_LEAVE_NOAPI_VOL(ret_value)
} /* end H5R__get_name() */
diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h
index 49261eb..fbbff50 100644
--- a/src/H5Rpkg.h
+++ b/src/H5Rpkg.h
@@ -26,6 +26,11 @@
#include "H5Rprivate.h"
/* Other private headers needed by this file */
+#include "H5Fprivate.h" /* Files */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Sprivate.h" /* Dataspaces */
+
/**************************/
/* Package Private Macros */
diff --git a/src/H5S.c b/src/H5S.c
index b490b36..bd21caf 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -26,7 +26,6 @@
#include "H5Fprivate.h" /* Files */
#include "H5FLprivate.h" /* Free lists */
#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
#include "H5Oprivate.h" /* Object headers */
#include "H5Spkg.h" /* Dataspaces */
@@ -208,6 +207,58 @@ H5S_term_package(void)
FUNC_LEAVE_NOAPI(n)
} /* end H5S_term_package() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S_get_validiated_dataspace
+ PURPOSE
+ Get a pointer to a validated H5S_t pointer
+ USAGE
+ H5S_t *H5S_get_validated_space(dataspace_id, space)
+ hid_t space_id; IN: The ID of the dataspace
+ const H5S_t * space; OUT: A pointer to the dataspace
+ RETURNS
+ SUCCEED/FAIL
+ DESCRIPTION
+ Gets a pointer to a dataspace struct after validating it. The pointer
+ can be NULL (if the ID is H5S_ALL, for example).
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5S_get_validated_dataspace(hid_t space_id, const H5S_t **space)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ HDassert(space);
+
+ if (space_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid space_id (ID cannot be a negative number)")
+
+ if (H5S_ALL == space_id) {
+ /* No special dataspace struct for H5S_ALL */
+ *space = NULL;
+ }
+ else {
+ /* Get the dataspace pointer */
+ if (NULL == (*space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "space_id is not a dataspace ID")
+
+ /* Check for valid selection */
+ if (H5S_SELECT_VALID(*space) != TRUE)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection + offset not within extent")
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+
+} /* end H5S_get_validated_dataspace() */
+
/*--------------------------------------------------------------------------
NAME
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index f387fe3..e46c43b 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -216,6 +216,7 @@ H5_DLL herr_t H5S_set_extent_real(H5S_t *space, const hsize_t *size);
H5_DLL herr_t H5S_set_extent_simple(H5S_t *space, unsigned rank,
const hsize_t *dims, const hsize_t *max);
H5_DLL H5S_t *H5S_create(H5S_class_t type);
+H5_DLL herr_t H5S_get_validated_dataspace(hid_t space_id, const H5S_t **space/*out*/);
H5_DLL H5S_t *H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/],
const hsize_t maxdims[/*rank*/]);
H5_DLL herr_t H5S_set_version(H5F_t *f, H5S_t *ds);
diff --git a/src/H5vers.txt b/src/H5vers.txt
index 0303bf5..914c30e 100644
--- a/src/H5vers.txt
+++ b/src/H5vers.txt
@@ -56,6 +56,11 @@ FUNCTION: H5Ewalk; H5E_walk, H5E_error; v10, v18
FUNCTION: H5Fget_info; H5F_info; v18, v110
FUNCTION: H5Gcreate; ; v10, v18
FUNCTION: H5Gopen; ; v10, v18
+FUNCTION: H5Oget_info; ; v18, v112
+FUNCTION: H5Oget_info_by_name; ; v18, v112
+FUNCTION: H5Oget_info_by_idx; ; v18, v112
+FUNCTION: H5Ovisit; ; v18, v112
+FUNCTION: H5Ovisit_by_name; ; v18, v112
FUNCTION: H5Pget_filter; ; v10, v18
FUNCTION: H5Pget_filter_by_id; ; v16, v18
FUNCTION: H5Pinsert; ; v14, v18
diff --git a/src/Makefile.am b/src/Makefile.am
index 21f3966..a0defad 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -80,7 +80,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5HP.c H5I.c H5Itest.c H5L.c H5Lexternal.c H5lib_settings.c \
H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \
H5MM.c H5MP.c H5MPtest.c \
- H5O.c H5Oainfo.c H5Oalloc.c H5Oattr.c \
+ H5O.c H5Odeprec.c H5Oainfo.c H5Oalloc.c H5Oattr.c \
H5Oattribute.c H5Obogus.c H5Obtreek.c H5Ocache.c H5Ocache_image.c \
H5Ochunk.c \
H5Ocont.c H5Ocopy.c H5Odbg.c H5Odrvinfo.c H5Odtype.c H5Oefl.c \