diff options
Diffstat (limited to 'src/H5Otest.c')
-rw-r--r-- | src/H5Otest.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/H5Otest.c b/src/H5Otest.c index b1b0751..e442374 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -258,3 +258,68 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5O_num_attrs_test() */ + +/*-------------------------------------------------------------------------- + NAME + H5O_attr_dense_info_test + PURPOSE + Retrieve information about the state of the "dense" storage for attributes + USAGE + herr_t H5O_attr_dense_info_test(oid, name_count, corder_count) + hid_t oid; IN: Object to check + hsize_t *name_count; OUT: Number of attributes in name index + hsize_t *corder_count; OUT: Number of attributes in creation order index + RETURNS + Non-negative on success, negative on failure + DESCRIPTION + Currently, just retrieves the number of attributes 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 +H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) +{ + H5O_t *oh = NULL; /* Object header */ + H5O_loc_t *oloc; /* Pointer to object's location */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5O_attr_dense_info_test, FAIL) + + /* Get object location for object */ + if(NULL == (oloc = H5O_get_loc(oid))) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + + /* Get the object header */ + if(NULL == (oh = H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + + /* Check for 'dense' attribute storage file addresses being defined */ + if(!H5F_addr_defined(oh->attr_fheap_addr)) + HGOTO_DONE(FAIL) + if(!H5F_addr_defined(oh->name_bt2_addr)) + HGOTO_DONE(FAIL) + + /* Retrieve # of records in name index */ + if(H5B2_get_nrec(oloc->file, H5AC_ind_dxpl_id, H5A_BT2_NAME, oh->name_bt2_addr, name_count) < 0) + HGOTO_ERROR(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(oh->corder_bt2_addr)) { + /* Retrieve # of records in creation order index */ + if(H5B2_get_nrec(oloc->file, H5AC_ind_dxpl_id, H5A_BT2_CORDER, oh->corder_bt2_addr, corder_count) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from creation order index") + } /* end if */ + else + *corder_count = 0; + +done: + if(oh && H5AC_unprotect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5O_attr_dense_info_test() */ + |