mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-06 14:56:51 +08:00
4b7f34acc1
* Update API tracing for new H5VL_request_status_t typedef
* Finish converting internal event set operations to use list iterator callbacks, instead of directly accessing the list structure
* Add H5VL_REQUEST_GET_ERR_STACK operation to request subclass, for retrieving a copy of the error stack for a failed asynchronous operation
* Remove 'canceled' event status from Java constants
* Be safer about releasing resources when inserting a newly opened/created object or file into an event set
* Remove H5EStest, add H5ES_WAIT_NONE for 0 timeout, and revise parameters to H5ESwait, to make it more "aggregate".
* Remove H5ES_STATUS_CANCELED from Java wrappers also
* Apply patch for dynamically registering optional VOL operations
* (a) Add async APIs for H5O module as listed in jira issue ID-283.
(b) Remove verification of name parameter in async related routines for H55A and H5L modules
because it is checked in H5VL_setup* routine.
(c) Modify h5dump expected output due to the async changes.
* Corrections based on PR feedback.
* Further changes to make based on PR feedback.
* Remove H5Dwait & H5Fwait (moved to the async connector). Added H5atclose
routine. Updated 'optional op' operations.
* Fix missed merge marker, and reformatted line
* Update API tracing infrastructure for H5atclose callback
* Clean up some warnings
* Normalize against develop branch
* Correct level of indirection
* Add doxygen info for H5is_library_terminating and regression tests for it and H5atclose
* Relocate prototype (and doxygen info) for H5Aclose
* Align w/changes on develop
* Move group package initialization code to H5Gint.c, and update tracing macros
* Change non-static function declarations to be static
* Correct GCC diagnostic macro
* Ensure that H5TSpublic.h header gets installed (#129)
* Finish moving API routines that invoke VOL framework to main source files.
* Fix position of H5Fmount and H5Funmount
* Add 'wrapper' versions of async calls, to allow language wrappers and layers on top of HDF5 to pass in their application information.
* Add wrappers for dynamically registered optional operations
* Fix typo
* Update doxygen comment for H5atclose with additional detail.
* Add H5VL\*_vararg versions of H5VL routines that use va_list parameters
* Implement and test H5S_BLOCK
* Switch H5Aexists\*_async and H5Lexists\*_async to use flag to return status, instead of return value. Make the corresponding changes through most of the v1 and v2 B-tree code. Clean up warnings in H5public.h and cmpd_dtransform.c.
* Add H5Iregister_future routine and tests.
* Correct return value for H5Lexists_async
* Add H5_DLL macro to public H5ES API routines
* Update supported -> flags parameter for introspect_query callback
* Remove my email address. Update passthrough VOL connector ID.
* Fix comment for post_open_api_common
* Remove unused non-blocking VOL connector
* Minor cleanup in async branch in preparation for merge to develop
* Update CMake and the Autotools to use the new pass-through VOL ID
* Finish another iteration on public H5ES routines, along with running the code reformatter
* Another round of reformatting
* Fix for SWMR daily test failures (#160)
The H5I_register_using_existing_id() call did not initialize the future
ID callbacks, causing the library to segfault when it tried to
resolve those function pointers.
* Added selective async APIs (#150)
* Added selective async APIs
Description:
Added the following APIs:
H5Ropen_attr_async
H5Ropen_object_async
H5Ropen_region_async
H5Mcreate_async
H5Mopen_async
H5Mput_async
H5Mget_async
H5Mclose_async
H5Tcommit_async
H5Topen_async
H5Tcopy_async
H5Tclose_async
- Updated an expected output file to include a new internal function
in the error stack for the failure case.
* Updated async APIs per reviews, including removing async version of
H5Tcopy.
* Removed statements that were added by mistake in the previous commit.
* Fix compile issues in H5M and warnings elsewhere
* Reformat code
* Brings VOL_LIST changes from develop. (#163)
* Remove H5Dwait and H5Fwait calls, which were incorrectly brought back in
* Tiny cleanup of H5Lcreate_hard_async
* Run source formatter
* Allow for canceled operation in wait_cb
* Attempt to fix switch on string value
* Re-run source formatter
* Add H5S_BLOCK testfile to CMake clean target
* Add H5Pset_vol_async API routine and 'get_cap_flags' VOL introspection callback
* Clean up warnings
* Add H5P(set\|get)_vol_implicit_async API routines to allow \/ disallow implicit asynchronous operations (default is disallowed)
* Run formatting script
* Remove H5VL_REQUEST_WAIT\*
* Warning cleanup
* Eliminate strdup()s on statically allocated strings
* Warning cleanup
* Split H5VLrestore_lib_state into H5VLstart_lib_state and H5VLrestore_lib_state, and rename H5VLreset_lib_state to H5VLfinish_lib_state.
* Duplicate strings when building err_info to return to applicatin
* Move connector author routines into seperate header files, all included in the new hdf5dev.h header
* Run bin/trace to add TRACE macros
* Allow H5ES_NONE as a valid, but no-op, parameter to all H5ES API routines that accept an event set ID
* Clean up formatting
* Remove H5Pset/get_vol_implicit_async
* Clean up warning
* Remove H5Pget_vol_async and replace with more generic H5Pget_vol_cap_flags
* Clean up warnings
* Add H5ESfree_err_info convenience routine
* Fix typo
* Correct matching for cached VOL plugins
* Add developer header file
* Update for C99 compatibility
* Add missing trace macro
* Stop clang-format from messing with the trace macros. Don't set up VOL wrappers for 'infrastructure' objects like requests and blobs
* Fix warning about formatting a directory
* Clean up formatting for H5E_BEGIN_TRY / H5E_END_TRY
* Reduce scope of H5ES__close
* Enable CMake checks for various types on MacOS
* Clean up properly when H5CX_retrieve_state() fails. Also clean up many compiler warnings.
* Committing clang-format changes
* Merge from develop
* Fix mis-placed assert
* Remove commented-out code
* Re-add macro for unsetenv on Windows (I think it accidentally was merged out)
* Strengthen sanity check from error report to assertion
* Committing clang-format changes
* Add units to the comments for a few fields
* Switch 'get execution time' operation for async request tokens to be an optional operation and query if connector supports operation before retrieving it.
* Committing clang-format changes
* Remove H5ESget_time_estimate
* Committing clang-format changes
* Create developer header for datatype routines and move type conversion register/unregister routines there.
* Simplify internal H5VL_setup_name_args and H5VL_setup_idx_args routines
* Add H5VLlink_optional_op, allowing dynamicly registered optional operations for the link VOL subclass, also added H5VL_loc_params argument to the link 'optional' callback to allow them to work correctly.
* Run bin/format_source on current code
* Add H5VLobject_optional_op, allowing dynamicly registered optional operations for the object VOL subclass, also added H5VL_loc_params argument to the object 'optional' callback to allow them to work correctly.
* Run bin/format_source on current code
* Committing clang-format changes
* Revert "Switch 'get execution time' operation for async request tokens to be an optional operation and query if connector supports operation before retrieving it."
This reverts commit 5ac92014da
.
* Committing clang-format changes
* Convert attribute 'get' operation to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs.
* Update tracing macros
* Convert attribute 'specific' operation to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs.
* Convert dataset 'get' and 'specific' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. Also, minor tweaks to attribute 'get' and 'specific' operation parameters.
* Convert datatype 'get' and 'specific' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. Also, minor tweaks to H5O_refresh_metadata arguments.
* Reduce warnings
* Reduce warnings
* Track change to datatype 'get' callback
* Fix bug with file pointer getting invalidated when object closed
* Reformat source
* Convert file and group VOL classes 'get' and 'specific' operations to use
struct-of-tagged-union pattern for VOL callback arguments, instead of using
varargs. Also small cleanup to the attribute get name operation. Also moved
'mount' and 'unmount' operations to be group specific operations, instead of
file specific, to better align with their behavior (mounted files are on
groups, so a group is what is operated on).
* Remove remainder of merge conflict marking
* Convert link VOL class 'create' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs.
* Remove some unused local variables
* Convert link VOL class 'get' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. Also refactor 'get name by idx' routines to return actual length of name with a parameter instead of the return value, and move some callback context structs for the link interface from the private header file into the source code module, to reduce their visibility scope.
* Update tracing macros
* Convert link VOL class 'specific' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs.
* Convert object VOL class 'get' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs.
* Convert object VOL class 'specific' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. Also refactor H5G_loc_exists, et al, to return 'exists' flag in a parameter and errors with the function return value, instead of overloading both into the return value. And, corrected logic error in test/links.c around non-existant objects in a file.
* Convert request VOL class 'specific' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs.
* Convert blob VOL class 'specific' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. Also removes the H5VL_BLOB_GETSIZE operation, as it's unused in the library and the blob ID size for a container is now returned with H5VL_FILE_GET_CONT_INFO.
* Add 'const' to several parameters that are only queried.
* Convert all VOL classes' 'optional' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. Convert several 'get' routines to return the length of an array in a parameter instead of combining it into the return value. Move several routines to be in less public namespace. Correct direct_chunk test to verify that parameters aren't modified on error.
* Switch get/specific/optional VOL callback argument structures to be 'async-friendly'. Also other minor cleanups and bug-fixes.
* Add H5Pset_dataset_io_hyperslab_selection / H5S_PLIST feature, to allow skipping H5Dget_space + H5Sselect_hyperslab for async operation
* Add dynamic optional operations for request objects
* Update dynamic operation test for optional request operations
* Update a comment for an operation argument
* Run trace and format_source scripts
* Committing clang-format changes
* Committing clang-format changes
Co-authored-by: vchoi <vchoi@jelly.ad.hdfgroup.org>
Co-authored-by: vchoi-hdfgroup <55293060+vchoi-hdfgroup@users.noreply.github.com>
Co-authored-by: jhendersonHDF <jhenderson@hdfgroup.org>
Co-authored-by: Dana Robinson <derobins@hdfgroup.org>
Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
852 lines
32 KiB
C
852 lines
32 KiB
C
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
* 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://www.hdfgroup.org/licenses. *
|
|
* If you do not have access to either file, you may request a copy from *
|
|
* help@hdfgroup.org. *
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
/* Programmer: Quincey Koziol
|
|
* Monday, October 17, 2005
|
|
*
|
|
* Purpose: Group testing functions.
|
|
*/
|
|
|
|
/****************/
|
|
/* Module Setup */
|
|
/****************/
|
|
|
|
#include "H5Gmodule.h" /* This source code file is part of the H5G module */
|
|
#define H5G_TESTING /*suppress warning about H5G testing funcs*/
|
|
|
|
/***********/
|
|
/* Headers */
|
|
/***********/
|
|
#include "H5private.h" /* Generic Functions */
|
|
#include "H5CXprivate.h" /* API Contexts */
|
|
#include "H5Dprivate.h" /* Datasets */
|
|
#include "H5Eprivate.h" /* Error handling */
|
|
#include "H5Gpkg.h" /* Groups */
|
|
#include "H5HLprivate.h" /* Local Heaps */
|
|
#include "H5Iprivate.h" /* IDs */
|
|
#include "H5VLprivate.h" /* Virtual Object Layer */
|
|
|
|
/****************/
|
|
/* Local Macros */
|
|
/****************/
|
|
|
|
/******************/
|
|
/* Local Typedefs */
|
|
/******************/
|
|
|
|
/********************/
|
|
/* Package Typedefs */
|
|
/********************/
|
|
|
|
/********************/
|
|
/* Local Prototypes */
|
|
/********************/
|
|
|
|
/*********************/
|
|
/* Package Variables */
|
|
/*********************/
|
|
|
|
/*****************************/
|
|
/* Library Private Variables */
|
|
/*****************************/
|
|
|
|
/*******************/
|
|
/* Local Variables */
|
|
/*******************/
|
|
|
|
/*--------------------------------------------------------------------------
|
|
NAME
|
|
H5G__is_empty_test
|
|
PURPOSE
|
|
Determine whether a group contains no objects
|
|
USAGE
|
|
htri_t H5G__is_empty_test(gid)
|
|
hid_t gid; IN: group to check
|
|
RETURNS
|
|
TRUE/FALSE on success, FAIL on failure
|
|
DESCRIPTION
|
|
Checks to see if the group has no link messages and no symbol table message
|
|
and no "dense" link storage
|
|
GLOBAL VARIABLES
|
|
COMMENTS, BUGS, ASSUMPTIONS
|
|
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
|
|
EXAMPLES
|
|
REVISION LOG
|
|
--------------------------------------------------------------------------*/
|
|
htri_t
|
|
H5G__is_empty_test(hid_t gid)
|
|
{
|
|
H5G_t * grp = NULL; /* Pointer to group */
|
|
htri_t msg_exists = FALSE; /* Indicate that a header message is present */
|
|
htri_t linfo_exists = FALSE; /* Indicate that the 'link info' message is present */
|
|
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
|
|
htri_t ret_value = TRUE; /* Return value */
|
|
|
|
FUNC_ENTER_PACKAGE
|
|
|
|
/* Get group structure */
|
|
if (NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP)))
|
|
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
|
|
|
|
/* Set API context */
|
|
if (H5CX_push() < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context")
|
|
api_ctx_pushed = TRUE;
|
|
|
|
/* "New format" checks */
|
|
|
|
/* Check if the group has any link messages */
|
|
if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
|
|
if (msg_exists > 0) {
|
|
/* Sanity check that new group format shouldn't have old messages */
|
|
if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
|
|
if (msg_exists > 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found")
|
|
|
|
HGOTO_DONE(FALSE)
|
|
} /* end if */
|
|
|
|
/* Check for a link info message */
|
|
if ((linfo_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID)) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
|
|
if (linfo_exists > 0) {
|
|
H5O_linfo_t linfo; /* Link info message */
|
|
|
|
/* Sanity check that new group format shouldn't have old messages */
|
|
if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
|
|
if (msg_exists > 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link info messages found")
|
|
|
|
/* Get the link info */
|
|
if (H5G__obj_get_linfo(&(grp->oloc), &linfo) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
|
|
|
|
/* Check for 'dense' link storage file addresses being defined */
|
|
if (H5F_addr_defined(linfo.fheap_addr))
|
|
HGOTO_DONE(FALSE)
|
|
if (H5F_addr_defined(linfo.name_bt2_addr))
|
|
HGOTO_DONE(FALSE)
|
|
if (H5F_addr_defined(linfo.corder_bt2_addr))
|
|
HGOTO_DONE(FALSE)
|
|
|
|
/* Check for link count */
|
|
if (linfo.nlinks > 0)
|
|
HGOTO_DONE(FALSE)
|
|
} /* end if */
|
|
|
|
/* "Old format" checks */
|
|
|
|
/* Check if the group has a symbol table message */
|
|
if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
|
|
if (msg_exists > 0) {
|
|
H5O_stab_t stab; /* Info about local heap & B-tree */
|
|
hsize_t nlinks; /* Number of links in the group */
|
|
|
|
/* Sanity check that old group format shouldn't have new messages */
|
|
if (linfo_exists > 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link info messages found")
|
|
if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_GINFO_ID)) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
|
|
if (msg_exists > 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and group info messages found")
|
|
|
|
/* Get the B-tree & local heap info */
|
|
if (NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, &stab))
|
|
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbol table message")
|
|
|
|
/* Get the count of links in the group */
|
|
if (H5G__stab_count(&(grp->oloc), &nlinks) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to count links")
|
|
|
|
/* Check for link count */
|
|
if (nlinks > 0)
|
|
HGOTO_DONE(FALSE)
|
|
} /* end if */
|
|
|
|
done:
|
|
if (api_ctx_pushed && H5CX_pop(FALSE) < 0)
|
|
HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context")
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
|
} /* H5G__is_empty_test() */
|
|
|
|
/*--------------------------------------------------------------------------
|
|
NAME
|
|
H5G__has_links_test
|
|
PURPOSE
|
|
Determine whether a group contains link messages
|
|
USAGE
|
|
htri_t H5G__has_links_test(gid)
|
|
hid_t gid; IN: group to check
|
|
unsigned *nmsgs; OUT: # of link messages in header
|
|
RETURNS
|
|
TRUE/FALSE on success, FAIL on failure
|
|
DESCRIPTION
|
|
Checks to see if the group has link messages and how many.
|
|
GLOBAL VARIABLES
|
|
COMMENTS, BUGS, ASSUMPTIONS
|
|
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
|
|
EXAMPLES
|
|
REVISION LOG
|
|
--------------------------------------------------------------------------*/
|
|
htri_t
|
|
H5G__has_links_test(hid_t gid, unsigned *nmsgs)
|
|
{
|
|
H5G_t * grp = NULL; /* Pointer to group */
|
|
htri_t msg_exists = 0; /* Indicate that a header message is present */
|
|
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
|
|
htri_t ret_value = TRUE; /* Return value */
|
|
|
|
FUNC_ENTER_PACKAGE
|
|
|
|
/* Get group structure */
|
|
if (NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP)))
|
|
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
|
|
|
|
/* Set API context */
|
|
if (H5CX_push() < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context")
|
|
api_ctx_pushed = TRUE;
|
|
|
|
/* Check if the group has any link messages */
|
|
if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
|
|
if (msg_exists == 0)
|
|
HGOTO_DONE(FALSE)
|
|
|
|
/* Check if the group has a symbol table message */
|
|
if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
|
|
if (msg_exists > 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found")
|
|
|
|
/* Check if we should retrieve the number of link messages */
|
|
if (nmsgs) {
|
|
int msg_count; /* Number of messages of a type */
|
|
|
|
/* Check how many link messages there are */
|
|
if ((msg_count = H5O_msg_count(&(grp->oloc), H5O_LINK_ID)) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count link messages")
|
|
*nmsgs = (unsigned)msg_count;
|
|
} /* end if */
|
|
|
|
done:
|
|
if (api_ctx_pushed && H5CX_pop(FALSE) < 0)
|
|
HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context")
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
|
} /* H5G__has_links_test() */
|
|
|
|
/*--------------------------------------------------------------------------
|
|
NAME
|
|
H5G__has_stab_test
|
|
PURPOSE
|
|
Determine whether a group contains a symbol table message
|
|
USAGE
|
|
htri_t H5G__has_stab_test(gid)
|
|
hid_t gid; IN: group to check
|
|
RETURNS
|
|
TRUE/FALSE on success, FAIL on failure
|
|
DESCRIPTION
|
|
Checks to see if the group has a symbol table message.
|
|
GLOBAL VARIABLES
|
|
COMMENTS, BUGS, ASSUMPTIONS
|
|
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
|
|
EXAMPLES
|
|
REVISION LOG
|
|
--------------------------------------------------------------------------*/
|
|
htri_t
|
|
H5G__has_stab_test(hid_t gid)
|
|
{
|
|
H5G_t * grp = NULL; /* Pointer to group */
|
|
htri_t msg_exists = 0; /* Indicate that a header message is present */
|
|
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
|
|
htri_t ret_value = TRUE; /* Return value */
|
|
|
|
FUNC_ENTER_PACKAGE
|
|
|
|
/* Get group structure */
|
|
if (NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP)))
|
|
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
|
|
|
|
/* Set API context */
|
|
if (H5CX_push() < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context")
|
|
api_ctx_pushed = TRUE;
|
|
|
|
/* Check if the group has a symbol table message */
|
|
if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
|
|
if (msg_exists == 0)
|
|
HGOTO_DONE(FALSE)
|
|
|
|
/* Check if the group has any link messages */
|
|
if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
|
|
if (msg_exists > 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found")
|
|
|
|
done:
|
|
if (api_ctx_pushed && H5CX_pop(FALSE) < 0)
|
|
HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context")
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
|
} /* H5G__has_stab_test() */
|
|
|
|
/*--------------------------------------------------------------------------
|
|
NAME
|
|
H5G__is_new_dense_test
|
|
PURPOSE
|
|
Determine whether a group is in the "new" format and dense
|
|
USAGE
|
|
htri_t H5G__is_new_dense_test(gid)
|
|
hid_t gid; IN: group to check
|
|
RETURNS
|
|
TRUE/FALSE on success, FAIL on failure
|
|
DESCRIPTION
|
|
Checks to see if the group is in the "new" format for groups (link messages/
|
|
fractal heap+v2 B-tree) and if it is in "dense" storage form (ie. it has
|
|
a name B-tree index).
|
|
GLOBAL VARIABLES
|
|
COMMENTS, BUGS, ASSUMPTIONS
|
|
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
|
|
EXAMPLES
|
|
REVISION LOG
|
|
--------------------------------------------------------------------------*/
|
|
htri_t
|
|
H5G__is_new_dense_test(hid_t gid)
|
|
{
|
|
H5G_t * grp = NULL; /* Pointer to group */
|
|
htri_t msg_exists = 0; /* Indicate that a header message is present */
|
|
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
|
|
htri_t ret_value = TRUE; /* Return value */
|
|
|
|
FUNC_ENTER_PACKAGE
|
|
|
|
/* Get group structure */
|
|
if (NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP)))
|
|
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
|
|
|
|
/* Set API context */
|
|
if (H5CX_push() < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context")
|
|
api_ctx_pushed = TRUE;
|
|
|
|
/* Check if the group has a symbol table message */
|
|
if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
|
|
if (msg_exists > 0)
|
|
HGOTO_DONE(FALSE)
|
|
|
|
/* Check if the group has any link messages */
|
|
if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
|
|
if (msg_exists > 0)
|
|
HGOTO_DONE(FALSE)
|
|
|
|
/* Check if the group has link info message */
|
|
if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID)) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
|
|
if (msg_exists > 0) {
|
|
H5O_linfo_t linfo; /* Link info message */
|
|
|
|
/* Get the link info */
|
|
if (H5G__obj_get_linfo(&(grp->oloc), &linfo) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
|
|
|
|
/* Check for 'dense' link storage file addresses being defined */
|
|
if (!H5F_addr_defined(linfo.fheap_addr))
|
|
HGOTO_DONE(FALSE)
|
|
if (!H5F_addr_defined(linfo.name_bt2_addr))
|
|
HGOTO_DONE(FALSE)
|
|
} /* end if */
|
|
|
|
done:
|
|
if (api_ctx_pushed && H5CX_pop(FALSE) < 0)
|
|
HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context")
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
|
} /* H5G__is_new_dense_test() */
|
|
|
|
/*--------------------------------------------------------------------------
|
|
NAME
|
|
H5G__new_dense_info_test
|
|
PURPOSE
|
|
Retrieve information about the state of the new "dense" storage for groups
|
|
USAGE
|
|
herr_t H5G__new_dense_info_test(gid, name_count, corder_count)
|
|
hid_t gid; IN: group to check
|
|
hsize_t *name_count; OUT: Number of links in name index
|
|
hsize_t *corder_count; OUT: Number of links in creation order index
|
|
RETURNS
|
|
SUCCEED/FAIL
|
|
DESCRIPTION
|
|
Currently, just retrieves the number of links in each index and returns
|
|
them.
|
|
GLOBAL VARIABLES
|
|
COMMENTS, BUGS, ASSUMPTIONS
|
|
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
|
|
EXAMPLES
|
|
REVISION LOG
|
|
--------------------------------------------------------------------------*/
|
|
herr_t
|
|
H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count)
|
|
{
|
|
H5B2_t * bt2_name = NULL; /* v2 B-tree handle for name index */
|
|
H5B2_t * bt2_corder = NULL; /* v2 B-tree handle for creation order index */
|
|
H5O_linfo_t linfo; /* Link info message */
|
|
H5G_t * grp = NULL; /* Pointer to group */
|
|
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
|
|
|
FUNC_ENTER_PACKAGE
|
|
|
|
/* Get group structure */
|
|
if (NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP)))
|
|
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
|
|
|
|
/* Set API context */
|
|
if (H5CX_push() < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context")
|
|
api_ctx_pushed = TRUE;
|
|
|
|
/* Set metadata tag in API context */
|
|
H5_BEGIN_TAG(grp->oloc.addr);
|
|
|
|
/* Get the link info */
|
|
if (H5G__obj_get_linfo(&(grp->oloc), &linfo) < 0)
|
|
HGOTO_ERROR_TAG(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
|
|
|
|
/* Check for 'dense' link storage file addresses being defined */
|
|
if (!H5F_addr_defined(linfo.fheap_addr))
|
|
HGOTO_DONE_TAG(FAIL)
|
|
if (!H5F_addr_defined(linfo.name_bt2_addr))
|
|
HGOTO_DONE_TAG(FAIL)
|
|
|
|
/* Open the name index v2 B-tree */
|
|
if (NULL == (bt2_name = H5B2_open(grp->oloc.file, linfo.name_bt2_addr, NULL)))
|
|
HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
|
|
|
|
/* Retrieve # of records in name index */
|
|
if (H5B2_get_nrec(bt2_name, name_count) < 0)
|
|
HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index")
|
|
|
|
/* Check if there is a creation order index */
|
|
if (H5F_addr_defined(linfo.corder_bt2_addr)) {
|
|
/* Open the creation order index v2 B-tree */
|
|
if (NULL == (bt2_corder = H5B2_open(grp->oloc.file, linfo.corder_bt2_addr, NULL)))
|
|
HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTOPENOBJ, FAIL,
|
|
"unable to open v2 B-tree for creation order index")
|
|
|
|
/* Retrieve # of records in creation order index */
|
|
if (H5B2_get_nrec(bt2_corder, corder_count) < 0)
|
|
HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTCOUNT, FAIL,
|
|
"unable to retrieve # of records from creation order index")
|
|
} /* end if */
|
|
else
|
|
*corder_count = 0;
|
|
|
|
/* Reset metadata tag in API context */
|
|
H5_END_TAG
|
|
|
|
done:
|
|
/* Release resources */
|
|
if (bt2_name && H5B2_close(bt2_name) < 0)
|
|
HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index")
|
|
if (bt2_corder && H5B2_close(bt2_corder) < 0)
|
|
HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index")
|
|
if (api_ctx_pushed && H5CX_pop(FALSE) < 0)
|
|
HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context")
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
|
} /* H5G__new_dense_info_test() */
|
|
|
|
/*--------------------------------------------------------------------------
|
|
NAME
|
|
H5G__lheap_size_test
|
|
PURPOSE
|
|
Determine the size of a local heap for a group
|
|
USAGE
|
|
herr_t H5G__lheap_size_test(gid, lheap_size)
|
|
hid_t gid; IN: group to check
|
|
size_t *lheap_size; OUT: Size of local heap
|
|
RETURNS
|
|
SUCCEED/FAIL
|
|
DESCRIPTION
|
|
Checks the size of the local heap for a group
|
|
GLOBAL VARIABLES
|
|
COMMENTS, BUGS, ASSUMPTIONS
|
|
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
|
|
EXAMPLES
|
|
REVISION LOG
|
|
--------------------------------------------------------------------------*/
|
|
herr_t
|
|
H5G__lheap_size_test(hid_t gid, size_t *lheap_size)
|
|
{
|
|
H5G_t * grp = NULL; /* Pointer to group */
|
|
H5O_stab_t stab; /* Symbol table message */
|
|
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
|
|
|
FUNC_ENTER_PACKAGE
|
|
|
|
/* Get group structure */
|
|
if (NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP)))
|
|
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
|
|
|
|
/* Set API context */
|
|
if (H5CX_push() < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context")
|
|
api_ctx_pushed = TRUE;
|
|
|
|
/* Make certain the group has a symbol table message */
|
|
if (NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, &stab))
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbol table message")
|
|
|
|
/* Check the size of the local heap for the group */
|
|
if (H5HL_get_size(grp->oloc.file, stab.heap_addr, lheap_size) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't query local heap size")
|
|
|
|
done:
|
|
if (api_ctx_pushed && H5CX_pop(FALSE) < 0)
|
|
HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context")
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
|
} /* H5G__lheap_size_test() */
|
|
|
|
/*--------------------------------------------------------------------------
|
|
NAME
|
|
H5G__user_path_test
|
|
PURPOSE
|
|
Retrieve the user path for an ID
|
|
USAGE
|
|
herr_t H5G__user_path_test(obj_id, user_path, user_path_len)
|
|
hid_t obj_id; IN: ID to check
|
|
char *user_path; OUT: Pointer to buffer for User path
|
|
size_t *user_path_len; OUT: Size of user path
|
|
unsigned *obj_hidden; OUT: Whether object is hidden
|
|
RETURNS
|
|
SUCCEED/FAIL
|
|
DESCRIPTION
|
|
Retrieves the user path for an ID. A zero for the length is returned in
|
|
the case of no user path.
|
|
GLOBAL VARIABLES
|
|
COMMENTS, BUGS, ASSUMPTIONS
|
|
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
|
|
EXAMPLES
|
|
REVISION LOG
|
|
--------------------------------------------------------------------------*/
|
|
herr_t
|
|
H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsigned *obj_hidden)
|
|
{
|
|
void * obj_ptr; /* Pointer to object for ID */
|
|
const H5G_name_t *obj_path; /* Pointer to group hier. path for obj */
|
|
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
|
|
|
FUNC_ENTER_PACKAGE
|
|
|
|
/* Sanity check */
|
|
HDassert(user_path_len);
|
|
HDassert(obj_hidden);
|
|
|
|
/* Get pointer to object for ID */
|
|
if (NULL == (obj_ptr = H5VL_object(obj_id)))
|
|
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get object for ID")
|
|
|
|
/* Set API context */
|
|
if (H5CX_push() < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context")
|
|
api_ctx_pushed = TRUE;
|
|
|
|
/* Get the symbol table entry */
|
|
switch (H5I_get_type(obj_id)) {
|
|
case H5I_GROUP:
|
|
obj_path = H5G_nameof((H5G_t *)obj_ptr);
|
|
break;
|
|
|
|
case H5I_DATASET:
|
|
obj_path = H5D_nameof((H5D_t *)obj_ptr);
|
|
break;
|
|
|
|
case H5I_DATATYPE:
|
|
/* Avoid non-named datatypes */
|
|
if (!H5T_is_named((H5T_t *)obj_ptr))
|
|
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a named datatype")
|
|
|
|
obj_path = H5T_nameof((H5T_t *)obj_ptr);
|
|
break;
|
|
|
|
case H5I_MAP:
|
|
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector")
|
|
|
|
case H5I_UNINIT:
|
|
case H5I_BADID:
|
|
case H5I_FILE:
|
|
case H5I_DATASPACE:
|
|
case H5I_ATTR:
|
|
case H5I_VFL:
|
|
case H5I_VOL:
|
|
case H5I_GENPROP_CLS:
|
|
case H5I_GENPROP_LST:
|
|
case H5I_ERROR_CLASS:
|
|
case H5I_ERROR_MSG:
|
|
case H5I_ERROR_STACK:
|
|
case H5I_SPACE_SEL_ITER:
|
|
case H5I_EVENTSET:
|
|
case H5I_NTYPES:
|
|
default:
|
|
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown data object type")
|
|
} /* end switch */
|
|
HDassert(obj_path);
|
|
|
|
/* Retrieve a copy of the user path and put it into the buffer */
|
|
if (obj_path->user_path_r) {
|
|
size_t len = H5RS_len(obj_path->user_path_r);
|
|
|
|
/* Set the user path, if given */
|
|
if (user_path)
|
|
HDstrncpy(user_path, H5RS_get_str(obj_path->user_path_r), (len + 1));
|
|
|
|
/* Set the length of the path */
|
|
*user_path_len = len;
|
|
|
|
/* Set the user path hidden flag */
|
|
*obj_hidden = obj_path->obj_hidden;
|
|
} /* end if */
|
|
else {
|
|
*user_path_len = 0;
|
|
*obj_hidden = 0;
|
|
} /* end else */
|
|
|
|
done:
|
|
if (api_ctx_pushed && H5CX_pop(FALSE) < 0)
|
|
HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context")
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
|
} /* H5G__user_path_test() */
|
|
|
|
/*-------------------------------------------------------------------------
|
|
* Function: H5G__verify_cached_stab_test
|
|
*
|
|
* Purpose: Check that a that the provided group entry contains a
|
|
* cached symbol table entry, that the entry matches that in
|
|
* the provided group's object header, and check that the
|
|
* addresses are valid.
|
|
*
|
|
* Return: SUCCEED/FAIL
|
|
*
|
|
* Programmer: Neil Fortner
|
|
* Mar 31, 2009
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
herr_t
|
|
H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent)
|
|
{
|
|
H5O_stab_t stab; /* Symbol table */
|
|
H5HL_t * heap = NULL; /* Pointer to local heap */
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
|
|
|
FUNC_ENTER_PACKAGE_TAG(grp_oloc->addr)
|
|
|
|
/* Verify that stab info is cached in ent */
|
|
if (ent->type != H5G_CACHED_STAB)
|
|
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "symbol table information is not cached")
|
|
|
|
/* Read the symbol table message from the group */
|
|
if (NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, &stab))
|
|
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "unable to read symbol table message")
|
|
|
|
/* Verify that the cached symbol table info matches the symbol table message
|
|
* in the object header.
|
|
*/
|
|
if ((ent->cache.stab.btree_addr != stab.btree_addr) || (ent->cache.stab.heap_addr != stab.heap_addr))
|
|
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "cached stab info does not match object header")
|
|
|
|
/* Verify that the btree address is valid */
|
|
if (H5B_valid(grp_oloc->file, H5B_SNODE, stab.btree_addr) < 0)
|
|
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "b-tree address is invalid")
|
|
|
|
/* Verify that the heap address is valid */
|
|
if (NULL == (heap = H5HL_protect(grp_oloc->file, stab.heap_addr, H5AC__READ_ONLY_FLAG)))
|
|
HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "heap address is invalid")
|
|
|
|
done:
|
|
/* Release resources */
|
|
if (heap && H5HL_unprotect(heap) < 0)
|
|
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
|
|
|
|
FUNC_LEAVE_NOAPI_TAG(ret_value)
|
|
} /* end H5G__verify_cached_stab_test() */
|
|
|
|
/*-------------------------------------------------------------------------
|
|
* Function: H5G__verify_cached_stabs_test_cb
|
|
*
|
|
* Purpose: Verify that all entries in this node contain cached symbol
|
|
* table information if and only if the entry refers to a
|
|
* group with a symbol table, and that that information is
|
|
* correct.
|
|
*
|
|
* Return: H5_ITER_STOP/H5_ITER_CONT/H5_ITER_ERROR
|
|
*
|
|
* Programmer: Neil Fortner
|
|
* Apr 8, 2011
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
static int
|
|
H5G__verify_cached_stabs_test_cb(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr,
|
|
const void H5_ATTR_UNUSED *_rt_key, void H5_ATTR_UNUSED *udata)
|
|
{
|
|
H5G_node_t *sn = NULL;
|
|
H5O_loc_t targ_oloc;
|
|
H5O_t * targ_oh = NULL;
|
|
htri_t stab_exists;
|
|
H5O_stab_t stab;
|
|
unsigned i;
|
|
int ret_value = H5_ITER_CONT;
|
|
|
|
FUNC_ENTER_STATIC
|
|
|
|
/* Check arguments */
|
|
HDassert(f);
|
|
HDassert(H5F_addr_defined(addr));
|
|
|
|
/* Load the node */
|
|
if (NULL == (sn = (H5G_node_t *)H5AC_protect(f, H5AC_SNODE, addr, f, H5AC__READ_ONLY_FLAG)))
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node")
|
|
|
|
/* Check each target object to see if its stab message (if present) matches
|
|
* the cached stab (if present). If one exists, both must exist. */
|
|
/* Initialize constant fields in target oloc */
|
|
targ_oloc.file = f;
|
|
targ_oloc.holding_file = FALSE;
|
|
|
|
/* Iterate over entries */
|
|
for (i = 0; i < sn->nsyms; i++) {
|
|
/* Update oloc address */
|
|
targ_oloc.addr = sn->entry[i].header;
|
|
|
|
/* Load target object header */
|
|
if (NULL == (targ_oh = H5O_protect(&targ_oloc, H5AC__READ_ONLY_FLAG, FALSE)))
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to protect target object header")
|
|
|
|
/* Check if a symbol table message exists */
|
|
if ((stab_exists = H5O_msg_exists_oh(targ_oh, H5O_STAB_ID)) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5_ITER_ERROR, "unable to check for STAB message")
|
|
|
|
if (stab_exists) {
|
|
/* Read symbol table message */
|
|
if (NULL == H5O_msg_read_oh(f, targ_oh, H5O_STAB_ID, &stab))
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to read STAB message")
|
|
|
|
/* Check if the stab matches the cached stab info */
|
|
if (sn->entry[i].type != H5G_CACHED_STAB)
|
|
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, "STAB message is not cached in group node")
|
|
|
|
if ((sn->entry[i].cache.stab.btree_addr != stab.btree_addr) ||
|
|
(sn->entry[i].cache.stab.heap_addr != stab.heap_addr))
|
|
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR,
|
|
"cached symbol table information is incorrect")
|
|
}
|
|
else if (sn->entry[i].type == H5G_CACHED_STAB)
|
|
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, "nonexistent STAB message is cached")
|
|
|
|
/* Unprotect target object */
|
|
if (H5O_unprotect(&targ_oloc, targ_oh, H5AC__NO_FLAGS_SET) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to release object header");
|
|
targ_oh = NULL;
|
|
} /* end for */
|
|
|
|
done:
|
|
if (sn && H5AC_unprotect(f, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0)
|
|
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header")
|
|
|
|
if (targ_oh) {
|
|
HDassert(ret_value == H5_ITER_ERROR);
|
|
if (H5O_unprotect(&targ_oloc, targ_oh, H5AC__NO_FLAGS_SET) < 0)
|
|
HDONE_ERROR(H5E_SYM, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to release object header");
|
|
} /* end if */
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
|
} /* end H5G__verify_cached_stabs_test_cb() */
|
|
|
|
/*-------------------------------------------------------------------------
|
|
* Function: H5G__verify_cached_stabs_test
|
|
*
|
|
* Purpose: If the provided group contains a symbol table, verifies
|
|
* that all links in the group contain cached symbol table
|
|
* information if and only if the link points to a group
|
|
* with a symbol table, and that that information is correct.
|
|
* If the provided group does not contain a symbol table,
|
|
* does nothing.
|
|
*
|
|
* Return: Non-negative on success/Negative on failure
|
|
*
|
|
* Programmer: Neil Fortner
|
|
* April 6 2011
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
herr_t
|
|
H5G__verify_cached_stabs_test(hid_t gid)
|
|
{
|
|
H5G_t * grp = NULL; /* Group */
|
|
htri_t stab_exists;
|
|
H5O_stab_t stab; /* Symbol table message */
|
|
H5G_bt_common_t udata = {NULL, NULL}; /* Dummy udata so H5B_iterate doesn't freak out */
|
|
haddr_t prev_tag = HADDR_UNDEF; /* Previous metadata tag */
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
|
|
|
FUNC_ENTER_PACKAGE
|
|
|
|
/* check args */
|
|
HDassert(gid >= 0);
|
|
|
|
/* Check args */
|
|
if (NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP)))
|
|
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
|
|
|
|
/* Set up metadata tagging */
|
|
H5AC_tag(grp->oloc.addr, &prev_tag);
|
|
|
|
/* Check for group having a symbol table message */
|
|
/* Check for the group having a group info message */
|
|
if ((stab_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
|
|
|
|
/* No need to check anything if the symbol table doesn't exist */
|
|
if (!stab_exists)
|
|
HGOTO_DONE(SUCCEED);
|
|
|
|
/* Read the stab */
|
|
if (NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, &stab))
|
|
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get symbol table info")
|
|
|
|
/* Iterate over the b-tree, checking validity of cached information */
|
|
if ((ret_value = H5B_iterate(grp->oloc.file, H5B_SNODE, stab.btree_addr, H5G__verify_cached_stabs_test_cb,
|
|
&udata)) < 0)
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "iteration operator failed");
|
|
|
|
/* Reset metadata tagging */
|
|
H5AC_tag(prev_tag, NULL);
|
|
|
|
done:
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
|
} /* end H5G__verify_cached_stabs_test() */
|