summaryrefslogtreecommitdiffstats
path: root/src/H5Oattribute.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-07-17 19:35:09 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-07-17 19:35:09 (GMT)
commit4be636f4f00271f85802fbb6ef079146f2dbf7fb (patch)
tree0a3d45b3e72f36a0b71087b194b328edd88d12cc /src/H5Oattribute.c
parenta926dc97d531c87ca098cfaac0b500e808ddbd7b (diff)
downloadhdf5-4be636f4f00271f85802fbb6ef079146f2dbf7fb.zip
hdf5-4be636f4f00271f85802fbb6ef079146f2dbf7fb.tar.gz
hdf5-4be636f4f00271f85802fbb6ef079146f2dbf7fb.tar.bz2
[svn-r13984] Description:
Various code cleanups and refactor recent changes for h5stat to fit into the existing library data structures better. Tested on: Mac OS X/32 10.4.10 (amazon) FreeBSD/32 6.2 (duty) Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'src/H5Oattribute.c')
-rw-r--r--src/H5Oattribute.c63
1 files changed, 29 insertions, 34 deletions
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index f0bafc9..b328f5b 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -1687,6 +1687,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_exists */
+
/*-------------------------------------------------------------------------
* Function: H5O_attr_bh_info
@@ -1701,49 +1702,43 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_attr_bh_info(H5O_loc_t *oloc, H5O_t *oh, hid_t dxpl_id, H5_ih_info_t *bh_info)
+H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
{
- H5O_ainfo_t ainfo; /* Attribute information for object */
- herr_t ret_value=SUCCEED; /* Return value */
- hsize_t huge_bt_size=0;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5O_attr_bh_info, FAIL)
- HDassert(oloc);
+ HDassert(f);
HDassert(oh);
HDassert(bh_info);
- /* Check for attribute info stored */
- ainfo.nattrs = 0;
- ainfo.fheap_addr = HADDR_UNDEF;
- ainfo.corder_bt2_addr = HADDR_UNDEF;
- ainfo.name_bt2_addr = HADDR_UNDEF;
- if(oh->version > H5O_VERSION_1 && NULL == H5A_get_ainfo(oloc->file, dxpl_id, oh, &ainfo))
- /* Clear error stack from not finding attribute info */
- H5E_clear_stack(NULL);
-
+ /* Attributes are only stored in fractal heap & indexed w/v2 B-tree in later versions */
if(oh->version > H5O_VERSION_1) {
- if (H5F_addr_defined(ainfo.corder_bt2_addr)) {
- if (H5B2_info_iterate(oloc->file, dxpl_id, H5A_BT2_CORDER,
- ainfo.corder_bt2_addr, &(bh_info->index_size)) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
- }
-
- if (H5F_addr_defined(ainfo.name_bt2_addr)) {
- if (H5B2_info_iterate(oloc->file, dxpl_id, H5A_BT2_NAME,
- ainfo.name_bt2_addr, &(bh_info->index_size)) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
- }
-
- huge_bt_size = 0;
- if (H5F_addr_defined(ainfo.fheap_addr)) {
- HDassert(H5O_msg_count_real(oh, H5O_MSG_ATTR) == 0);
- if (H5HF_fheap_info(oloc->file, dxpl_id, ainfo.fheap_addr, &(bh_info->heap_size), &huge_bt_size) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
- bh_info->index_size += huge_bt_size;
- }
- }
+ H5O_ainfo_t ainfo; /* Attribute information for object */
+
+ /* Check for attribute info stored */
+ if(NULL == H5A_get_ainfo(f, dxpl_id, oh, &ainfo))
+ /* Clear error stack from not finding attribute info */
+ H5E_clear_stack(NULL);
+ else {
+ /* Get storage size of creation order index, if it's used */
+ if(H5F_addr_defined(ainfo.corder_bt2_addr))
+ if(H5B2_iterate_size(f, dxpl_id, H5A_BT2_CORDER, ainfo.corder_bt2_addr, &(bh_info->index_size)) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
+
+ /* Get storage size of name index, if it's used */
+ if(H5F_addr_defined(ainfo.name_bt2_addr))
+ if(H5B2_iterate_size(f, dxpl_id, H5A_BT2_NAME, ainfo.name_bt2_addr, &(bh_info->index_size)) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
+
+ /* Get storage size of fractal heap, if it's used */
+ if(H5F_addr_defined(ainfo.fheap_addr))
+ if(H5HF_size(f, dxpl_id, ainfo.fheap_addr, &(bh_info->heap_size)) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
+ } /* end else */
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_attr_bh_info() */
+