summaryrefslogtreecommitdiffstats
path: root/src/H5Gtest.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-10-02 10:24:03 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-10-02 10:24:03 (GMT)
commita6f6462541cc57364586f770131e2ea074d63492 (patch)
tree0debf502fb7d66f9f470edb935a62223945960d4 /src/H5Gtest.c
parent9bc29ea538b9ce2013a8cde5be230c18cf052009 (diff)
downloadhdf5-a6f6462541cc57364586f770131e2ea074d63492.zip
hdf5-a6f6462541cc57364586f770131e2ea074d63492.tar.gz
hdf5-a6f6462541cc57364586f770131e2ea074d63492.tar.bz2
[svn-r12700] Alert:
File format is not stable, don't keep files produced! Description: First stage of checkins modifying the format of groups to support creation order. Implement "dense" storage for links in groups. Try to clarify some of the symbols for the H5L API. Add the H5Pset_latest_format() flag for FAPLs, to choose to use the newest file format options (including "dense" link storage in groups) Add the H5Pset_track_creation_order() flag for GCPLs, to enable creation order tracking in groups (although no index on creation order yet). Remove --enable-group-revision configure flag, as file format issues are now handled in a backwardly/forwardly compatible way. Clean up lots of compiler warnings and other minor formatting issues. Tested on: FreeBSD/32 4.11 (sleipnir) w/threadsafe Linux/32 2.4 (heping) w/FORTRAN & C++ Linux/64 2.4 (mir) w/enable-v1.6 compa Mac OSX/32 10.4.8 (amazon) AIX 5.3 (copper) w/parallel & FORTRAN
Diffstat (limited to 'src/H5Gtest.c')
-rw-r--r--src/H5Gtest.c142
1 files changed, 135 insertions, 7 deletions
diff --git a/src/H5Gtest.c b/src/H5Gtest.c
index 262a925..a142dfd 100644
--- a/src/H5Gtest.c
+++ b/src/H5Gtest.c
@@ -29,7 +29,6 @@
#include "H5HLprivate.h" /* Local Heaps */
#include "H5Iprivate.h" /* IDs */
-#ifdef H5_GROUP_REVISION
/*--------------------------------------------------------------------------
NAME
@@ -43,7 +42,7 @@
Non-negative TRUE/FALSE on success, negative on failure
DESCRIPTION
Checks to see if the group has no link messages and no symbol table message
- dimensionality and shape.
+ and no "dense" link storage
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
@@ -54,7 +53,8 @@ htri_t
H5G_is_empty_test(hid_t gid)
{
H5G_t *grp = NULL; /* Pointer to group */
- htri_t msg_exists = 0; /* Indicate that a header message is present */
+ 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 */
htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI(H5G_is_empty_test, FAIL)
@@ -63,17 +63,79 @@ H5G_is_empty_test(hid_t gid)
if(NULL == (grp = H5I_object_verify(gid, H5I_GROUP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
+ /* "New format" checks */
+
/* Check if the group has any link messages */
if((msg_exists = H5O_exists(&(grp->oloc), H5O_LINK_ID, 0, H5AC_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
- if(msg_exists > 0)
+ if(msg_exists > 0) {
+ /* Sanity check that new group format shouldn't have old messages */
+ if((msg_exists = H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_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_exists(&(grp->oloc), H5O_LINFO_ID, 0, H5AC_dxpl_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_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_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(NULL == H5O_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, H5AC_dxpl_id))
+ 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.link_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_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
- if(msg_exists > 0)
- HGOTO_DONE(FALSE)
+ 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_exists(&(grp->oloc), H5O_GINFO_ID, 0, H5AC_dxpl_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_read(&(grp->oloc), H5O_STAB_ID, 0, &stab, H5AC_dxpl_id))
+ 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, H5AC_dxpl_id) < 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:
FUNC_LEAVE_NOAPI(ret_value)
@@ -185,7 +247,73 @@ H5G_has_stab_test(hid_t gid)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5G_has_stab_test() */
-#endif /* H5_GROUP_REVISION */
+
+
+/*--------------------------------------------------------------------------
+ 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
+ Non-negative TRUE/FALSE on success, negative 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 */
+ htri_t ret_value = TRUE; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_is_new_dense_test, FAIL)
+
+ /* Get group structure */
+ if(NULL == (grp = H5I_object_verify(gid, H5I_GROUP)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
+
+ /* Check if the group has a symbol table message */
+ if((msg_exists = H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_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_exists(&(grp->oloc), H5O_LINK_ID, 0, H5AC_dxpl_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_exists(&(grp->oloc), H5O_LINFO_ID, 0, H5AC_dxpl_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(NULL == H5O_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, H5AC_dxpl_id))
+ 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.link_fheap_addr))
+ HGOTO_DONE(FALSE)
+ if(!H5F_addr_defined(linfo.name_bt2_addr))
+ HGOTO_DONE(FALSE)
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5G_is_new_dense_test() */
/*--------------------------------------------------------------------------