2
0
mirror of https://github.com/HDFGroup/hdf5.git synced 2025-04-24 17:51:25 +08:00

Remainder of vol_normalization changes (dataset, attribute, files, objects).

This commit is contained in:
Dana Robinson 2018-09-24 12:23:41 -07:00
parent 37309c1bd9
commit a56b4db4ae
72 changed files with 3487 additions and 3310 deletions

532
src/H5A.c

File diff suppressed because it is too large Load Diff

@ -164,11 +164,11 @@ typedef struct H5A_bt2_ud_rmbi_t {
/*-------------------------------------------------------------------------
* Function: H5A__dense_create
* Function: H5A__dense_create
*
* Purpose: Creates dense attribute storage structures for an object
* Purpose: Creates dense attribute storage structures for an object
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -188,9 +188,7 @@ H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo)
FUNC_ENTER_PACKAGE
/*
* Check arguments.
*/
/* Check arguments */
HDassert(f);
HDassert(ainfo);
@ -286,11 +284,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__dense_fnd_cb
* Function: H5A__dense_fnd_cb
*
* Purpose: Callback when an attribute is located in an index
* Purpose: Callback when an attribute is located in an index
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -305,9 +303,7 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr)
FUNC_ENTER_STATIC_NOERR
/*
* Check arguments.
*/
/* Check arguments */
HDassert(attr);
HDassert(user_attr);
@ -320,11 +316,11 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr)
/*-------------------------------------------------------------------------
* Function: H5A__dense_open
* Function: H5A__dense_open
*
* Purpose: Open an attribute in dense storage structures for an object
* Purpose: Open an attribute in dense storage structures for an object
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -345,9 +341,7 @@ H5A__dense_open(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name)
FUNC_ENTER_PACKAGE
/*
* Check arguments.
*/
/* Check arguments */
HDassert(f);
HDassert(ainfo);
HDassert(name);
@ -411,11 +405,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__dense_insert
* Function: H5A__dense_insert
*
* Purpose: Insert an attribute into dense storage structures for an object
* Purpose: Insert an attribute into dense storage structures for an object
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -439,9 +433,7 @@ H5A__dense_insert(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr)
FUNC_ENTER_PACKAGE
/*
* Check arguments.
*/
/* Check arguments */
HDassert(f);
HDassert(ainfo);
HDassert(attr);
@ -570,13 +562,12 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__dense_write_bt2_cb2
* Function: H5A__dense_write_bt2_cb2
*
* Purpose: v2 B-tree 'modify' callback to update the record for a creation
* order index
* Purpose: v2 B-tree 'modify' callback to update the record for a creation
* order index
*
* Return: Success: 0
* Failure: 1
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Tuesday, February 20, 2007
@ -591,9 +582,7 @@ H5A__dense_write_bt2_cb2(void *_record, void *_op_data, hbool_t *changed)
FUNC_ENTER_STATIC_NOERR
/*
* Check arguments.
*/
/* Check arguments */
HDassert(record);
HDassert(new_heap_id);
@ -608,12 +597,11 @@ H5A__dense_write_bt2_cb2(void *_record, void *_op_data, hbool_t *changed)
/*-------------------------------------------------------------------------
* Function: H5A__dense_write_bt2_cb
* Function: H5A__dense_write_bt2_cb
*
* Purpose: v2 B-tree 'modify' callback to update the data for an attribute
* Purpose: v2 B-tree 'modify' callback to update the data for an attribute
*
* Return: Success: 0
* Failure: 1
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Tuesday, December 5, 2006
@ -632,9 +620,7 @@ H5A__dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed)
FUNC_ENTER_STATIC
/*
* Check arguments.
*/
/* Check arguments */
HDassert(record);
HDassert(op_data);
@ -722,11 +708,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__dense_write
* Function: H5A__dense_write
*
* Purpose: Modify an attribute in dense storage structures for an object
* Purpose: Modify an attribute in dense storage structures for an object
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -747,9 +733,7 @@ H5A__dense_write(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr)
FUNC_ENTER_PACKAGE
/*
* Check arguments.
*/
/* Check arguments */
HDassert(f);
HDassert(ainfo);
HDassert(H5F_addr_defined(ainfo->fheap_addr));
@ -820,12 +804,12 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__dense_copy_fh_cb
* Function: H5A__dense_copy_fh_cb
*
* Purpose: Callback for fractal heap operator, to make copy of attribute
* Purpose: Callback for fractal heap operator, to make copy of attribute
* for calling routine
*
* Return: SUCCEED/FAIL
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -864,11 +848,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__dense_rename
* Function: H5A__dense_rename
*
* Purpose: Rename an attribute in dense storage structures for an object
* Purpose: Rename an attribute in dense storage structures for an object
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -892,9 +876,7 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name,
FUNC_ENTER_PACKAGE
/*
* Check arguments.
*/
/* Check arguments */
HDassert(f);
HDassert(ainfo);
HDassert(old_name);
@ -996,7 +978,7 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name,
HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust attribute link count")
} /* end if */
else if(shared_mesg < 0)
HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "error determining if message should be shared")
HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "error determining if message should be shared")
/* Delete old attribute from dense storage */
if(H5A__dense_remove(f, ainfo, old_name) < 0)
@ -1018,11 +1000,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__dense_iterate_bt2_cb
* Function: H5A__dense_iterate_bt2_cb
*
* Purpose: v2 B-tree callback for dense attribute storage iterator
* Purpose: v2 B-tree callback for dense attribute storage iterator
*
* Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP
* Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -1030,7 +1012,7 @@ done:
*
*-------------------------------------------------------------------------
*/
static herr_t
static int
H5A__dense_iterate_bt2_cb(const void *_record, void *_bt2_udata)
{
const H5A_dense_bt2_name_rec_t *record = (const H5A_dense_bt2_name_rec_t *)_record; /* Record from B-tree */
@ -1114,11 +1096,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__dense_iterate
* Function: H5A__dense_iterate
*
* Purpose: Iterate over attributes in dense storage structures for an object
* Purpose: Iterate over attributes in dense storage structures for an object
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -1140,9 +1122,7 @@ H5A__dense_iterate(H5F_t *f, hid_t loc_id, const H5O_ainfo_t *ainfo,
FUNC_ENTER_PACKAGE
/*
* Check arguments.
*/
/* Check arguments */
HDassert(f);
HDassert(ainfo);
HDassert(H5F_addr_defined(ainfo->fheap_addr));
@ -1251,11 +1231,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__dense_remove_bt2_cb
* Function: H5A__dense_remove_bt2_cb
*
* Purpose: v2 B-tree callback for dense attribute storage record removal
* Purpose: v2 B-tree callback for dense attribute storage record removal
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -1315,11 +1295,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__dense_remove
* Function: H5A__dense_remove
*
* Purpose: Remove an attribute from the dense storage of an object
* Purpose: Remove an attribute from the dense storage of an object
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -1340,9 +1320,7 @@ H5A__dense_remove(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name)
FUNC_ENTER_PACKAGE
/*
* Check arguments.
*/
/* Check arguments */
HDassert(f);
HDassert(ainfo);
HDassert(name && *name);
@ -1398,18 +1376,18 @@ done:
if(bt2_name && H5B2_close(bt2_name) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
if(attr_copy)
H5O__msg_free_real(H5O_MSG_ATTR, attr_copy);
H5O_msg_free_real(H5O_MSG_ATTR, attr_copy);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_remove() */
/*-------------------------------------------------------------------------
* Function: H5A__dense_remove_by_idx_bt2_cb
* Function: H5A__dense_remove_by_idx_bt2_cb
*
* Purpose: v2 B-tree callback for dense attribute storage record removal by index
* Purpose: v2 B-tree callback for dense attribute storage record removal by index
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -1530,12 +1508,12 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__dense_remove_by_idx
* Function: H5A__dense_remove_by_idx
*
* Purpose: Remove an attribute from the dense storage of an object,
* according to the order within an index
* Purpose: Remove an attribute from the dense storage of an object,
* according to the order within an index
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -1556,9 +1534,7 @@ H5A__dense_remove_by_idx(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type
FUNC_ENTER_PACKAGE
/*
* Check arguments.
*/
/* Check arguments */
HDassert(f);
HDassert(ainfo);
@ -1660,12 +1636,12 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__dense_exists
* Function: H5A__dense_exists
*
* Purpose: Check if an attribute exists in dense storage structures for
* Purpose: Check if an attribute exists in dense storage structures for
* an object
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -1685,9 +1661,7 @@ H5A__dense_exists(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name)
FUNC_ENTER_PACKAGE
/*
* Check arguments.
*/
/* Check arguments */
HDassert(f);
HDassert(ainfo);
HDassert(name);
@ -1749,11 +1723,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__dense_delete_bt2_cb
* Function: H5A__dense_delete_bt2_cb
*
* Purpose: v2 B-tree callback for dense attribute storage deletion
* Purpose: v2 B-tree callback for dense attribute storage deletion
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -1806,18 +1780,18 @@ H5A__dense_delete_bt2_cb(const void *_record, void *_bt2_udata)
done:
/* Release resources */
if(attr)
H5O__msg_free_real(H5O_MSG_ATTR, attr);
H5O_msg_free_real(H5O_MSG_ATTR, attr);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_delete_bt2_cb() */
/*-------------------------------------------------------------------------
* Function: H5A__dense_delete
* Function: H5A__dense_delete
*
* Purpose: Delete all dense storage structures for attributes on an object
* Purpose: Delete all dense storage structures for attributes on an object
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -1834,9 +1808,7 @@ H5A__dense_delete(H5F_t *f, H5O_ainfo_t *ainfo)
FUNC_ENTER_PACKAGE
/*
* Check arguments.
*/
/* Check arguments */
HDassert(f);
HDassert(ainfo);

@ -36,13 +36,13 @@
/***********/
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Apkg.h" /* Attributes */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
#include "H5Opkg.h" /* Object headers */
#include "H5private.h" /* Generic Functions */
#include "H5Apkg.h" /* Attributes */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
#include "H5Opkg.h" /* Object headers */
/****************/
@ -95,7 +95,7 @@
hid_t space_id; IN: ID of dataspace for attribute
hid_t acpl_id; IN: ID of creation property list (currently not used)
RETURNS
Non-negative on success/Negative on failure
Non-negative on success/H5I_INVALID_HID on failure
DESCRIPTION
This function creates an attribute which is attached to the object
@ -111,50 +111,51 @@
--------------------------------------------------------------------------*/
hid_t
H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
hid_t acpl_id)
hid_t acpl_id)
{
H5A_t *attr = NULL; /* Attribute created */
H5G_loc_t loc; /* Object location */
H5T_t *type; /* Datatype to use for attribute */
H5S_t *space; /* Dataspace to use for attribute */
hid_t ret_value; /* Return value */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(FAIL)
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE5("i", "i*siii", loc_id, name, type_id, space_id, acpl_id);
/* check arguments */
/* Check arguments */
if(H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute")
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR))
HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, FAIL, "no write intent on file")
HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, H5I_INVALID_HID, "no write intent on file")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name")
if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a type")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a type")
if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read")
/* Go do the real work for attaching the attribute to the dataset */
/* Create the attribute */
if(NULL == (attr = H5A__create(&loc, name, type, space, acpl_id)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute")
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */
if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID")
done:
/* Cleanup on failure */
if(ret_value < 0 && attr && H5A__close(attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
/* Clean up on failure */
if(H5I_INVALID_HID == ret_value)
if(attr && H5A__close(attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Acreate1() */
} /* end H5Acreate1() */
/*--------------------------------------------------------------------------
@ -167,7 +168,7 @@ done:
hid_t loc_id; IN: Object (dataset or group) to be attached to
const char *name; IN: Name of attribute to locate and open
RETURNS
ID of attribute on success, negative on failure
ID of attribute on success, H5I_INVALID_HID on failure
DESCRIPTION
This function opens an existing attribute for access. The attribute
@ -184,32 +185,32 @@ H5Aopen_name(hid_t loc_id, const char *name)
{
H5G_loc_t loc; /* Object location */
H5A_t *attr = NULL; /* Attribute opened */
hid_t ret_value;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(FAIL)
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "i*s", loc_id, name);
/* check arguments */
/* Check arguments */
if(H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute")
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name")
/* Open the attribute on the object header */
/* Open the attribute */
if(NULL == (attr = H5A__open_by_name(&loc, ".", name)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute: '%s'", name)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "can't open attribute: '%s'", name)
/* Register the attribute and get an ID for it */
if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID")
done:
/* Cleanup on failure */
if(ret_value < 0)
/* Clean up on failure */
if(H5I_INVALID_HID == ret_value)
if(attr && H5A__close(attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Aopen_name() */
@ -225,7 +226,7 @@ done:
hid_t loc_id; IN: Object that attribute is attached to
unsigned idx; IN: Index (0-based) attribute to open
RETURNS
ID of attribute on success, negative on failure
ID of attribute on success, H5I_INVALID_HID on failure
DESCRIPTION
This function opens an existing attribute for access. The attribute
@ -242,30 +243,30 @@ H5Aopen_idx(hid_t loc_id, unsigned idx)
{
H5G_loc_t loc; /* Object location */
H5A_t *attr = NULL; /* Attribute opened */
hid_t ret_value;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(FAIL)
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "iIu", loc_id, idx);
/* check arguments */
/* Check arguments */
if(H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
/* Open the attribute in the object header */
/* Open the attribute */
if(NULL == (attr = H5A__open_by_idx(&loc, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)idx)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute")
/* Register the attribute and get an ID for it */
if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID")
done:
/* Cleanup on failure */
if(ret_value < 0)
/* Clean up on failure */
if(H5I_INVALID_HID == ret_value)
if(attr && H5A__close(attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Aopen_idx() */
@ -292,34 +293,34 @@ done:
int
H5Aget_num_attrs(hid_t loc_id)
{
H5O_loc_t *loc; /* Object location for attribute */
void *obj;
int ret_value;
H5O_loc_t *loc; /* Object location for attribute */
void *obj;
int ret_value = -1;
FUNC_ENTER_API(FAIL)
FUNC_ENTER_API((-1))
H5TRACE1("Is", "i", loc_id);
/* check arguments */
if(H5I_BADID == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad location ID")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "bad location ID")
if(H5I_FILE == H5I_get_type(loc_id) || H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "location is not valid for an attribute")
if(NULL == (obj = H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADATOM, FAIL, "illegal object atom")
HGOTO_ERROR(H5E_ARGS, H5E_BADATOM, (-1), "illegal object atom")
switch(H5I_get_type (loc_id)) {
case H5I_DATASET:
if(NULL == (loc = H5D_oloc((H5D_t*)obj)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get location for object")
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "can't get location for object")
break;
case H5I_DATATYPE:
if(NULL == (loc = H5T_oloc((H5T_t*)obj)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "target datatype is not committed")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "target datatype is not committed")
break;
case H5I_GROUP:
if(NULL == (loc = H5G_oloc((H5G_t*)obj)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get location for object")
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "can't get location for object")
break;
case H5I_UNINIT:
@ -336,12 +337,12 @@ H5Aget_num_attrs(hid_t loc_id)
case H5I_ERROR_STACK:
case H5I_NTYPES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "inappropriate attribute target")
} /*lint !e788 All appropriate cases are covered */
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "inappropriate attribute target")
}
/* Look up the # of attributes for the object */
if((ret_value = H5O__attr_count(loc)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get attribute count for object")
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, (-1), "can't get attribute count for object")
done:
FUNC_LEAVE_API(ret_value)
@ -388,14 +389,14 @@ done:
herr_t
H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data)
{
herr_t ret_value; /* Return value */
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*Iux*x", loc_id, attr_num, op, op_data);
/* check arguments */
if(H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
/* Call attribute iteration routine */
if((ret_value = H5A__iterate_old(loc_id, attr_num, op, op_data)) < 0)

@ -87,7 +87,6 @@ typedef struct {
/* Local Prototypes */
/********************/
static herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr);
static herr_t H5A__compact_build_table_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned sequence, unsigned *oh_flags_ptr, void *_udata/*in,out*/);
static herr_t H5A__dense_build_table_cb(const H5A_t *attr, void *_udata);
@ -137,7 +136,7 @@ H5FL_SEQ_DEFINE(H5A_t_ptr);
*-------------------------------------------------------------------------
*/
H5A_t *
H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type,
const H5S_t *space, hid_t acpl_id)
{
H5A_t *attr = NULL; /* Attribute created */
@ -150,7 +149,7 @@ H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
/* Check args */
HDassert(loc);
HDassert(name);
HDassert(attr_name);
HDassert(type);
HDassert(space);
@ -159,7 +158,7 @@ H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
* name, but it's going to be hard to unwind all the special cases on
* failure, so just check first, for now - QAK)
*/
if((exists = H5O__attr_exists(loc->oloc, name)) < 0)
if((exists = H5O__attr_exists(loc->oloc, attr_name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "error checking attributes")
else if(exists > 0)
HGOTO_ERROR(H5E_ATTR, H5E_ALREADYEXISTS, NULL, "attribute already exists")
@ -194,7 +193,7 @@ H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
} /* end else */
/* Copy the attribute name */
attr->shared->name = H5MM_xstrdup(name);
attr->shared->name = H5MM_xstrdup(attr_name);
/* Copy datatype */
if(NULL == (attr->shared->dt = H5T_copy(type, H5T_COPY_ALL)))
@ -232,9 +231,9 @@ H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
* SOHM table
*/
if(H5SM_try_share(attr->oloc.file, NULL, 0, H5O_DTYPE_ID, attr->shared->dt, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share datatype failed")
HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share datatype failed")
if(H5SM_try_share(attr->oloc.file, NULL, 0, H5O_SDSPACE_ID, attr->shared->ds, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share dataspace failed")
HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share dataspace failed")
/* Check whether datatype is committed & increment ref count
* (to maintain ref. count incr/decr similarity with "shared message"
@ -365,12 +364,12 @@ done:
*
*-------------------------------------------------------------------------
*/
static herr_t
herr_t
H5A__open_common(const H5G_loc_t *loc, H5A_t *attr)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
FUNC_ENTER_PACKAGE
/* check args */
HDassert(loc);
@ -514,11 +513,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__open_by_name
* Function: H5A__open_by_name
*
* Purpose: Open an attribute in an object header, according to it's name
* Purpose: Open an attribute in an object header, according to it's name
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 11, 2006
@ -922,8 +921,9 @@ H5A__get_type(H5A_t *attr)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype")
done:
if(H5I_INVALID_HID == ret_value && dt && (H5T_close(dt) < 0))
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype")
if(H5I_INVALID_HID == ret_value)
if(dt && H5T_close(dt) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__get_type() */
@ -1017,21 +1017,17 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__copy
* Function: H5A__copy
*
* Purpose: Copies attribute OLD_ATTR.
* Purpose: Copies attribute OLD_ATTR.
*
* Return: Success: Pointer to a new copy of the OLD_ATTR argument.
* Return: Success: Pointer to a new copy of the OLD_ATTR argument.
*
* Failure: NULL
* Failure: NULL
*
* Programmer: Robb Matzke
* Thursday, December 4, 1997
*
* Modification:Raymond Lu
* 4 June 2008
* Changed some attribute information to be shared.
*
*-------------------------------------------------------------------------
*/
H5A_t *
@ -1084,18 +1080,16 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__free
* Function: H5A__free
*
* Purpose: Frees all memory associated with an attribute, but does not
* Purpose: Frees all memory associated with an attribute, but does not
* free the H5A_t structure (which should be done in H5T_close).
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, November 15, 2004
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
herr_t
@ -1114,12 +1108,12 @@ H5A__free(H5A_t *attr)
}
if(attr->shared->dt) {
if(H5T_close_real(attr->shared->dt) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release datatype info")
HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release datatype info")
attr->shared->dt = NULL;
}
if(attr->shared->ds) {
if(H5S_close(attr->shared->ds) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info")
HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info")
attr->shared->ds = NULL;
}
if(attr->shared->data)
@ -1131,21 +1125,18 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__close_cb
* Function: H5A__close_cb
*
* Purpose: Frees an attribute and all associated memory.
* Purpose: Called when the ref count reaches zero on the attribute's ID
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Sunday, February 18, 1997
* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5A__close_cb(H5A_t *attr)
{
herr_t ret_value = SUCCEED; /* Return value */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@ -1153,9 +1144,9 @@ H5A__close_cb(H5A_t *attr)
HDassert(attr);
HDassert(attr->shared);
/* Call the actual close routine */
/* Close the attribute */
if(H5A__close(attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "problem closing attribute")
HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "problem closing attribute")
done:
FUNC_LEAVE_NOAPI(ret_value)
@ -1163,11 +1154,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__close
* Function: H5A__close
*
* Purpose: Frees an attribute and all associated memory.
* Purpose: Frees an attribute and all associated memory.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Monday, December 8, 1997
@ -1310,12 +1301,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__exists_by_name
* Function: H5A__exists_by_name
*
* Purpose: Private version of H5Aexists_by_name
* Purpose: Private version of H5Aexists_by_name
*
* Return: Success: TRUE/FALSE
* Failure: Negative
* Return: TRUE/FALSE/FAIL
*
* Programmer: Quincey Koziol
* Thursday, November 1, 2007
@ -1423,11 +1413,10 @@ done:
* Purpose: Builds a table containing a sorted list of attributes for
* an object
*
* Note: Used for building table of attributes in non-native iteration
* Note: Used for building table of attributes in non-native iteration
* order for an index
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Dec 18, 2006
@ -1526,17 +1515,16 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__dense_build_table
* Function: H5A__dense_build_table
*
* Purpose: Builds a table containing a sorted list of attributes for
* an object
*
* Note: Used for building table of attributes in non-native iteration
* Note: Used for building table of attributes in non-native iteration
* order for an index. Uses the "name" index to retrieve records,
* but the 'idx_type' index for sorting them.
* but the 'idx_type' index for sorting them.
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Dec 11, 2006
@ -1783,13 +1771,12 @@ H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type,
/*-------------------------------------------------------------------------
* Function: H5A__attr_iterate_table
* Function: H5A__attr_iterate_table
*
* Purpose: Iterate over table containing a list of attributes for an object,
* making appropriate callbacks
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Dec 18, 2006
@ -1866,12 +1853,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__attr_release_table
* Function: H5A__attr_release_table
*
* Purpose: Release table containing a list of attributes for an object
* Purpose: Release table containing a list of attributes for an object
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Dec 11, 2006
@ -1913,8 +1899,8 @@ done:
* Purpose: Retrieves the "attribute info" message for an object. Also
* sets the number of attributes correctly, if it isn't set up yet.
*
* Return: Success: TRUE/FALSE whether message was found & retrieved
* Failure: FAIL if error occurred
* Return: Success: TRUE/FALSE whether message was found & retrieved
* Failure: FAIL if error occurred
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -1978,8 +1964,7 @@ done:
* Chooses the oldest version possible, unless the
* file's low bound indicates otherwise.
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -2137,9 +2122,9 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s
* committed or sharing is disabled.
*/
if(H5SM_try_share(file_dst, NULL, H5SM_DEFER, H5O_DTYPE_ID, attr_dst->shared->dt, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute datatype")
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute datatype")
if(H5SM_try_share(file_dst, NULL, H5SM_DEFER, H5O_SDSPACE_ID, attr_dst->shared->ds, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute dataspace")
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute dataspace")
/* Compute the sizes of the datatype and dataspace. This is their raw
* size unless they're shared.
@ -2326,7 +2311,7 @@ done:
* an object may have a reference attribute that points to the
* object itself.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Peter Cao
* March 6, 2005
@ -2477,8 +2462,7 @@ done:
*
* Purpose: Copy all dense attributes from SRC to DST.
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Peter Cao
* xcao@hdfgroup.org
@ -2521,12 +2505,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__rename_by_name
* Function: H5A__rename_by_name
*
* Purpose: Private version of H5Arename_by_name
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* February 20, 2007
@ -2545,19 +2528,22 @@ H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_na
FUNC_ENTER_PACKAGE
/* Set up opened group location to fill in */
obj_loc.oloc = &obj_oloc;
obj_loc.path = &obj_path;
H5G_loc_reset(&obj_loc);
/* Avoid thrashing things if the names are the same */
if(HDstrcmp(old_attr_name, new_attr_name)) {
/* Set up opened group location to fill in */
obj_loc.oloc = &obj_oloc;
obj_loc.path = &obj_path;
H5G_loc_reset(&obj_loc);
/* Find the object's location */
if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found")
loc_found = TRUE;
/* Find the object's location */
if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found")
loc_found = TRUE;
/* Call attribute rename routine */
if(H5O__attr_rename(obj_loc.oloc, old_attr_name, new_attr_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
/* Call attribute rename routine */
if(H5O__attr_rename(obj_loc.oloc, old_attr_name, new_attr_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
} /* end if */
done:
/* Release resources */
@ -2569,12 +2555,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A__iterate_common
* Function: H5A__iterate_common
*
* Purpose: Internal common version of H5Aiterate
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 6, 2017
@ -2605,12 +2590,11 @@ H5A__iterate_common(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
/*-------------------------------------------------------------------------
* Function: H5A__iterate
* Function: H5A__iterate
*
* Purpose: Private version of H5Aiterate2
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 6, 2017
@ -2636,17 +2620,16 @@ H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__iterate() */
} /* end H5A__iterate() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
/*-------------------------------------------------------------------------
* Function: H5A__iterate_old
* Function: H5A__iterate_old
*
* Purpose: Private version of H5Aiterate1
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 6, 2017
@ -2689,8 +2672,7 @@ done:
*
* Purpose: Private version of H5Aiterate_by_name
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 6, 2017
@ -2722,12 +2704,12 @@ H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_
loc_found = TRUE;
/* Open the object */
if((obj_loc_id = H5O__open_by_loc(&obj_loc, TRUE)) < 0)
if((obj_loc_id = H5O_open_by_loc(&obj_loc, TRUE)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
/* Build attribute operator info */
attr_op.op_type = H5A_ATTR_OP_APP2;
attr_op.u.app_op2 = op;
attr_op.op_type = H5A_ATTR_OP_APP2;
attr_op.u.app_op2 = op;
/* Call attribute iteration routine */
if((ret_value = H5A__iterate_common(obj_loc_id, idx_type, order, idx, &attr_op, op_data)) < 0)
@ -2738,12 +2720,12 @@ done:
if(obj_loc_id > 0) {
if(H5I_dec_app_ref(obj_loc_id) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object")
} /* end if */
}
else if(loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__iterate_by_name() */
} /* end H5A__iterate_by_name() */
/*-------------------------------------------------------------------------
@ -2751,8 +2733,7 @@ done:
*
* Purpose: Private version of H5Adelete_by_name
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 6, 2017
@ -2798,8 +2779,7 @@ done:
*
* Purpose: Private version of H5Adelete_by_idx
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 6, 2017

@ -191,6 +191,7 @@ H5_DLL H5A_t *H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name,
const char *attr_name);
H5_DLL H5A_t *H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
H5_DLL herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr);
H5_DLL H5A_t *H5A__copy(H5A_t *new_attr, const H5A_t *old_attr);
H5_DLL hid_t H5A__get_type(H5A_t *attr);
H5_DLL herr_t H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo);

544
src/H5D.c

File diff suppressed because it is too large Load Diff

@ -685,13 +685,12 @@ H5D__btree_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key
/* decode */
UINT32DECODE(raw, key->nbytes);
UINT32DECODE(raw, key->filter_mask);
for(u = 0; u < layout->ndims; u++)
{
if (layout->dim[u] == 0)
for(u = 0; u < layout->ndims; u++) {
if(layout->dim[u] == 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u)
/* Retrieve coordinate offset */
UINT64DECODE(raw, tmp_offset);
UINT64DECODE(raw, tmp_offset);
HDassert(0 == (tmp_offset % layout->dim[u]));
/* Convert to a scaled offset */
@ -943,7 +942,7 @@ H5D__btree_idx_create(const H5D_chk_idx_info_t *idx_info)
/* Create the v1 B-tree for the chunk index */
if(H5B_create(idx_info->f, H5B_BTREE, &udata, &(idx_info->storage->idx_addr)/*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create B-tree")
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create B-tree")
done:
FUNC_LEAVE_NOAPI(ret_value)

@ -1547,7 +1547,7 @@ H5D__bt2_idx_dest(const H5D_chk_idx_info_t *idx_info)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer")
/* Close v2 B-tree */
if(H5B2_close(idx_info->storage->u.btree2.bt2) < 0)
if(H5B2_close(idx_info->storage->u.btree2.bt2) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree")
idx_info->storage->u.btree2.bt2 = NULL;
} /* end if */

@ -551,7 +551,7 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters,
/* Get the new file address / chunk size after flushing */
if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
} /* end if */
}
/* Make sure the address of the chunk is returned. */
if(!H5F_addr_defined(udata.chunk_block.offset))
@ -648,8 +648,8 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage
/* Get the new file address / chunk size after flushing */
if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
} /* end if */
} /* end if */
}
}
/* Make sure the address of the chunk is returned. */
if(!H5F_addr_defined(udata.chunk_block.offset))
@ -1300,11 +1300,9 @@ done:
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
if(file_type && (H5T_close_real(file_type) < 0))
HDONE_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "Can't free temporary datatype")
if(file_space_normalized == TRUE) {
/* (Casting away const OK -QAK) */
if(H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset) < 0)
if(file_space_normalized == TRUE)
if(H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset) < 0) /* (Casting away const OK -QAK) */
HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't denormalize selection")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_io_init() */
@ -1503,7 +1501,8 @@ H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file selection")
/* Move selection back to have correct offset in chunk */
H5S_SELECT_ADJUST_U(fm->single_space, coords);
if(H5S_SELECT_ADJUST_U(fm->single_space, coords) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection")
#ifdef H5_HAVE_PARALLEL
/* store chunk selection information */
@ -1615,7 +1614,10 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
} /* end if */
/* Move selection back to have correct offset in chunk */
H5S_SELECT_ADJUST_U(tmp_fchunk, coords);
if(H5S_SELECT_ADJUST_U(tmp_fchunk, coords) < 0) {
(void)H5S_close(tmp_fchunk);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection")
}
/* Add temporary chunk to the list of chunks */
@ -1814,7 +1816,7 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
} /* end for */
/* Adjust the selection */
if(H5S_hyper_adjust_s(chunk_info->mspace, chunk_adjust) < 0) /*lint !e772 The chunk_adjust array will always be initialized */
if(H5S_hyper_adjust_s(chunk_info->mspace, chunk_adjust) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to adjust selection")
/* Get the next chunk node in the skip list */
@ -3183,8 +3185,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent,
hbool_t flush)
H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush)
{
H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk);
herr_t ret_value = SUCCEED; /* Return value */
@ -4199,13 +4200,14 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
while(!carry) {
hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */
/* Look up this chunk */
if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
/* Look up this chunk */
if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
#ifndef NDEBUG
/* None of the chunks should be allocated */
if(H5D_CHUNK_IDX_NONE != layout->storage.u.chunk.idx_type)
HDassert(!H5F_addr_defined(udata.chunk_block.offset));
if(H5D_CHUNK_IDX_NONE != layout->storage.u.chunk.idx_type) {
HDassert(!H5F_addr_defined(udata.chunk_block.offset));
}
/* Make sure the chunk is really in the dataset and outside the
* original dimensions */
@ -4233,7 +4235,8 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
/* Check to make sure the buffer is large enough. It is
* possible (though ill-advised) for the filter to shrink the
* buffer. */
* buffer.
*/
if(fb_info.fill_buf_size < orig_chunk_size) {
if(NULL == (fb_info.fill_buf = H5D__chunk_mem_realloc(fb_info.fill_buf, orig_chunk_size, pline)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory reallocation failed for raw data chunk")
@ -4467,10 +4470,6 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[])
HGOTO_DONE(SUCCEED)
} /* end if */
/*
* Initialize structures needed to lock chunks into cache
*/
/* Set up chunked I/O info object, for operations on chunks (in callback).
* Note that we only need to set chunk_offset once, as the array's address
* will never change. */
@ -6517,31 +6516,31 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old
HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk size can't be encoded")
} /* end block */
if(old_chunk && H5F_addr_defined(old_chunk->offset)) {
/* Sanity check */
if(old_chunk && H5F_addr_defined(old_chunk->offset)) {
/* Sanity check */
HDassert(!H5F_addr_defined(new_chunk->offset) || H5F_addr_eq(new_chunk->offset, old_chunk->offset));
/* Check for chunk being same size */
if(new_chunk->length != old_chunk->length) {
/* Release previous chunk */
/* Only free the old location if not doing SWMR writes - otherwise
if(new_chunk->length != old_chunk->length) {
/* Release previous chunk */
/* Only free the old location if not doing SWMR writes - otherwise
* we must keep the old chunk around in case a reader has an
* outdated version of the B-tree node
*/
if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE))
if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, old_chunk->offset, old_chunk->length) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
alloc_chunk = TRUE;
} /* end if */
if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE))
if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, old_chunk->offset, old_chunk->length) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
alloc_chunk = TRUE;
} /* end if */
else {
/* Don't need to reallocate chunk, but send its address back up */
/* Don't need to reallocate chunk, but send its address back up */
if(!H5F_addr_defined(new_chunk->offset))
new_chunk->offset = old_chunk->offset;
} /* end else */
} /* end if */
} /* end else */
} /* end if */
else {
HDassert(!H5F_addr_defined(new_chunk->offset));
alloc_chunk = TRUE;
alloc_chunk = TRUE;
} /* end else */
} /* end if */
else {
@ -6646,7 +6645,7 @@ H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed for raw data chunk")
/* Read the non-filtered edge chunk */
if(H5F_block_read(new_idx_info->f, H5FD_MEM_DRAW, chunk_addr, read_size, buf) < 0)
if (H5F_block_read(new_idx_info->f, H5FD_MEM_DRAW, chunk_addr, read_size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk")
/* Pass the chunk through the pipeline */

@ -21,11 +21,11 @@
/***********/
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Dpkg.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
#include "H5private.h" /* Generic Functions */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Dpkg.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
/****************/
@ -60,17 +60,12 @@
/*-------------------------------------------------------------------------
* Function: H5Ddebug
* Function: H5Ddebug
*
* Purpose: Prints various information about a dataset. This function is
* not to be documented in the API at this time.
* Purpose: Prints various information about a dataset. This function is
* not to be documented in the API at this time.
*
* Return: Success: Non-negative
*
* Failure: Negative
*
* Programmer: Robb Matzke
* Wednesday, April 28, 1999
* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@ -85,13 +80,13 @@ H5Ddebug(hid_t dset_id)
/* Check args */
if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
/* Print B-tree information */
if(H5D_CHUNKED == dset->shared->layout.type)
(void)H5D__chunk_dump_index(dset, stdout);
(void)H5D__chunk_dump_index(dset, stdout);
else if(H5D_CONTIGUOUS == dset->shared->layout.type)
HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr);
HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr);
done:
FUNC_LEAVE_API(ret_value)

@ -80,28 +80,28 @@
#ifndef H5_NO_DEPRECATED_SYMBOLS
/*-------------------------------------------------------------------------
* Function: H5Dcreate1
* Function: H5Dcreate1
*
* Purpose: Creates a new dataset named NAME at LOC_ID, opens the
* dataset for access, and associates with that dataset constant
* and initial persistent properties including the type of each
* datapoint as stored in the file (TYPE_ID), the size of the
* dataset (SPACE_ID), and other initial miscellaneous
* properties (DCPL_ID).
* Purpose: Creates a new dataset named NAME at LOC_ID, opens the
* dataset for access, and associates with that dataset constant
* and initial persistent properties including the type of each
* datapoint as stored in the file (TYPE_ID), the size of the
* dataset (SPACE_ID), and other initial miscellaneous
* properties (DCPL_ID).
*
* All arguments are copied into the dataset, so the caller is
* allowed to derive new types, dataspaces, and creation
* parameters from the old ones and reuse them in calls to
* create other datasets.
* All arguments are copied into the dataset, so the caller is
* allowed to derive new types, data spaces, and creation
* parameters from the old ones and reuse them in calls to
* create other datasets.
*
* Return: Success: The object ID of the new dataset. At this
* point, the dataset is ready to receive its
* raw data. Attempting to read raw data from
* the dataset will probably return the fill
* value. The dataset should be closed when
* the caller is no longer interested in it.
* Return: Success: The object ID of the new dataset. At this
* point, the dataset is ready to receive its
* raw data. Attempting to read raw data from
* the dataset will probably return the fill
* value. The dataset should be closed when
* the caller is no longer interested in it.
*
* Failure: FAIL
* Failure: H5I_INVALID_HID
*
* Programmer: Robb Matzke
* Wednesday, December 3, 1997
@ -112,29 +112,31 @@ hid_t
H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
hid_t dcpl_id)
{
H5G_loc_t loc; /* Object location to insert dataset into */
H5D_t *dset = NULL; /* New dataset's info */
const H5S_t *space; /* Dataspace for dataset */
hid_t dapl_id = H5P_DEFAULT; /* DAPL used by library */
hid_t ret_value; /* Return value */
H5G_loc_t loc; /* Object location to insert dataset into */
H5D_t *dset = NULL; /* New dataset's info */
const H5S_t *space; /* Dataspace for dataset */
hid_t dapl_id = H5P_DEFAULT; /* DAPL used by library */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(FAIL)
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE5("i", "i*siii", loc_id, name, type_id, space_id, dcpl_id);
/* Check arguments */
if(!name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
if(!*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location ID")
if(H5I_DATATYPE != H5I_get_type(type_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype ID")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype ID")
if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id,H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace ID")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace ID")
if(H5P_DEFAULT == dcpl_id)
dcpl_id = H5P_DATASET_CREATE_DEFAULT;
else
if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0)
@ -142,32 +144,32 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
/* Build and open the new dataset */
if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, dcpl_id, dapl_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset")
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
/* Register the new dataset to get an ID for it */
/* Get an atom for the dataset */
if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset")
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
done:
if(ret_value < 0)
if (H5I_INVALID_HID == ret_value)
if(dset && H5D_close(dset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Dcreate1() */
/*-------------------------------------------------------------------------
* Function: H5Dopen1
* Function: H5Dopen1
*
* Purpose: Finds a dataset named NAME at LOC_ID, opens it, and returns
* its ID. The dataset should be close when the caller is no
* longer interested in it.
* Purpose: Finds a dataset named NAME at LOC_ID, opens it, and returns
* its ID. The dataset should be close when the caller is no
* longer interested in it.
*
* Note: Deprecated in favor of H5Dopen2
* Note: Deprecated in favor of H5Dopen2
*
* Return: Success: A new dataset ID
* Failure: FAIL
* Return: Success: A new dataset ID
* Failure: H5I_INVALID_HID
*
* Programmer: Robb Matzke
* Thursday, December 4, 1997
@ -179,44 +181,46 @@ H5Dopen1(hid_t loc_id, const char *name)
{
H5D_t *dset = NULL;
H5G_loc_t loc; /* Object location of group */
hid_t ret_value; /* Return value */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(FAIL)
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "i*s", loc_id, name);
/* Check args */
if (!name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
if (!*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
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")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
/* Open the dataset */
if(NULL == (dset = H5D__open_name(&loc, name, H5P_DATASET_ACCESS_DEFAULT)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset")
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset")
/* Register an atom for the dataset */
/* Get an atom for the dataset */
if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "can't register dataset atom")
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom")
done:
if(ret_value < 0)
if(H5I_INVALID_HID == ret_value)
if(dset && H5D_close(dset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Dopen1() */
/*-------------------------------------------------------------------------
* Function: H5Dextend
* Function: H5Dextend
*
* Purpose: This function makes sure that the dataset is at least of size
* SIZE. The dimensionality of SIZE is the same as the data
* space of the dataset being changed.
* Purpose: This function makes sure that the dataset is at least of size
* SIZE. The dimensionality of SIZE is the same as the data
* space of the dataset being changed.
*
* Note: Deprecated in favor of H5Dset_extent
* Note: Deprecated in favor of H5Dset_extent
*
* Return: Non-negative on success/Negative on failure
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* Friday, January 30, 1998
@ -226,19 +230,19 @@ done:
herr_t
H5Dextend(hid_t dset_id, const hsize_t size[])
{
H5D_t *dset; /* Pointer to dataset to modify */
hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
H5D_t *dset; /* Pointer to dataset to modify */
hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", dset_id, size);
/* Check args */
if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
if(!size)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified")
/* Make certain that the dataset dimensions don't decrease */
/* (Shrinking dimensions is possible with H5Dset_extent, but not H5Dextend) */
@ -254,7 +258,7 @@ H5Dextend(hid_t dset_id, const hsize_t size[])
/* Increase size */
if(H5D__set_extent(dset, dset_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset")
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset")
done:
FUNC_LEAVE_API(ret_value)

@ -174,7 +174,7 @@ done:
--------------------------------------------------------------------------*/
herr_t
H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
const H5T_t *buf_type, const H5S_t *space)
const H5T_t *buf_type, const H5S_t *space)
{
H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info */
hbool_t mem_iter_init = FALSE; /* Whether the memory selection iterator has been initialized */

@ -22,8 +22,8 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Dpkg.h" /* Datasets */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Dpkg.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5FOprivate.h" /* File objects */
@ -48,18 +48,17 @@
/* General stuff */
static H5D_shared_t *H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type);
static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id,
const H5T_t *type);
static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type);
static herr_t H5D__cache_dataspace_info(const H5D_t *dset);
static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space);
static herr_t H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id);
static herr_t H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id,
const char *prefix_type, char **file_prefix);
static herr_t H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type, char **file_prefix);
static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id);
static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite,
hsize_t old_dim[]);
static herr_t H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id);
static herr_t H5D__close_cb(H5D_t *dataset);
static herr_t H5D__close_cb(H5D_t *dset);
/*********************/
/* Package Variables */
@ -279,6 +278,37 @@ H5D_term_package(void)
FUNC_LEAVE_NOAPI(n)
} /* end H5D_term_package() */
/*-------------------------------------------------------------------------
* Function: H5D__close_cb
*
* Purpose: Called when the ref count reaches zero on the dataset's ID
*
* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__close_cb(H5D_t *dset)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
HDassert(dset);
HDassert(dset->oloc.file);
HDassert(dset->shared);
HDassert(dset->shared->fo_count > 0);
/* Close the dataset */
if(H5D_close(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close dataset");
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__close_cb() */
/*-------------------------------------------------------------------------
* Function: H5D__create_named
@ -505,7 +535,8 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy datatype")
/* Convert a datatype (if committed) to a transient type if the committed datatype's file
location is different from the file location where the dataset will be created */
* location is different from the file location where the dataset will be created.
*/
if(H5T_convert_committed_datatype(dset->shared->type, file) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get shared datatype info")
@ -520,7 +551,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
/* Get a datatype ID for the dataset's datatype */
if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type")
} /* end if */
}
/* Not a custom datatype, just use it directly */
else {
if(H5I_inc_ref(type_id, FALSE) < 0)
@ -529,7 +560,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
/* Use existing datatype */
dset->shared->type_id = type_id;
dset->shared->type = (H5T_t *)type; /* (Cast away const OK - QAK) */
} /* end else */
}
done:
FUNC_LEAVE_NOAPI(ret_value)
@ -569,7 +600,7 @@ H5D__cache_dataspace_info(const H5D_t *dset)
if( !(scaled_power2up = H5VM_power2up(dset->shared->curr_dims[u])) )
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2")
dset->shared->curr_power2up[u] = scaled_power2up;
} /* end for */
}
done:
FUNC_LEAVE_NOAPI(ret_value)
@ -685,7 +716,7 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert fill value to dataset type")
fill_prop->fill_defined = TRUE;
} /* end if */
}
else if(fill_status == H5D_FILL_VALUE_UNDEFINED)
fill_prop->fill_defined = FALSE;
else
@ -848,7 +879,7 @@ H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type
*/
if(HDstrcmp(prefix_type, H5D_ACS_VDS_PREFIX_NAME) == 0)
prefix = HDgetenv("HDF5_VDS_PREFIX");
else if (HDstrcmp(prefix_type, H5D_ACS_EFILE_PREFIX_NAME) == 0)
else if(HDstrcmp(prefix_type, H5D_ACS_EFILE_PREFIX_NAME) == 0)
prefix = HDgetenv("HDF5_EXTFILE_PREFIX");
else
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "prefix name is not sensible")
@ -1300,7 +1331,7 @@ done:
dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix);
dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix);
dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared);
} /* end if */
}
H5O_loc_free(&(dataset->oloc));
H5G_name_free(&(dataset->path));
@ -1559,36 +1590,6 @@ done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__open_oid() */
/*-------------------------------------------------------------------------
* Function: H5D__close_cb
*
* Purpose: Callback routine for closing a dataset ID. Closes the dataset
* object that was attached to the ID.
*
* Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__close_cb(H5D_t *dataset)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* check args */
HDassert(dataset && dataset->oloc.file && dataset->shared);
HDassert(dataset->shared->fo_count > 0);
/* Call actual dataset close routine */
if(H5D_close(dataset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close dataset");
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__close_cb() */
/*-------------------------------------------------------------------------
* Function: H5D_close
@ -1726,8 +1727,7 @@ H5D_close(H5D_t *dataset)
if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__UNCORK, NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTUNCORK, FAIL, "unable to uncork an object")
/*
* Release datatype, dataspace and creation property list -- there isn't
/* Release datatype, dataspace and creation property list -- there isn't
* much we can do if one of these fails, so we just continue.
*/
free_failed |= (H5I_dec_ref(dataset->shared->type_id) < 0) ||
@ -1761,6 +1761,7 @@ H5D_close(H5D_t *dataset)
*/
dataset->oloc.file = NULL;
dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared);
} /* end if */
else {
/* Decrement the ref. count for this object in the top file */
@ -1798,7 +1799,7 @@ done:
* Function: H5D_mult_refresh_close
*
* Purpose: Closing down the needed information when the dataset has
* multiple opens. (From H5O_refresh_metadata_close())
* multiple opens. (From H5O__refresh_metadata_close())
*
* Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
@ -2275,13 +2276,15 @@ done:
/*-------------------------------------------------------------------------
* Function: H5D__get_offset
* Function: H5D__get_offset
*
* Purpose: Private function for H5D__get_offset. Returns the address
* of dataset in file.
* Purpose: Private function for H5D__get_offset. Returns the address
* of dataset in file.
*
* Return: Success: The address of dataset
*
* Failure: HADDR_UNDEF (but also a valid value)
*
* Return: Success: the address of dataset
* Failure: HADDR_UNDEF
*-------------------------------------------------------------------------
*/
haddr_t
@ -2301,7 +2304,8 @@ H5D__get_offset(const H5D_t *dset)
case H5D_CONTIGUOUS:
/* If dataspace hasn't been allocated or dataset is stored in
* an external file, the value will be HADDR_UNDEF. */
* an external file, the value will be HADDR_UNDEF.
*/
if(dset->shared->dcpl_cache.efl.nused == 0 || H5F_addr_defined(dset->shared->layout.storage.u.contig.addr))
/* Return the absolute dataset offset from the beginning of file. */
ret_value = dset->shared->layout.storage.u.contig.addr + H5F_BASE_ADDR(dset->oloc.file);
@ -2311,7 +2315,7 @@ H5D__get_offset(const H5D_t *dset)
case H5D_NLAYOUTS:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "unknown dataset layout type")
} /*lint !e788 All appropriate cases are covered */
}
done:
FUNC_LEAVE_NOAPI(ret_value)
@ -2419,6 +2423,8 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id,
{
H5D_vlen_bufsize_t *vlen_bufsize = (H5D_vlen_bufsize_t *)op_data;
H5T_t *dt; /* Datatype for operation */
H5S_t *mspace; /* Memory dataspace for operation */
H5S_t *fspace; /* File dataspace for operation */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@ -2434,12 +2440,18 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id,
if(NULL == (vlen_bufsize->fl_tbuf = H5FL_BLK_REALLOC(vlen_fl_buf, vlen_bufsize->fl_tbuf, H5T_get_size(dt))))
HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't resize tbuf")
/* Get the memory dataspace from the ID */
if(NULL == (mspace = (H5S_t *)H5I_object_verify(vlen_bufsize->mspace_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
/* Select point to read in */
if(H5S_select_elements(vlen_bufsize->fspace, H5S_SELECT_SET, (size_t)1, point) < 0)
if(NULL == (fspace = (H5S_t *)H5I_object_verify(vlen_bufsize->fspace_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
if(H5S_select_elements(fspace, H5S_SELECT_SET, (size_t)1, point) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point")
/* Read in the point (with the custom VL memory allocator) */
if(H5D__read(vlen_bufsize->dset, type_id, vlen_bufsize->mspace, vlen_bufsize->fspace, vlen_bufsize->fl_tbuf) < 0)
if(H5D__read(vlen_bufsize->dset, type_id, mspace, fspace, vlen_bufsize->fl_tbuf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point")
done:
@ -2509,11 +2521,11 @@ done:
herr_t
H5D__set_extent(H5D_t *dset, const hsize_t *size)
{
hsize_t curr_dims[H5S_MAX_RANK]; /* Current dimension sizes */
htri_t changed; /* Whether the dataspace changed size */
size_t u, v; /* Local index variable */
hsize_t curr_dims[H5S_MAX_RANK]; /* Current dimension sizes */
htri_t changed; /* Whether the dataspace changed size */
size_t u, v; /* Local index variable */
unsigned dim_idx; /* Dimension index */
herr_t ret_value = SUCCEED; /* Return value */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
@ -2649,7 +2661,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size)
if(H5D__alloc_storage(&io_info, H5D_ALLOC_EXTEND, FALSE, curr_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset storage")
} /* end if */
}
/*-------------------------------------------------------------------------
* Remove chunk information in the case of chunked datasets
* This removal takes place only in case we are shrinking the dateset
@ -3255,7 +3267,7 @@ H5D_get_access_plist(const H5D_t *dset)
if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATASET_ACCESS_ID_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
if((new_dapl_id = H5P_copy_plist(old_plist, TRUE)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy dataset access property list")
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy dataset access property list")
if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_dapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")

@ -21,14 +21,14 @@
/***********/
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Dpkg.h" /* Dataset functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Sprivate.h" /* Dataspace */
#include "H5private.h" /* Generic Functions */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Dpkg.h" /* Dataset functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Sprivate.h" /* Dataspace */
#ifdef H5_HAVE_PARALLEL
/* Remove this if H5R_DATASET_REGION is no longer used in this file */
@ -50,8 +50,7 @@
/* Local Prototypes */
/********************/
static herr_t H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset,
hsize_t *offset_copy/*out*/);
/* Setup/teardown routines */
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,
@ -83,14 +82,17 @@ 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.
* Purpose: Copies an offset buffer and performs bounds checks on the
* values.
*
* This helper function ensures that the offset buffer given
* by the user is suitable for use with the rest of the library.
*
* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
static herr_t
herr_t
H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy)
{
unsigned u;
@ -102,7 +104,6 @@ H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_c
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).
@ -127,14 +128,13 @@ done:
} /* end H5D__get_offset_copy() */
/*-------------------------------------------------------------------------
* Function: H5Dread
* 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
* 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.
@ -152,7 +152,7 @@ done:
* 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: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Thursday, December 4, 1997
@ -194,7 +194,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
/* Read raw data */
/* Read the 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")
@ -219,9 +219,9 @@ 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;
H5D_t *dset = NULL;
hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
herr_t ret_value = SUCCEED; /* Return value */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "ii*h*Iu*x", dset_id, dxpl_id, offset, filters, buf);
@ -289,7 +289,7 @@ done:
* 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: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Thursday, December 4, 1997
@ -303,13 +303,13 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
H5D_t *dset = NULL;
const H5S_t *mem_space = NULL;
const H5S_t *file_space = NULL;
herr_t ret_value = SUCCEED; /* Return value */
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);
/* Get dataset pointer and ensure it's associated with a file */
/* 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)
@ -356,10 +356,10 @@ 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)
{
H5D_t *dset = NULL;
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 */
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);
@ -981,8 +981,7 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write,
type_info->dst_type_id = mem_type_id;
} /* end else */
/*
* Locate the type conversion function and dataspace conversion
/* Locate the type conversion function and dataspace conversion
* functions, and set up the element numbering information. If a data
* type conversion is necessary then register datatype atoms. Data type
* conversion is necessary if the user has set the `need_bkg' to a high
@ -1249,7 +1248,7 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__ioinfo_adjust() */
#endif /*H5_HAVE_PARALLEL*/
#endif /* H5_HAVE_PARALLEL */
/*-------------------------------------------------------------------------

@ -25,7 +25,6 @@
#include "H5Dpkg.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5HLprivate.h" /* Local heaps */
#include "H5MMprivate.h" /* Memory management */
/****************/
@ -506,7 +505,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
if(H5D__alloc_storage(&io_info, H5D_ALLOC_CREATE, FALSE, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
} /* end if */
}
/* Update external storage message, if it's used */
if(dset->shared->dcpl_cache.efl.nused > 0) {
@ -557,6 +556,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update external file list message")
} /* end if */
/* Create layout message */
/* (Don't make layout message constant unless allocation time is early and non-filtered, since space may not be allocated) */
/* (Note: this is relying on H5D__alloc_storage not calling H5O_msg_write during dataset creation) */
if(fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY && H5D_COMPACT != layout->type

@ -479,8 +479,7 @@ H5D__mpio_array_gatherv(void *local_array, size_t local_array_num_entries,
MPI_Comm_size(comm, &mpi_size);
MPI_Comm_rank(comm, &mpi_rank);
/*
* Determine the size of the end result array by collecting the number
/* Determine the size of the end result array by collecting the number
* of entries contributed by each processor into a single total.
*/
if (MPI_SUCCESS != (mpi_code = MPI_Allreduce(&local_array_num_entries, &gathered_array_num_entries, 1, MPI_INT, MPI_SUM, comm)))

@ -189,15 +189,15 @@ H5O__dset_isa(const H5O_t *oh)
/* Datatype */
if((exists = H5O_msg_exists_oh(oh, H5O_DTYPE_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header")
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header")
else if(!exists)
HGOTO_DONE(FALSE)
HGOTO_DONE(FALSE)
/* Layout */
if((exists = H5O_msg_exists_oh(oh, H5O_SDSPACE_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header")
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header")
else if(!exists)
HGOTO_DONE(FALSE)
HGOTO_DONE(FALSE)
done:
FUNC_LEAVE_NOAPI(ret_value)
@ -260,7 +260,7 @@ H5O__dset_open(const H5G_loc_t *obj_loc, hbool_t app_ref)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
done:
if(ret_value < 0)
if(H5I_INVALID_HID == ret_value)
if(dset && H5D_close(dset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")

@ -510,12 +510,12 @@ typedef struct H5D_fill_buf_info_t {
/* Internal data structure for computing variable-length dataset's total size */
typedef struct {
H5D_t *dset; /* Dataset for operation */
H5S_t *fspace; /* Dataset's dataspace for operation */
H5S_t *mspace; /* Memory dataspace for operation */
void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */
void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */
hsize_t size; /* Accumulated number of bytes for the selection */
H5D_t *dset; /* Dataset for operation */
hid_t fspace_id; /* File dataspace ID of the dataset we are working on */
hid_t mspace_id; /* Memory dataspace ID of the dataset we are working on */
void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */
void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */
hsize_t size; /* Accumulated number of bytes for the selection */
} H5D_vlen_bufsize_t;
@ -559,15 +559,12 @@ H5_DLL H5D_t *H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_
H5_DLL hid_t H5D__get_space(const H5D_t *dset);
H5_DLL hid_t H5D__get_type(const H5D_t *dset);
H5_DLL herr_t H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation);
H5_DLL herr_t H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc,
hbool_t full_overwrite, hsize_t old_dim[]);
H5_DLL herr_t H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hbool_t full_overwrite, hsize_t old_dim[]);
H5_DLL herr_t H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size);
H5_DLL herr_t H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset,
hsize_t *storage_size);
H5_DLL herr_t H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage_size);
H5_DLL haddr_t H5D__get_offset(const H5D_t *dset);
H5_DLL void *H5D__vlen_get_buf_size_alloc(size_t size, void *info);
H5_DLL herr_t H5D__vlen_get_buf_size(void *elem, hid_t type_id, unsigned ndim,
const hsize_t *point, void *op_data);
H5_DLL herr_t H5D__vlen_get_buf_size(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *op_data);
H5_DLL herr_t H5D__check_filters(H5D_t *dataset);
H5_DLL herr_t H5D__set_extent(H5D_t *dataset, const hsize_t *size);
H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset);
@ -660,6 +657,7 @@ H5_DLL herr_t H5D__chunk_bh_info(const H5O_loc_t *loc, H5O_t *oh,
H5O_layout_t *layout, hsize_t *btree_size);
H5_DLL herr_t H5D__chunk_dump_index(H5D_t *dset, FILE *stream);
H5_DLL herr_t H5D__chunk_delete(H5F_t *f, H5O_t *oh, H5O_storage_t *store);
H5_DLL herr_t H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy);
H5_DLL herr_t H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters,
hsize_t *offset, uint32_t data_size, const void *buf);
H5_DLL herr_t H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset,

@ -559,11 +559,9 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
if(H5Z_xform_eval(data_transform, type_info->tconv_buf, smine_nelmts, type_info->mem_type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform")
} /* end if */
}
/*
* Scatter the data into memory.
*/
/* Scatter the data into memory */
if(H5D__scatter_mem(type_info->tconv_buf, mem_space, mem_iter, smine_nelmts, buf/*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
} /* end else */
@ -691,9 +689,9 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
if(H5CX_get_data_transform(&data_transform) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data transform info")
if(H5Z_xform_eval(data_transform, type_info->tconv_buf, smine_nelmts, type_info->mem_type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform")
} /* end if */
if(H5Z_xform_eval(data_transform, type_info->tconv_buf, smine_nelmts, type_info->mem_type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform")
}
/*
* Perform datatype conversion.

@ -244,10 +244,10 @@ H5D__single_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata
} /* end if */
if(dset)
if(dset->shared->dcpl_cache.fill.alloc_time != H5D_ALLOC_TIME_EARLY || idx_info->pline->nused > 0)
/* Mark the layout dirty so that the address of the single chunk will be flushed later */
if(H5D__mark(dset, H5D_MARK_LAYOUT) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark layout as dirty")
if(dset->shared->dcpl_cache.fill.alloc_time != H5D_ALLOC_TIME_EARLY || idx_info->pline->nused > 0)
/* Mark the layout dirty so that the address of the single chunk will be flushed later */
if(H5D__mark(dset, H5D_MARK_LAYOUT) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark layout as dirty")
done:
FUNC_LEAVE_NOAPI(ret_value)

@ -2961,7 +2961,7 @@ done:
static herr_t
H5D__virtual_refresh_source_dset(H5D_t **dset)
{
hid_t dset_id; /* Temporary dataset identifier */
hid_t temp_id; /* Temporary dataset identifier */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@ -2970,15 +2970,15 @@ H5D__virtual_refresh_source_dset(H5D_t **dset)
HDassert(dset && *dset);
/* Get a temporary identifier for this source dataset */
if((dset_id = H5I_register(H5I_DATASET, *dset, FALSE)) < 0)
if((temp_id = H5I_register(H5I_DATASET, *dset, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register source dataset ID")
/* Refresh source dataset */
if(H5D__refresh(dset_id, *dset) < 0)
if(H5D__refresh(temp_id, *dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh source dataset")
/* Discard the identifier & replace the dataset */
if(NULL == (*dset = (H5D_t *)H5I_remove(dset_id)))
if(NULL == (*dset = (H5D_t *)H5I_remove(temp_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't unregister source dataset ID")
done:

770
src/H5F.c

File diff suppressed because it is too large Load Diff

@ -35,12 +35,12 @@
/***********/
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
#include "H5Iprivate.h" /* IDs */
#include "H5SMprivate.h" /* Shared object header messages */
#include "H5private.h" /* Generic Functions */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
#include "H5Iprivate.h" /* IDs */
#include "H5SMprivate.h" /* Shared object header messages */
/****************/
@ -84,16 +84,12 @@
* Function: H5Fget_info1
*
* Purpose: Gets general information about the file, including:
* 1. Get storage size for superblock extension if there is one.
* 1. Get storage size for superblock extension if there is one.
* 2. Get the amount of btree and heap storage for entries
* in the SOHM table if there is one.
* 3. The amount of free space tracked in the file.
* 3. The amount of free space tracked in the file.
*
* Return: Success: non-negative on success
* Failure: Negative
*
* Programmer: Vailin Choi
* July 11, 2007
* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@ -111,14 +107,15 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo)
if(!finfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
/* For file IDs, get the file object directly */
/* (This prevents the H5G_loc() call from returning the file pointer for
/* For file IDs, get the file object directly
*
* (This prevents the H5G_loc() call from returning the file pointer for
* the top file in a mount hierarchy)
*/
if(H5I_get_type(obj_id) == H5I_FILE ) {
if(NULL == (f = (H5F_t *)H5I_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
} /* end if */
}
else {
H5G_loc_t loc; /* Object location */
@ -126,7 +123,7 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo)
if(H5G_loc(obj_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID")
f = loc.oloc->file;
} /* end else */
}
HDassert(f->shared);
/* Get the current file info */
@ -193,7 +190,8 @@ H5Fset_latest_format(hid_t file_id, hbool_t latest_format)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID")
/* 'low' and 'high' are both initialized to LATEST.
If latest format is not expected, set 'low' to EARLIEST */
* If latest format is not expected, set 'low' to EARLIEST
*/
if(!latest_format)
low = H5F_LIBVER_EARLIEST;

File diff suppressed because it is too large Load Diff

@ -92,8 +92,7 @@
*-------------------------------------------------------------------------
*/
herr_t
H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size,
void *buf/*out*/)
H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/)
{
H5FD_mem_t map_type; /* Mapped memory type */
herr_t ret_value = SUCCEED; /* Return value */
@ -138,8 +137,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size,
const void *buf)
H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf)
{
H5FD_mem_t map_type; /* Mapped memory type */
herr_t ret_value = SUCCEED; /* Return value */

@ -132,7 +132,7 @@ H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED
*/
if(child->parent)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "file is already mounted")
if(H5G_loc_find(loc, name, &mp_loc/*out*/) < 0)
if(H5G_loc_find(loc, name, &mp_loc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found")
/* If the mount location is holding its file open, that file will close
* and remove the mount as soon as we exit this function. Prevent the
@ -462,7 +462,7 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id)
plist_id = H5P_FILE_MOUNT_DEFAULT;
else
if(TRUE != H5P_isa_class(plist_id, H5P_FILE_MOUNT))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "plist_id is not a property list ID")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "plist_id is not a file mount property list ID")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)

@ -320,11 +320,11 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm)
attached to the loc_id */
if(H5I_INVALID_HID != loc_id) {
H5G_loc_t loc;
H5F_t *f;
H5F_t *f = NULL;
/* Retrieve the file structure */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a location")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
f = loc.oloc->file;
HDassert(f);
@ -333,8 +333,8 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm)
/* retrieve the file communicator */
if(MPI_COMM_NULL == (*mpi_comm = H5F_mpi_get_comm(f)))
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator")
} /* end if */
} /* end if */
}
}
/* otherwise, this is from H5Fopen or H5Fcreate and has to be collective */
else {
H5P_genplist_t *plist; /* Property list pointer */
@ -349,8 +349,8 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad VFL driver info")
*mpi_comm = fa->comm;
} /* end if */
} /* end else */
}
}
done:
FUNC_LEAVE_NOAPI(ret_value)

@ -325,7 +325,7 @@ struct H5F_file_t {
/* been used accessed for either */
/* allocation or deallocation */
/* since file open. */
haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */
haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */
/* for self referential FSMs */
haddr_t eoa_post_fsm_fsalloc; /* eoa post file space allocation */
/* for self referential FSMs */
@ -377,6 +377,19 @@ struct H5F_t {
#endif /* H5_HAVE_PARALLEL */
};
/* User data for traversal routine to get ID counts */
typedef struct {
ssize_t *obj_count; /* number of objects counted so far */
unsigned types; /* types of objects to be counted */
} H5F_trav_obj_cnt_t;
/* User data for traversal routine to get ID lists */
typedef struct {
size_t max_objs;
hid_t *oid_list;
ssize_t *obj_count; /* number of objects counted so far */
unsigned types; /* types of objects to be counted */
} H5F_trav_obj_ids_t;
/*****************************/
/* Package Private Variables */
@ -394,18 +407,16 @@ H5FL_EXTERN(H5F_file_t);
/******************************/
/* General routines */
H5_DLL H5F_t *H5F__reopen(H5F_t *f);
H5_DLL H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf);
H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush);
H5_DLL herr_t H5F__flush(H5F_t *f);
H5_DLL htri_t H5F__is_hdf5(const char *name);
H5_DLL herr_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr);
H5_DLL ssize_t H5F__get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len);
H5_DLL herr_t H5F__get_info(H5F_t *f, H5F_info2_t *finfo);
H5_DLL herr_t H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info);
H5_DLL herr_t H5F__format_convert(H5F_t *f);
H5_DLL herr_t H5F__start_swmr_write(H5F_t *f);
H5_DLL herr_t H5F__close(hid_t file_id);
H5_DLL herr_t H5F__close_cb(H5F_t *f);
H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high);
/* File mount related routines */
@ -421,7 +432,7 @@ H5_DLL herr_t H5F__super_size(H5F_t *f, hsize_t *super_size, hsize_t *super_ext_
H5_DLL herr_t H5F__super_free(H5F_super_t *sblock);
/* Superblock extension related routines */
H5_DLL herr_t H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr);
H5_DLL herr_t H5F__super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr);
H5_DLL herr_t H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, hbool_t may_create, unsigned mesg_flags);
H5_DLL herr_t H5F__super_ext_remove_msg(H5F_t *f, unsigned id);
H5_DLL herr_t H5F__super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hbool_t was_created);
@ -434,9 +445,9 @@ H5_DLL herr_t H5F__accum_flush(H5F_t *f);
H5_DLL herr_t H5F__accum_reset(H5F_t *f, hbool_t flush);
/* Shared file list related routines */
H5_DLL herr_t H5F_sfile_add(H5F_file_t *shared);
H5_DLL H5F_file_t * H5F_sfile_search(H5FD_t *lf);
H5_DLL herr_t H5F_sfile_remove(H5F_file_t *shared);
H5_DLL herr_t H5F__sfile_add(H5F_file_t *shared);
H5_DLL H5F_file_t *H5F__sfile_search(H5FD_t *lf);
H5_DLL herr_t H5F__sfile_remove(H5F_file_t *shared);
/* External file cache routines */
H5_DLL H5F_efc_t *H5F__efc_create(unsigned max_nfiles);

@ -715,7 +715,6 @@ typedef enum H5F_prefix_open_t {
/* Private functions */
H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/);
H5_DLL herr_t H5F_start_swmr_write(H5F_t *file);
/* Functions that retrieve values from the file struct */
H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f);
@ -763,7 +762,6 @@ H5_DLL size_t H5F_rdcc_nslots(const H5F_t *f);
H5_DLL double H5F_rdcc_w0(const H5F_t *f);
H5_DLL size_t H5F_sieve_buf_size(const H5F_t *f);
H5_DLL unsigned H5F_gc_ref(const H5F_t *f);
H5_DLL unsigned H5F_use_latest_flags(const H5F_t *f, unsigned fl);
H5_DLL hbool_t H5F_store_msg_crt_idx(const H5F_t *f);
H5_DLL herr_t H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag);
H5_DLL struct H5UC_t *H5F_grp_btree_shared(const H5F_t *f);
@ -799,7 +797,7 @@ H5_DLL herr_t H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t si
/* Functions that flush or evict */
H5_DLL herr_t H5F_flush_tagged_metadata(H5F_t *f, haddr_t tag);
H5_DLL herr_t H5F_evict_tagged_metadata(H5F_t * f, haddr_t tag);
H5_DLL herr_t H5F_evict_tagged_metadata(H5F_t *f, haddr_t tag);
/* Functions that verify a piece of metadata with checksum */
H5_DLL herr_t H5F_get_checksums(const uint8_t *buf, size_t chk_size, uint32_t *s_chksum, uint32_t *c_chksum);
@ -807,6 +805,7 @@ H5_DLL herr_t H5F_get_checksums(const uint8_t *buf, size_t chk_size, uint32_t *s
/* Routine to track the # of retries */
H5_DLL herr_t H5F_track_metadata_read_retries(H5F_t *f, unsigned actype, unsigned retries);
H5_DLL herr_t H5F_set_retries(H5F_t *f);
H5_DLL herr_t H5F_get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info);
/* Routine to invoke callback function upon object flush */
H5_DLL herr_t H5F_object_flush_cb(H5F_t *f, hid_t obj_id);

@ -40,11 +40,11 @@ H5F_sfile_node_t *H5F_sfile_head_g = NULL;
/*-------------------------------------------------------------------------
* Function: H5F_sfile_assert_num
* Function: H5F_sfile_assert_num
*
* Purpose: Sanity checking that shared file list is empty
* Purpose: Sanity checking that shared file list is empty
*
* Return: none (void)
* Return: void
*
* Programmer: Quincey Koziol
* Monday, July 25, 2005
@ -84,33 +84,31 @@ H5F_sfile_assert_num(unsigned n)
/*-------------------------------------------------------------------------
* Function: H5F_sfile_add
* Function: H5F__sfile_add
*
* Purpose: Add a "shared" file struct to the list of open files
* Purpose: Add a "shared" file struct to the list of open files
*
* Return: SUCCEED/FAIL
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, July 18, 2005
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
herr_t
H5F_sfile_add(H5F_file_t *shared)
H5F__sfile_add(H5F_file_t *shared)
{
H5F_sfile_node_t *new_shared; /* New shared file node */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(shared);
/* Allocate new shared file node */
if (NULL == (new_shared = H5FL_CALLOC(H5F_sfile_node_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Set shared file value */
new_shared->shared = shared;
@ -121,31 +119,29 @@ H5F_sfile_add(H5F_file_t *shared)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_sfile_add() */
} /* end H5F__sfile_add() */
/*-------------------------------------------------------------------------
* Function: H5F_sfile_search
* Function: H5F__sfile_search
*
* Purpose: Search for a "shared" file with low-level file info that
* Purpose: Search for a "shared" file with low-level file info that
* matches
*
* Return: Non-NULL on success / NULL on failure
* Return: Non-NULL on success / NULL on failure
*
* Programmer: Quincey Koziol
* Monday, July 18, 2005
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
H5F_file_t *
H5F_sfile_search(H5FD_t *lf)
H5F__sfile_search(H5FD_t *lf)
{
H5F_sfile_node_t *curr; /* Current shared file node */
H5F_file_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(lf);
@ -154,7 +150,7 @@ H5F_sfile_search(H5FD_t *lf)
curr = H5F_sfile_head_g;
while(curr) {
/* Check for match */
if(0==H5FD_cmp(curr->shared->lf, lf))
if(0 == H5FD_cmp(curr->shared->lf, lf))
HGOTO_DONE(curr->shared)
/* Advance to next shared file node */
@ -163,31 +159,29 @@ H5F_sfile_search(H5FD_t *lf)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_sfile_search() */
} /* end H5F__sfile_search() */
/*-------------------------------------------------------------------------
* Function: H5F_sfile_remove
* Function: H5F__sfile_remove
*
* Purpose: Remove a "shared" file struct from the list of open files
* Purpose: Remove a "shared" file struct from the list of open files
*
* Return: SUCCEED/FAIL
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, July 18, 2005
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
herr_t
H5F_sfile_remove(H5F_file_t *shared)
H5F__sfile_remove(H5F_file_t *shared)
{
H5F_sfile_node_t *curr; /* Current shared file node */
H5F_sfile_node_t *last; /* Last shared file node */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(shared);
@ -203,7 +197,7 @@ H5F_sfile_remove(H5F_file_t *shared)
/* Indicate error if the node wasn't found */
if(curr == NULL)
HGOTO_ERROR(H5E_FILE, H5E_NOTFOUND, FAIL, "can't find shared file info")
HGOTO_ERROR(H5E_FILE, H5E_NOTFOUND, FAIL, "can't find shared file info")
/* Remove node found from list */
if(last != NULL)
@ -219,5 +213,5 @@ H5F_sfile_remove(H5F_file_t *shared)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_sfile_remove() */
} /* end H5F__sfile_remove() */

@ -134,7 +134,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5F_super_ext_open
* Function: H5F__super_ext_open
*
* Purpose: Open an existing superblock extension
*
@ -146,11 +146,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr)
H5F__super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(f);
@ -168,7 +168,7 @@ H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5F_super_ext_open() */
} /* H5F__super_ext_open() */
/*-------------------------------------------------------------------------
@ -398,7 +398,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result)
} /* end if */
else {
/* Locate the signature as per per the serial library */
/* Locate the signature as per per the serial library */
#endif /* H5_HAVE_PARALLEL */
if(H5FD_locate_signature(file, &super_addr) < 0)
@ -705,7 +705,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
} /* end if */
/* Open the superblock extension */
if(H5F_super_ext_open(f, sblock->ext_addr, &ext_loc) < 0)
if(H5F__super_ext_open(f, sblock->ext_addr, &ext_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension")
/* Check for the extension having a 'driver info' message */
@ -836,7 +836,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
if(!skip_eof_check && !null_fsm_addr) {
HDassert((!f->shared->fs_persist) || (f->shared->eoa_pre_fsm_fsalloc != HADDR_UNDEF));
HDassert(!f->shared->first_alloc_dealloc);
} /* end if */
}
/* As "eoa_pre_fsm_fsalloc" may be undefined for a crashed file
* with persistent free space managers, therefore, set
@ -882,14 +882,14 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
if(null_fsm_addr) {
if(H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, FALSE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0)
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing fsinfo message to superblock extension")
} /* end if */
}
else {
if(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTDELETE, FAIL, "error in removing message from superblock extension")
if(H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, TRUE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0)
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing fsinfo message to superblock extension")
} /* end else */
}
#if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */
f->shared->sblock = NULL;
#endif /* JRM */
@ -962,20 +962,20 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
/* Write driver info information to the superblock extension */
#if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */
/* KLUGE ALERT!!
*
* H5F__super_ext_write_msg() expects f->shared->sblock to
* be set -- verify that it is NULL, and then set it.
* Set it back to NULL when we are done.
*/
HDassert(f->shared->sblock == NULL);
f->shared->sblock = sblock;
/* KLUGE ALERT!!
*
* H5F__super_ext_write_msg() expects f->shared->sblock to
* be set -- verify that it is NULL, and then set it.
* Set it back to NULL when we are done.
*/
HDassert(f->shared->sblock == NULL);
f->shared->sblock = sblock;
#endif /* JRM */
if(H5F__super_ext_write_msg(f, H5O_DRVINFO_ID, &drvinfo, FALSE, H5O_MSG_NO_FLAGS_SET) < 0)
if(H5F__super_ext_write_msg(f, H5O_DRVINFO_ID, &drvinfo, FALSE, H5O_MSG_NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension")
#if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */
f->shared->sblock = NULL;
f->shared->sblock = NULL;
#endif /* JRM */
} /* end if */
@ -1320,10 +1320,11 @@ H5F__super_init(H5F_t *f)
/* Create the Shared Object Header Message table and register it with
* the metadata cache, if this file supports shared messages.
*/
if(f->shared->sohm_nindexes > 0)
if(f->shared->sohm_nindexes > 0) {
/* Initialize the shared message code & write the SOHM message to the extension */
if(H5SM_init(f, plist, &ext_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create SOHM table")
}
/* Check for non-default v1 B-tree 'K' values to store */
if(sblock->btree_k[H5B_SNODE_ID] != HDF5_BTREE_SNODE_IK_DEF ||
@ -1503,9 +1504,10 @@ H5F_eoa_dirty(H5F_t *f)
HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark drvinfo as dirty")
} /* end if */
/* If the driver info is stored as a message, update that instead */
else if(f->shared->drvinfo_sb_msg_exists)
else if(f->shared->drvinfo_sb_msg_exists) {
if(H5F__update_super_ext_driver_msg(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark drvinfo message as dirty")
}
done:
FUNC_LEAVE_NOAPI(ret_value)
@ -1676,13 +1678,13 @@ H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg,
/* Open/create the superblock extension object header */
if(H5F_addr_defined(f->shared->sblock->ext_addr)) {
if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0)
if(H5F__super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension")
} /* end if */
else {
HDassert(may_create);
if(H5F__super_ext_create(f, &ext_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create file's superblock extension")
if(H5F__super_ext_create(f, &ext_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create file's superblock extension")
ext_created = TRUE;
} /* end else */
HDassert(H5F_addr_defined(ext_loc.addr));
@ -1690,24 +1692,24 @@ H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg,
/* Check if message with ID does not exist in the object header */
if((status = H5O_msg_exists(&ext_loc, id)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check object header for message or message exists")
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check object header for message or message exists")
/* Check for creating vs. writing */
if(may_create) {
if(status)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should not exist")
/* Create the message with ID in the superblock extension */
if(H5O_msg_create(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to create the message in object header")
/* Create the message with ID in the superblock extension */
if(H5O_msg_create(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to create the message in object header")
} /* end if */
else {
if(!status)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should exist")
/* Update the message with ID in the superblock extension */
if(H5O_msg_write(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to write the message in object header")
/* Update the message with ID in the superblock extension */
if(H5O_msg_write(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to write the message in object header")
} /* end else */
done:
@ -1757,35 +1759,36 @@ H5F__super_ext_remove_msg(H5F_t *f, unsigned id)
H5AC_set_ring(H5AC_RING_SBE, &orig_ring);
/* Open superblock extension object header */
if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in starting file's superblock extension")
if(H5F__super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in starting file's superblock extension")
ext_opened = TRUE;
/* Check if message with ID exists in the object header */
if((status = H5O_msg_exists(&ext_loc, id)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check object header for message")
else if(status) { /* message exists */
H5O_hdr_info_t hdr_info; /* Object header info for superblock extension */
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check object header for message")
else if(status) {
/* message exists */
H5O_hdr_info_t hdr_info; /* Object header info for superblock extension */
/* Remove the message */
if(H5O_msg_remove(&ext_loc, id, H5O_ALL, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete free-space manager info message")
/* Remove the message */
if(H5O_msg_remove(&ext_loc, id, H5O_ALL, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete free-space manager info message")
/* Get info for the superblock extension's object header */
if(H5O_get_hdr_info(&ext_loc, &hdr_info) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info")
/* Get info for the superblock extension's object header */
if(H5O_get_hdr_info(&ext_loc, &hdr_info) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info")
/* If the object header is an empty base chunk, remove superblock extension */
if(hdr_info.nchunks == 1) {
if((null_count = H5O_msg_count(&ext_loc, H5O_NULL_ID)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages")
else if((unsigned)null_count == hdr_info.nmesgs) {
HDassert(H5F_addr_defined(ext_loc.addr));
if(H5O_delete(f, ext_loc.addr) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages")
f->shared->sblock->ext_addr = HADDR_UNDEF;
} /* end if */
} /* end if */
/* If the object header is an empty base chunk, remove superblock extension */
if(hdr_info.nchunks == 1) {
if((null_count = H5O_msg_count(&ext_loc, H5O_NULL_ID)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages")
else if((unsigned)null_count == hdr_info.nmesgs) {
HDassert(H5F_addr_defined(ext_loc.addr));
if(H5O_delete(f, ext_loc.addr) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages")
f->shared->sblock->ext_addr = HADDR_UNDEF;
} /* end else-if */
} /* end if */
} /* end if */
done:

@ -42,7 +42,6 @@
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
#include "H5SMprivate.h" /* Shared Object Header Messages */
/****************/

238
src/H5G.c

@ -128,10 +128,10 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* Group ID class */
static const H5I_class_t H5I_GROUP_CLS[1] = {{
H5I_GROUP, /* ID class value */
0, /* Class flags */
0, /* # of reserved IDs for class */
(H5I_free_t)H5G__close_cb /* Callback routine for closing objects of this class */
H5I_GROUP, /* ID class value */
0, /* Class flags */
0, /* # of reserved IDs for class */
(H5I_free_t)H5G_close /* Callback routine for closing objects of this class */
}};
/* Flag indicating "top" of interface has been initialized */
@ -255,9 +255,9 @@ H5G_term_package(void)
/*-------------------------------------------------------------------------
* Function: H5Gcreate2
* Function: H5Gcreate2
*
* Purpose: Creates a new group relative to LOC_ID, giving it the
* Purpose: Creates a new group relative to LOC_ID, giving it the
* specified creation property list GCPL_ID and access
* property list GAPL_ID. The link to the new group is
* created with the LCPL_ID.
@ -269,14 +269,11 @@ H5G_term_package(void)
* hid_t gcpl_id; IN: Property list for group creation
* hid_t gapl_id; IN: Property list for group access
*
* Return: Success: The object ID of a new, empty group open for
* writing. Call H5Gclose() when finished with
* the group.
* Return: Success: The object ID of a new, empty group open for
* writing. Call H5Gclose() when finished with
* the group.
*
* Failure: H5I_INVALID_HID
*
* Programmer: Quincey Koziol
* April 5, 2007
* Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
@ -284,45 +281,49 @@ hid_t
H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id,
hid_t gapl_id)
{
H5G_loc_t loc; /* Location to create group */
H5G_t *grp = NULL; /* New group created */
hid_t ret_value; /* Return value */
H5G_t *grp = NULL; /* Structure for new group */
H5G_loc_t loc; /* Location to create group */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE5("i", "i*siii", loc_id, name, lcpl_id, gcpl_id, gapl_id);
/* Check arguments */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
if(!name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
if(!*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
/* Get correct property list */
/* Check link creation property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
else
if(TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link creation property list")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a link creation property list")
/* Check group creation property list */
if(H5P_DEFAULT == gcpl_id)
gcpl_id = H5P_GROUP_CREATE_DEFAULT;
else
if(TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not group create property list")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group creation property list")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
/* Create the new group & get its ID */
/* Create the group */
if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
/* Get an atom for the group */
if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle")
done:
if(ret_value < 0)
if(H5I_INVALID_HID == ret_value)
if(grp && H5G_close(grp) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
@ -331,9 +332,9 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Gcreate_anon
* Function: H5Gcreate_anon
*
* Purpose: Creates a new group relative to LOC_ID, giving it the
* Purpose: Creates a new group relative to LOC_ID, giving it the
* specified creation property list GCPL_ID and access
* property list GAPL_ID.
*
@ -349,36 +350,33 @@ done:
* hid_t gcpl_id; IN: Property list for group creation
* hid_t gapl_id; IN: Property list for group access
*
* Example: To create missing groups "A" and "B01" along the given path "/A/B01/grp"
* Example: To create missing groups "A" and "B01" along the given path "/A/B01/grp"
* hid_t create_id = H5Pcreate(H5P_GROUP_CREATE);
* int status = H5Pset_create_intermediate_group(create_id, TRUE);
* hid_t gid = H5Gcreate_anon(file_id, "/A/B01/grp", create_id, H5P_DEFAULT);
*
* Return: Success: The object ID of a new, empty group open for
* writing. Call H5Gclose() when finished with
* the group.
* Return: Success: The object ID of a new, empty group open for
* writing. Call H5Gclose() when finished with
* the group.
*
* Failure: H5I_INVALID_HID
*
* Programmer: Peter Cao
* May 08, 2005
* Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
{
H5G_loc_t loc;
H5G_t *grp = NULL;
H5G_obj_create_t gcrt_info; /* Information for group creation */
hid_t ret_value;
H5G_t *grp = NULL; /* Structure for new group */
H5G_loc_t loc;
H5G_obj_create_t gcrt_info; /* Information for group creation */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "iii", loc_id, gcpl_id, gapl_id);
/* Check arguments */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
/* Check group creation property list */
if(H5P_DEFAULT == gcpl_id)
@ -396,9 +394,11 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
gcrt_info.cache_type = H5G_NOTHING_CACHED;
HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache));
/* Create the new group & get its ID */
/* Create the group */
if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info)))
HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create group")
/* Get an atom for the group */
if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
@ -417,7 +417,7 @@ done:
} /* end if */
/* Cleanup on failure */
if(ret_value < 0)
if(H5I_INVALID_HID == ret_value)
if(grp && H5G_close(grp) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
@ -426,28 +426,26 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Gopen2
* Function: H5Gopen2
*
* Purpose: Opens an existing group for modification. When finished,
* call H5Gclose() to close it and release resources.
* Purpose: Opens an existing group for modification. When finished,
* call H5Gclose() to close it and release resources.
*
* This function allows the user the pass in a Group Access
* Property List, which H5Gopen1() does not.
*
* Return: Success: Object ID of the group.
* Failure: H5I_INVALID_HID
* Return: Success: Object ID of the group
*
* Programmer: James Laird
* Thursday, July 27, 2006
* Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id)
{
H5G_t *grp = NULL; /* Group opened */
H5G_t *grp = NULL; /* Group opened */
H5G_loc_t loc; /* Location of parent for group */
hid_t ret_value; /* Return value */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "i*si", loc_id, name, gapl_id);
@ -455,8 +453,10 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id)
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name")
if(!name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
if(!*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, FALSE) < 0)
@ -471,7 +471,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
done:
if(ret_value < 0)
if(H5I_INVALID_HID == ret_value)
if(grp && H5G_close(grp) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
@ -480,18 +480,15 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Gget_create_plist
* Function: H5Gget_create_plist
*
* Purpose: Returns a copy of the group creation property list.
* Purpose: Returns a copy of the group creation property list.
*
* Return: Success: ID for a copy of the group creation
* property list. The property list ID should be
* released by calling H5Pclose().
* Return: Success: ID for a copy of the group creation
* property list. The property list ID should be
* released by calling H5Pclose().
*
* Failure: H5I_INVALID_HID
*
* Programmer: Quincey Koziol
* Tuesday, October 25, 2005
* Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
@ -506,9 +503,9 @@ H5Gget_create_plist(hid_t group_id)
/* Check args */
if(NULL == (group = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group ID")
/* Retrieve the GCPL */
/* Get the group creation property list for the group */
if((ret_value = H5G_get_create_plist(group)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list")
@ -518,42 +515,38 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Gget_info
* Function: H5Gget_info
*
* Purpose: Retrieve information about a group.
* Purpose: Retrieve information about a group.
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
* November 27 2006
* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5Gget_info(hid_t grp_id, H5G_info_t *grp_info)
H5Gget_info(hid_t loc_id, H5G_info_t *group_info)
{
H5I_type_t id_type; /* Type of ID */
H5G_loc_t loc; /* Location of group */
herr_t ret_value = SUCCEED; /* Return value */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*x", grp_id, grp_info);
H5TRACE2("e", "i*x", loc_id, group_info);
/* Check args */
id_type = H5I_get_type(grp_id);
id_type = H5I_get_type(loc_id);
if(!(H5I_GROUP == id_type || H5I_FILE == id_type))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
if(!grp_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group (or file) ID")
if(!group_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL")
/* Get group location */
if(H5G_loc(grp_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the group's information */
if(H5G__obj_info(loc.oloc, grp_info) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
if(H5G__obj_info(loc.oloc, group_info) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info")
done:
FUNC_LEAVE_API(ret_value)
@ -561,42 +554,41 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Gget_info_by_name
* Function: H5Gget_info_by_name
*
* Purpose: Retrieve information about a group.
* Purpose: Retrieve information about a group, where the group is
* identified by name instead of ID.
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
* November 27 2006
* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info,
H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info,
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, grp_info, lapl_id);
H5TRACE4("e", "i*s*xi", loc_id, name, group_info, 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(!grp_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
if(!name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
if(!*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
if(!group_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL")
/* 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_SYM, H5E_CANTSET, FAIL, "can't set access property list info")
/* Retrieve the group's information */
if(H5G__get_info_by_name(&loc, name, grp_info/*out*/) < 0)
if(H5G__get_info_by_name(&loc, name, group_info/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
done:
@ -605,48 +597,46 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Gget_info_by_idx
* Function: H5Gget_info_by_idx
*
* Purpose: Retrieve information about a group, according to the order
* Purpose: Retrieve information about a group, according to the order
* of an index.
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
* November 27 2006
* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, H5G_info_t *grp_info, hid_t lapl_id)
H5_iter_order_t order, hsize_t n, H5G_info_t *group_info, 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, grp_info,
H5TRACE7("e", "i*sIiIoh*xi", loc_id, group_name, idx_type, order, n, group_info,
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(!group_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL")
if(!*group_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
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(!grp_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(!group_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL")
/* 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_SYM, H5E_CANTSET, FAIL, "can't set access property list info")
/* Retrieve the group's information */
if(H5G__get_info_by_idx(&loc, group_name, idx_type, order, n, grp_info/*out*/) < 0)
if(H5G__get_info_by_idx(&loc, group_name, idx_type, order, n, group_info/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
done:
@ -655,15 +645,12 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Gclose
* Function: H5Gclose
*
* Purpose: Closes the specified group. The group ID will no longer be
* valid for accessing the group.
* Purpose: Closes the specified group. The group ID will no longer be
* valid for accessing the group.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* Wednesday, December 31, 1997
* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@ -679,8 +666,7 @@ H5Gclose(hid_t group_id)
if(NULL == H5I_object_verify(group_id,H5I_GROUP))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
/*
* Decrement the counter on the group atom. It will be freed if the count
/* Decrement the counter on the group atom. It will be freed if the count
* reaches zero.
*/
if(H5I_dec_app_ref(group_id) < 0)
@ -714,7 +700,7 @@ H5Gflush(hid_t group_id)
/* Check args */
if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(group_id) < 0)
@ -722,7 +708,7 @@ H5Gflush(hid_t group_id)
/* Flush metadata to file */
if(H5O_flush_common(&grp->oloc, group_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group and object flush callback")
HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group")
done:
FUNC_LEAVE_API(ret_value)
@ -752,13 +738,13 @@ H5Grefresh(hid_t group_id)
/* Check args */
if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(group_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Call private function to refresh group object */
/* Refresh group's metadata */
if((H5O_refresh_metadata(group_id, grp->oloc)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group")

@ -59,19 +59,20 @@ typedef struct {
/* Private macros */
/* PRIVATE PROTOTYPES */
static herr_t H5G_compact_build_table_cb(const void *_mesg, unsigned idx, void *_udata);
static herr_t H5G__compact_build_table_cb(const void *_mesg, unsigned idx, void *_udata);
static herr_t H5G__compact_build_table(const H5O_loc_t *oloc,
const H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order,
H5G_link_table_t *ltable);
static herr_t H5G__compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata);
/*-------------------------------------------------------------------------
* Function: H5G_compact_build_table_cb
* Function: H5G__compact_build_table_cb
*
* Purpose: Callback routine for searching 'link' messages for a particular
* Purpose: Callback routine for searching 'link' messages for a particular
* name.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
@ -80,13 +81,13 @@ static herr_t H5G__compact_build_table(const H5O_loc_t *oloc,
*-------------------------------------------------------------------------
*/
static herr_t
H5G_compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata)
H5G__compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata)
{
const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */
H5G_iter_bt_t *udata = (H5G_iter_bt_t *)_udata; /* 'User data' passed in */
herr_t ret_value=H5_ITER_CONT; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_STATIC
/* check arguments */
HDassert(lnk);
@ -102,7 +103,7 @@ H5G_compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_compact_build_table_cb() */
} /* end H5G__compact_build_table_cb() */
/*-------------------------------------------------------------------------
@ -151,7 +152,7 @@ H5G__compact_build_table(const H5O_loc_t *oloc, const H5O_linfo_t *linfo,
/* Iterate through the link messages, adding them to the table */
op.op_type = H5O_MESG_OP_APP;
op.u.app_op = H5G_compact_build_table_cb;
op.u.app_op = H5G__compact_build_table_cb;
if(H5O_msg_iterate(oloc, H5O_LINK_ID, &op, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages")
@ -432,12 +433,12 @@ done:
/*-------------------------------------------------------------------------
* Function: H5G_compact_lookup_cb
* Function: H5G__compact_lookup_cb
*
* Purpose: Callback routine for searching 'link' messages for a particular
* Purpose: Callback routine for searching 'link' messages for a particular
* name & gettting object location for it
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
@ -446,13 +447,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5G_compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata)
H5G__compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata)
{
const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */
H5G_iter_lkp_t *udata = (H5G_iter_lkp_t *)_udata; /* 'User data' passed in */
herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_STATIC
/* check arguments */
HDassert(lnk);
@ -475,7 +476,7 @@ H5G_compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_uda
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_compact_lookup_cb() */
} /* end H5G__compact_lookup_cb() */
/*-------------------------------------------------------------------------
@ -511,7 +512,7 @@ H5G__compact_lookup(const H5O_loc_t *oloc, const char *name, H5O_link_t *lnk)
/* Iterate through the link messages, adding them to the table */
op.op_type = H5O_MESG_OP_APP;
op.u.app_op = H5G_compact_lookup_cb;
op.u.app_op = H5G__compact_lookup_cb;
if(H5O_msg_iterate(oloc, H5O_LINK_ID, &op, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages")
@ -604,7 +605,7 @@ H5G__compact_get_type_by_idx(H5O_loc_t *oloc, const H5O_linfo_t *linfo,
/* Check for going out of bounds */
if(idx >= ltable.nlinks)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5G_UNKNOWN, "index out of bound")
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5G_UNKNOWN, "index out of bound")
/* Determine type of object */
if(ltable.lnks[idx].type == H5L_TYPE_SOFT)

@ -416,7 +416,7 @@ HDfprintf(stderr, "%s: HDstrlen(lnk->name) = %Zu, link_size = %Zu\n", FUNC, HDst
/* Create serialized form of link */
if(H5O_msg_encode(f, H5O_LINK_ID, FALSE, (unsigned char *)link_ptr, lnk) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode link")
HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode link")
/* Open the fractal heap */
if(NULL == (fheap = H5HF_open(f, linfo->fheap_addr)))
@ -966,8 +966,7 @@ done:
*/
herr_t
H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type,
H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op,
void *op_data)
H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, void *op_data)
{
H5HF_t *fheap = NULL; /* Fractal heap handle */
H5G_link_table_t ltable = {0, NULL}; /* Table of links */

@ -164,7 +164,7 @@ H5G_map_obj_type(H5O_type_t obj_type)
* writing. Call H5Gclose() when finished with
* the group.
*
* Failure: FAIL
* Failure: H5I_INVALID_HID
*
* Programmer: Robb Matzke
* Wednesday, September 24, 1997
@ -176,65 +176,67 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
{
H5G_loc_t loc; /* Location to create group */
H5G_t *grp = NULL; /* New group created */
hid_t tmp_gcpl = (-1); /* Temporary group creation property list */
hid_t ret_value; /* Return value */
hid_t tmp_gcpl = H5I_INVALID_HID; /* Temporary group creation property list */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(FAIL)
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "i*sz", loc_id, name, size_hint);
/* Check arguments */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name given")
/* Check if we need to create a non-standard GCPL */
if(size_hint > 0) {
H5P_genplist_t *gc_plist; /* Property list created */
H5O_ginfo_t ginfo; /* Group info property */
H5P_genplist_t *gc_plist; /* Property list created */
/* Get the default property list */
if(NULL == (gc_plist = (H5P_genplist_t *)H5I_object(H5P_GROUP_CREATE_DEFAULT)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
/* Make a copy of the default property list */
if((tmp_gcpl = H5P_copy_plist(gc_plist, FALSE)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to copy the creation property list")
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list")
/* Get pointer to the copied property list */
if(NULL == (gc_plist = (H5P_genplist_t *)H5I_object(tmp_gcpl)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
/* Get the group info property */
if(H5P_get(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info")
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get group info")
/* Set the non-default local heap size hint */
H5_CHECKED_ASSIGN(ginfo.lheap_size_hint, uint32_t, size_hint, size_t);
if(H5P_set(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info")
} /* end if */
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set group info")
}
else
tmp_gcpl = H5P_GROUP_CREATE_DEFAULT;
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read info")
/* Create the new group & get its ID */
/* Create the group */
if(NULL == (grp = H5G__create_named(&loc, name, H5P_LINK_CREATE_DEFAULT, tmp_gcpl)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group")
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
/* Get an atom for the group */
if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group")
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
done:
if(tmp_gcpl > 0 && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT)
if(H5I_INVALID_HID != tmp_gcpl && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT)
if(H5I_dec_ref(tmp_gcpl) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release property list")
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release property list")
if(ret_value < 0)
if(H5I_INVALID_HID == ret_value)
if(grp && H5G_close(grp) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group")
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
FUNC_LEAVE_API(ret_value)
} /* end H5Gcreate1() */
@ -250,7 +252,7 @@ done:
*
* Return: Success: Object ID of the group.
*
* Failure: FAIL
* Failure: H5I_INVALID_HID
*
* Programmer: Robb Matzke
* Wednesday, December 31, 1997
@ -260,31 +262,31 @@ done:
hid_t
H5Gopen1(hid_t loc_id, const char *name)
{
H5G_t *grp = NULL; /* Group opened */
H5G_loc_t loc; /* Location of parent for group */
hid_t ret_value; /* Return value */
H5G_t *grp = NULL; /* Group opened */
H5G_loc_t loc; /* Location of parent for group */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(FAIL)
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "i*s", loc_id, name);
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name")
/* Open the group */
if(NULL == (grp = H5G__open_name(&loc, name)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group")
/* Register an atom for the group */
/* Get an atom for the group */
if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
done:
if(ret_value < 0)
if(H5I_INVALID_HID == ret_value)
if(grp && H5G_close(grp) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group")
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
FUNC_LEAVE_API(ret_value)
} /* end H5Gopen1() */
@ -316,7 +318,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
if(H5CX_set_loc(cur_loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Call internal routine to create link */
/* Create link */
if(H5G__link(cur_loc_id, cur_name, type, H5L_SAME_LOC, new_name, H5P_LINK_CREATE_DEFAULT) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "couldn't create link")
@ -352,7 +354,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
if(H5CX_set_loc(cur_loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Call internal routine to create link */
/* Create link */
if(H5G__link(cur_loc_id, cur_name, type, new_loc_id, new_name, H5P_LINK_CREATE_DEFAULT) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "couldn't create link")
@ -408,7 +410,7 @@ H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
/* Create the link */
if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end if */
}
else if(type == H5L_TYPE_SOFT) {
/* Soft links only need one location, the new_loc_id, but it's possible
* that new_loc_id is H5L_SAME_LOC
@ -423,9 +425,9 @@ H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
/* Create the link */
if(H5L_create_soft(cur_name, &new_loc, new_name, lcpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end else if */
}
else
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "Not a valid link type")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid link type")
done:
FUNC_LEAVE_NOAPI(ret_value)
@ -451,9 +453,9 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name)
if(H5CX_set_loc(src_loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Call common routine to move the link */
/* Move the link */
if(H5G__move(src_loc_id, src_name, H5L_SAME_LOC, dst_name, H5P_LINK_CREATE_DEFAULT) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link")
HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link")
done:
FUNC_LEAVE_API(ret_value)
@ -471,7 +473,7 @@ herr_t
H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
const char *dst_name)
{
herr_t ret_value = SUCCEED; /* Return value */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*si*s", src_loc_id, src_name, dst_loc_id, dst_name);
@ -484,9 +486,9 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
if(H5CX_set_loc(dst_loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Call common routine to move the link */
/* Move the link */
if(H5G__move(src_loc_id, src_name, dst_loc_id, dst_name, H5P_LINK_CREATE_DEFAULT) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link")
HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link")
done:
FUNC_LEAVE_API(ret_value)
@ -565,17 +567,17 @@ H5Gunlink(hid_t loc_id, const char *name)
/* Check arguments */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Call H5L routine... */
/* Delete the link */
if(H5L_delete(&loc, name) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link")
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link")
done:
FUNC_LEAVE_API(ret_value)
@ -609,9 +611,9 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/)
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Call the link routine which provides this capability */
/* Get the link value */
if(H5L_get_val(&loc, name, buf, size) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "couldn't get link info")
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "couldn't get link info")
done:
FUNC_LEAVE_API(ret_value)
@ -638,7 +640,7 @@ done:
herr_t
H5Gset_comment(hid_t loc_id, const char *name, const char *comment)
{
H5G_loc_t loc; /* Group's location */
H5G_loc_t loc; /* Group's location */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@ -653,7 +655,7 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment)
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Call the common routine which provides this capability */
/* Set the comment */
if(H5G_loc_set_comment(&loc, name, comment) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value")
@ -705,7 +707,7 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf)
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Call the common routine which provides this capability */
/* Get the comment */
if((ret_value = (int)H5G_loc_get_comment(&loc, name, buf, bufsize)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value")
@ -742,21 +744,24 @@ herr_t
H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op,
void *op_data)
{
H5G_loc_t loc; /* Location of object */
H5G_link_iterate_t lnk_op; /* Link operator */
hsize_t last_obj; /* Index of last object looked at */
hsize_t idx; /* Internal location to hold index */
hsize_t idx; /* Internal location to hold index */
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*s*Isx*x", loc_id, name, idx_p, op, op_data);
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
if(!name || !*name)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name specified")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(idx_p && *idx_p < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "invalid index specified")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified")
if(!op)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no operator specified")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified")
/* Set number of objects looked at to zero */
last_obj = 0;
@ -766,8 +771,8 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op,
lnk_op.op_type = H5G_LINK_OP_OLD;
lnk_op.op_func.op_old = op;
/* Call the common routine which provides this capability */
if((ret_value = H5G_iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0)
/* Call private function */
if((ret_value = H5G_iterate(&loc, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed")
/* Set the index we stopped at */
@ -798,23 +803,23 @@ done:
herr_t
H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs)
{
H5G_loc_t loc; /* Location of object */
H5G_info_t grp_info; /* Group information */
H5O_type_t obj_type; /* Type of object at location */
herr_t ret_value = SUCCEED;
H5G_loc_t loc; /* Location of object */
H5G_info_t grp_info; /* Group information */
H5O_type_t obj_type; /* Type of object at location */
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", loc_id, num_objs);
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
if(H5O_obj_type(loc.oloc, &obj_type) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type")
HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get object type")
if(obj_type != H5O_TYPE_GROUP)
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
if(!num_objs)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "bad pointer to # of objects")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad pointer to # of objects")
/* Retrieve information about the group */
if(H5G__obj_info(loc.oloc, &grp_info) < 0)
@ -849,17 +854,17 @@ herr_t
H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link,
H5G_stat_t *statbuf/*out*/)
{
H5G_loc_t loc; /* Group's location */
herr_t ret_value = SUCCEED; /* Return value */
H5G_loc_t loc; /* Group's location */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*sbx", loc_id, name, follow_link, statbuf);
/* Check arguments */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name specified")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
/* Get info */
if(H5G__get_objinfo(&loc, name, follow_link, statbuf) < 0)
@ -1054,13 +1059,13 @@ H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size)
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
if(H5O_obj_type(loc.oloc, &obj_type) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type")
HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get object type")
if(obj_type != H5O_TYPE_GROUP)
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
/* Call common routine */
/* Call internal function */
if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object name")
@ -1087,8 +1092,8 @@ done:
H5G_obj_t
H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx)
{
H5G_loc_t loc; /* Object location */
H5G_obj_t ret_value;
H5G_loc_t loc; /* Object location */
H5G_obj_t ret_value;
FUNC_ENTER_API(H5G_UNKNOWN)
H5TRACE2("Go", "ih", loc_id, idx);

@ -447,38 +447,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__open_oid() */
/*-------------------------------------------------------------------------
* Function: H5G__close_cb
*
* Purpose: Closes the specified group.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Sunday, February 18, 2018
*
*-------------------------------------------------------------------------
*/
herr_t
H5G__close_cb(H5G_t *grp)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Check args */
HDassert(grp && grp->shared);
HDassert(grp->shared->fo_count > 0);
/* Call actual group close routine */
if(H5G_close(grp) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "problem closing group")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__close_cb() */
/*-------------------------------------------------------------------------
* Function: H5G_close
@ -817,30 +785,27 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5G_iterate(hid_t loc_id, const char *group_name,
H5G_iterate(H5G_loc_t *loc, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk,
const H5G_link_iterate_t *lnk_op, void *op_data)
{
H5G_loc_t loc; /* Location of parent for group */
hid_t gid = -1; /* ID of group to iterate over */
H5G_t *grp = NULL; /* Pointer to group data structure to iterate over */
H5G_iter_appcall_ud_t udata; /* User data for callback */
herr_t ret_value = FAIL; /* Return value */
hid_t gid = H5I_INVALID_HID; /* ID of group to iterate over */
H5G_t *grp = NULL; /* Pointer to group data structure to iterate over */
H5G_iter_appcall_ud_t udata; /* User data for callback */
herr_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(loc);
HDassert(group_name);
HDassert(last_lnk);
HDassert(lnk_op && lnk_op->op_func.op_new);
/*
* Open the group on which to operate. We also create a group ID which
/* Open the group on which to operate. We also create a group ID which
* we can pass to the application-defined operator.
*/
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(NULL == (grp = H5G__open_name(&loc, group_name)))
if(NULL == (grp = H5G__open_name(loc, group_name)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
if((gid = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
@ -856,7 +821,7 @@ H5G_iterate(hid_t loc_id, const char *group_name,
done:
/* Release the group opened */
if(gid > 0) {
if(gid != H5I_INVALID_HID) {
if(H5I_dec_app_ref(gid) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group")
}
@ -1078,15 +1043,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, H5L_iterate_t op, void *op_data)
{
H5G_iter_visit_ud_t udata; /* User data for callback */
H5O_linfo_t linfo; /* Link info message */
htri_t linfo_exists; /* Whether the link info message exists */
hid_t gid = (-1); /* Group ID */
hid_t gid = H5I_INVALID_HID; /* Group ID */
H5G_t *grp = NULL; /* Group opened */
H5G_loc_t loc; /* Location of group passed in */
H5G_loc_t start_loc; /* Location of starting group */
unsigned rc; /* Reference count of object */
herr_t ret_value = FAIL; /* Return value */
@ -1097,11 +1061,11 @@ H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type,
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!loc)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "loc parameter cannot be NULL")
/* Open the group to begin visiting within */
if(NULL == (grp = H5G__open_name(&loc, group_name)))
if(NULL == (grp = H5G__open_name(loc, group_name)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
/* Register an ID for the starting group */
@ -1184,7 +1148,7 @@ done:
H5SL_destroy(udata.visited, H5G_free_visit_visited, NULL);
/* Release the group opened */
if(gid > 0) {
if(gid != H5I_INVALID_HID) {
if(H5I_dec_app_ref(gid) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group")
}
@ -1254,7 +1218,7 @@ H5G_get_create_plist(const H5G_t *grp)
/* Check for the group having a link info message */
if((linfo_exists = H5G__obj_get_linfo(&(grp->oloc), &linfo)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to read object header")
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to read object header")
if(linfo_exists) {
/* Set the link info for the property list */
if(H5P_set(new_plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0)

@ -1311,7 +1311,7 @@ H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc,
udata.path = NULL;
/* Visit all the links in the file */
if((status = H5G_visit(file, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5G_get_name_by_addr_cb, &udata)) < 0)
if((status = H5G_visit(&root_loc, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5G_get_name_by_addr_cb, &udata)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADITER, (-1), "group traversal failed while looking for object name")
else if(status > 0)
found_obj = TRUE;

@ -336,7 +336,6 @@ H5_DLL herr_t H5G__get_info_by_name(const H5G_loc_t *loc, const char *name,
H5G_info_t *grp_info);
H5_DLL herr_t H5G__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, H5G_info_t *grp_info);
H5_DLL herr_t H5G__close_cb(H5G_t *grp);
/*
* Group hierarchy traversal routines

@ -209,10 +209,10 @@ H5_DLL char *H5G_normalize(const char *name);
*/
H5_DLL herr_t H5G_traverse(const H5G_loc_t *loc, const char *name,
unsigned target, H5G_traverse_t op, void *op_data);
H5_DLL herr_t H5G_iterate(hid_t loc_id, const char *group_name,
H5_DLL herr_t H5G_iterate(H5G_loc_t *loc, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk,
const H5G_link_iterate_t *lnk_op, void *op_data);
H5_DLL herr_t H5G_visit(hid_t loc_id, const char *group_name,
H5_DLL herr_t H5G_visit(H5G_loc_t *loc, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data);
/*
@ -262,7 +262,7 @@ H5_DLL herr_t H5G_name_free(H5G_name_t *name);
H5_DLL ssize_t H5G_get_name(const H5G_loc_t *loc, char *name/*out*/, size_t size,
hbool_t *cached);
H5_DLL ssize_t H5G_get_name_by_addr(hid_t fid, const struct H5O_loc_t *loc,
char* name, size_t size);
char* name, size_t size);
H5_DLL H5RS_str_t *H5G_build_fullpath_refstr_str(H5RS_str_t *path_r, const char *name);
/*

@ -32,18 +32,17 @@
/***********/
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* File access */
#include "H5Gpkg.h" /* Groups */
#include "H5HLprivate.h" /* Local Heaps */
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5MMprivate.h" /* Memory management */
#include "H5Ppublic.h" /* Property Lists */
#include "H5WBprivate.h" /* Wrapped Buffers */
#include "H5private.h" /* Generic Functions */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* File access */
#include "H5Gpkg.h" /* Groups */
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5MMprivate.h" /* Memory management */
#include "H5Ppublic.h" /* Property Lists */
#include "H5WBprivate.h" /* Wrapped Buffers */
/****************/
@ -324,7 +323,7 @@ H5G__traverse_slink(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
/* Traverse the link */
if(H5G__traverse_real(&tmp_grp_loc, lnk->u.soft.name, target, H5G__traverse_slink_cb, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to follow symbolic link")
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to follow symbolic link")
/* Pass back information about whether the object exists */
*obj_exists = udata.exists;
@ -359,8 +358,7 @@ done:
*/
herr_t
H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
unsigned target, hbool_t last_comp, H5G_loc_t *obj_loc,
hbool_t *obj_exists)
unsigned target, hbool_t last_comp, H5G_loc_t *obj_loc, hbool_t *obj_exists)
{
size_t nlinks; /* # of soft / UD links left to traverse */
herr_t ret_value = SUCCEED; /* Return value */
@ -372,13 +370,13 @@ H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
HDassert(lnk);
HDassert(obj_loc);
/*
* If we found a symbolic link then we should follow it. But if this
/* If we found a symbolic link then we should follow it. But if this
* is the last component of the name and the H5G_TARGET_SLINK bit of
* TARGET is set then we don't follow it.
*/
if(H5L_TYPE_SOFT == lnk->type &&
(0 == (target & H5G_TARGET_SLINK) || !last_comp)) {
/* Get the # of soft / UD links left to traverse */
if(H5CX_get_nlinks(&nlinks) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse")
@ -403,6 +401,7 @@ H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
*/
if(lnk->type >= H5L_TYPE_UD_MIN &&
(0 == (target & H5G_TARGET_UDLINK) || !last_comp) ) {
/* Get the # of soft / UD links left to traverse */
if(H5CX_get_nlinks(&nlinks) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse")
@ -830,20 +829,21 @@ H5G_traverse(const H5G_loc_t *loc, const char *name, unsigned target, H5G_traver
if(!op)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "no operation provided")
/* Retrieve the original # of soft / UD links that are able to be traversed */
/* (So that multiple calls to H5G_traverse don't incorrectly look
* like they've traversed too many. Nested calls, like in H5L__move(),
/* Retrieve the original # of soft / UD links that are able to be traversed
* (So that multiple calls to H5G_traverse don't incorrectly look
* like they've traversed too many. Nested calls, like in H5L_move(),
* may need their own mechanism to set & reset the # of links to traverse)
*/
if(H5CX_get_nlinks(&orig_nlinks) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse")
/* Set up invalid tag. This is a precautionary step only. Setting an invalid
tag here will ensure that no metadata accessed while doing the traversal
is given an improper tag, unless another one is specifically set up
first. This will ensure we're not accidentally tagging something we
shouldn't be during the traversal. Note that for best tagging assertion
coverage, setting H5C_DO_TAGGING_SANITY_CHECKS is advised. */
* tag here will ensure that no metadata accessed while doing the traversal
* is given an improper tag, unless another one is specifically set up
* first. This will ensure we're not accidentally tagging something we
* shouldn't be during the traversal. Note that for best tagging assertion
* coverage, setting H5C_DO_TAGGING_SANITY_CHECKS is advised.
*/
H5_BEGIN_TAG(H5AC__INVALID_TAG);
/* Go perform "real" traversal */

557
src/H5L.c

File diff suppressed because it is too large Load Diff

@ -122,12 +122,27 @@ H5_DLL herr_t H5L_move(const H5G_loc_t *src_loc, const char *src_name,
const H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag,
hid_t lcpl_id);
H5_DLL htri_t H5L_exists_tolerant(const H5G_loc_t *loc, const char *name);
H5_DLL htri_t H5L_exists(const H5G_loc_t *loc, const char *name);
H5_DLL herr_t H5L_get_info(const H5G_loc_t *loc, const char *name,
H5L_info_t *linkbuf/*out*/);
H5_DLL herr_t H5L_delete(const H5G_loc_t *loc, const char *name);
H5_DLL herr_t H5L_delete_by_idx(const H5G_loc_t *loc, const char *name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
H5_DLL herr_t H5L_get_info_by_idx(const H5G_loc_t *loc, const char *name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
H5L_info_t *linfo /*out*/);
H5_DLL ssize_t H5L_get_name_by_idx(const H5G_loc_t *loc, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
char *name /*out*/, size_t size);
H5_DLL herr_t H5L_get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/,
size_t size);
H5_DLL herr_t H5L_get_val_by_idx(const H5G_loc_t *loc, const char *name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
void *buf/*out*/, size_t size);
H5_DLL herr_t H5L_register_external(void);
H5_DLL herr_t H5L_iterate(H5G_loc_t *loc, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p,
H5L_iterate_t op, void *op_data);
/* User-defined link functions */
H5_DLL herr_t H5L_register(const H5L_class_t *cls);

350
src/H5O.c

@ -75,9 +75,9 @@
/*-------------------------------------------------------------------------
* Function: H5Oopen
* Function: H5Oopen
*
* Purpose: Opens an object within an HDF5 file.
* Purpose: Opens an object within an HDF5 file.
*
* This function opens an object in the same way that H5Gopen2,
* H5Topen2, and H5Dopen2 do. However, H5Oopen doesn't require
@ -88,8 +88,9 @@
* The opened object should be closed again with H5Oclose
* or H5Gclose, H5Tclose, or H5Dclose.
*
* Return: Success: An open object identifier
* Failure: Negative
* Return: Success: An open object identifier
*
* Failure: H5I_INVALID_HID
*
* Programmer: James Laird
* July 14 2006
@ -100,16 +101,18 @@ hid_t
H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id)
{
H5G_loc_t loc; /* Location of group */
hid_t ret_value = FAIL;
hid_t ret_value = H5I_INVALID_HID;
FUNC_ENTER_API(FAIL)
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "i*si", loc_id, name, 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")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
if(!name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
if(!*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
@ -117,7 +120,7 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id)
/* Open the object */
if((ret_value = H5O_open_name(&loc, name, TRUE)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
done:
FUNC_LEAVE_API(ret_value)
@ -140,7 +143,7 @@ done:
* or H5Gclose, H5Tclose, or H5Dclose.
*
* Return: Success: An open object identifier
* Failure: Negative
* Failure: H5I_INVALID_HID
*
* Programmer: Quincey Koziol
* November 20 2006
@ -152,28 +155,28 @@ 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)
{
H5G_loc_t loc; /* Location of group */
hid_t ret_value = FAIL;
hid_t ret_value = H5I_INVALID_HID;
FUNC_ENTER_API(FAIL)
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE6("i", "i*sIiIohi", loc_id, group_name, idx_type, order, n, lapl_id);
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
if(!group_name || !*group_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "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")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid iteration order 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, H5I_INVALID_HID, "can't set access property list info")
/* Open the object */
if((ret_value = H5O__open_by_idx(&loc, group_name, idx_type, order, n)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
if((ret_value = H5O_open_by_idx(&loc, group_name, idx_type, order, n)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
done:
FUNC_LEAVE_API(ret_value)
@ -208,7 +211,7 @@ done:
* map this to an address on disk for the filesystem.
*
* Return: Success: An open object identifier
* Failure: Negative
* Failure: H5I_INVALID_HID
*
* Programmer: James Laird
* July 14 2006
@ -221,7 +224,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr)
H5G_loc_t loc; /* Location within file */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(FAIL)
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "ia", loc_id, addr);
/* Check args */
@ -231,8 +234,8 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no address supplied")
/* Open the object */
if((ret_value = H5O__open_by_addr(&loc, addr)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
if((ret_value = H5O_open_by_addr(&loc, addr)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
done:
FUNC_LEAVE_API(ret_value)
@ -332,13 +335,13 @@ H5Oincr_refcount(hid_t object_id)
/* Get the object's oloc so we can adjust its link count */
if((oloc = H5O_get_loc(object_id)) == NULL)
HGOTO_ERROR(H5E_ATOM, H5E_BADVALUE, FAIL, "unable to get object location from ID")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location from ID")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(object_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
/* Change the object's refcount */
/* Change the object's reference count */
if(H5O_link(oloc, 1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
@ -378,13 +381,13 @@ H5Odecr_refcount(hid_t object_id)
/* Get the object's oloc so we can adjust its link count */
if((oloc = H5O_get_loc(object_id)) == NULL)
HGOTO_ERROR(H5E_ATOM, H5E_BADVALUE, FAIL, "unable to get object location from ID")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location from ID")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(object_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
/* Change the object's refcount */
/* Change the object's reference count */
if(H5O_link(oloc, -1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
@ -394,12 +397,12 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Oexists_by_name
* Function: H5Oexists_by_name
*
* Purpose: Determine if a linked-to object exists
* Purpose: Determine if a linked-to object exists
*
* Return: Success: TRUE/FALSE
* Failure: Negative
* Return: Success: TRUE/FALSE
* Failure: FAIL
*
* Programmer: Quincey Koziol
* February 2 2010
@ -418,8 +421,10 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t 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(!name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
if(!*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
@ -441,8 +446,7 @@ done:
*
* NOTE: Add a parameter "fields" to indicate selection of object info.
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Neil Fortner
* July 7 2010
@ -462,12 +466,12 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields)
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")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL")
if(fields & ~H5O_INFO_ALL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
/* Retrieve the object's information */
if(H5G_loc_info(&loc, ".", oinfo/*out*/, fields) < 0)
if(H5G_loc_info(&loc, ".", oinfo, fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
done:
@ -475,21 +479,20 @@ done:
} /* end H5Oget_info2() */
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
*/
/*-------------------------------------------------------------------------
* Function: H5Oget_info_by_name2
*
* Purpose: Retrieve information about an object
*
* NOTE: Add a parameter "fields" to indicate selection of object info.
*
* Return: SUCCEED/FAIL
*
* Programmer: Neil Fortner
* July 7 2010
*
*-------------------------------------------------------------------------
*/
herr_t
H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo,
unsigned fields, hid_t lapl_id)
@ -503,10 +506,12 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo,
/* 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(!name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
if(!*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
if(!oinfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL")
if(fields & ~H5O_INFO_ALL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
@ -578,16 +583,16 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Oset_comment
* Function: H5Oset_comment
*
* Purpose: Gives the specified object a comment. The COMMENT string
* should be a null terminated string. An object can have only
* one comment at a time. Passing NULL for the COMMENT argument
* will remove the comment property from the object.
* should be a null terminated string. An object can have only
* one comment at a time. Passing NULL for the COMMENT argument
* will remove the comment property from the object.
*
* Note: Deprecated in favor of using attributes on objects
* Note: Deprecated in favor of using attributes on objects
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* August 30 2007
@ -605,7 +610,7 @@ H5Oset_comment(hid_t obj_id, const char *comment)
/* Check args */
if(H5G_loc(obj_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(obj_id) < 0)
@ -621,16 +626,16 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Oset_comment_by_name
* Function: H5Oset_comment_by_name
*
* Purpose: Gives the specified object a comment. The COMMENT string
* should be a null terminated string. An object can have only
* one comment at a time. Passing NULL for the COMMENT argument
* will remove the comment property from the object.
* should be a null terminated string. An object can have only
* one comment at a time. Passing NULL for the COMMENT argument
* will remove the comment property from the object.
*
* Note: Deprecated in favor of using attributes on objects
* Note: Deprecated in favor of using attributes on objects
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* August 30 2007
@ -667,15 +672,15 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Oget_comment
* Function: H5Oget_comment
*
* Purpose: Retrieve comment for an object.
* Purpose: Retrieve comment for an object.
*
* Return: Success: Number of bytes in the comment excluding the
* null terminator. Zero if the object has no
* comment.
* Return: Success: Number of bytes in the comment excluding the
* null terminator. Zero if the object has no
* comment.
*
* Failure: Negative
* Failure: -1
*
* Programmer: Quincey Koziol
* August 30 2007
@ -686,18 +691,18 @@ ssize_t
H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize)
{
H5G_loc_t loc; /* Location of group */
ssize_t ret_value; /* Return value */
ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API(FAIL)
FUNC_ENTER_API((-1))
H5TRACE3("Zs", "i*sz", obj_id, comment, bufsize);
/* Check args */
if(H5G_loc(obj_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location")
/* Retrieve the object's comment */
if((ret_value = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object")
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object")
done:
FUNC_LEAVE_API(ret_value)
@ -705,15 +710,15 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Oget_comment_by_name
* Function: H5Oget_comment_by_name
*
* Purpose: Retrieve comment for an object.
* Purpose: Retrieve comment for an object.
*
* Return: Success: Number of bytes in the comment excluding the
* null terminator. Zero if the object has no
* comment.
* Return: Success: Number of bytes in the comment excluding the
* null terminator. Zero if the object has no
* comment.
*
* Failure: Negative
* Failure: -1
*
* Programmer: Quincey Koziol
* August 30 2007
@ -725,24 +730,24 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf
hid_t lapl_id)
{
H5G_loc_t loc; /* Location of group */
ssize_t ret_value; /* Return value */
ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API(FAIL)
FUNC_ENTER_API((-1))
H5TRACE5("Zs", "i*s*szi", loc_id, name, comment, bufsize, lapl_id);
/* Check args */
if(H5G_loc(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(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "no name")
/* 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")
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, (-1), "can't set access property list info")
/* Retrieve the object's comment */
if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object: '%s'", name)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object: '%s'", name)
done:
FUNC_LEAVE_API(ret_value)
@ -750,70 +755,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Ovisit2
*
* 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.
*
* 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
* library, or the negative value returned by one
* of the operators.
*
* Programmer: Quincey Koziol
* November 25 2007
*
*-------------------------------------------------------------------------
*/
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)
{
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
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)
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")
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, fields)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Ovisit2() */
/*-------------------------------------------------------------------------
* Function: H5Ovisit_by_name2
* Function: H5Ovisit2
*
* Purpose: Recursively visit an object and all the objects reachable
* from it. If the starting object is a group, all the objects
@ -835,12 +777,78 @@ done:
* 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.
* 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.
* 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
H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
H5O_iterate_t op, void *op_data, unsigned fields)
{
H5G_loc_t loc;
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iIiIox*xIu", obj_id, idx_type, order, op, op_data, fields);
/* Check args */
if(H5G_loc(obj_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
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")
if(fields & ~H5O_INFO_ALL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
/* Visit the objects */
if((ret_value = H5O__visit(&loc, ".", idx_type, order, op, op_data, fields)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Ovisit2() */
/*-------------------------------------------------------------------------
* Function: H5Ovisit_by_name2
*
* 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.
*
* 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
* library, or the negative value returned by one
* of the operators.
*
* Programmer: Quincey Koziol
* November 24 2007
@ -851,15 +859,20 @@ 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, unsigned fields, hid_t lapl_id)
{
herr_t ret_value; /* Return value */
H5G_loc_t loc;
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
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)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be NULL")
if(!*obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be an empty string")
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)
@ -873,9 +886,9 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
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, fields)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
/* Visit the objects */
if((ret_value = H5O__visit(&loc, obj_name, idx_type, order, op, op_data, fields)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed")
done:
FUNC_LEAVE_API(ret_value)
@ -883,17 +896,16 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Oclose
* Function: H5Oclose
*
* Purpose: Close an open file object.
* Purpose: Close an open file object.
*
* This is the companion to H5Oopen. It is used to close any
* open object in an HDF5 file (but not IDs are that not file
* objects, such as property lists and dataspaces). It has
* the same effect as calling H5Gclose, H5Dclose, or H5Tclose.
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: James Laird
* July 14 2006

@ -57,9 +57,9 @@
/* Local Prototypes */
/********************/
static herr_t H5O_add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno,
static herr_t H5O__add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno,
hbool_t *chk_dirtied, size_t idx, uint8_t *new_gap_loc, size_t new_gap_size);
static herr_t H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied,
static herr_t H5O__eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied,
H5O_mesg_t *mesg, uint8_t *new_gap_loc, size_t new_gap_size);
static herr_t H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx,
const H5O_msg_class_t *new_type, void *new_native, size_t new_size);
@ -70,10 +70,10 @@ static herr_t H5O__alloc_find_best_nonnull(const H5F_t *f, const H5O_t *oh, size
static herr_t H5O__alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size,
size_t *new_idx);
static herr_t H5O__alloc_find_best_null(const H5O_t *oh, size_t size, size_t *mesg_idx);
static htri_t H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u);
static htri_t H5O_move_msgs_forward(H5F_t *f, H5O_t *oh);
static htri_t H5O_merge_null(H5F_t *f, H5O_t *oh);
static htri_t H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh);
static htri_t H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u);
static htri_t H5O__move_msgs_forward(H5F_t *f, H5O_t *oh);
static htri_t H5O__merge_null(H5F_t *f, H5O_t *oh);
static htri_t H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh);
static herr_t H5O__alloc_shrink_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno);
@ -97,7 +97,7 @@ H5FL_EXTERN(H5O_cont_t);
/*-------------------------------------------------------------------------
* Function: H5O_add_gap
* Function: H5O__add_gap
*
* Purpose: Add a gap to a chunk
*
@ -110,14 +110,14 @@ H5FL_EXTERN(H5O_cont_t);
*-------------------------------------------------------------------------
*/
static herr_t
H5O_add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, hbool_t *chk_dirtied,
H5O__add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, hbool_t *chk_dirtied,
size_t idx, uint8_t *new_gap_loc, size_t new_gap_size)
{
hbool_t merged_with_null; /* Whether the gap was merged with a null message */
size_t u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_STATIC
/* check args */
HDassert(oh);
@ -150,7 +150,7 @@ if(chunkno > 0) {
HDassert(oh->chunk[chunkno].gap == 0);
/* Eliminate the gap in the chunk */
if(H5O_eliminate_gap(oh, chk_dirtied, &oh->mesg[u], new_gap_loc, new_gap_size) < 0)
if(H5O__eliminate_gap(oh, chk_dirtied, &oh->mesg[u], new_gap_loc, new_gap_size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't eliminate gap in chunk")
/* Set flag to indicate that the gap was handled */
@ -178,7 +178,7 @@ if(chunkno > 0) {
/* Check if we need to extend message table to hold the new null message */
if(oh->nmesgs >= oh->alloc_nmesgs)
if(H5O_alloc_msgs(oh, (size_t)1) < 0)
if(H5O__alloc_msgs(oh, (size_t)1) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
/* Increment new gap size */
@ -212,11 +212,11 @@ if(chunkno > 0) {
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_add_gap() */
} /* H5O__add_gap() */
/*-------------------------------------------------------------------------
* Function: H5O_eliminate_gap
* Function: H5O__eliminate_gap
*
* Purpose: Eliminate a gap in a chunk with a null message.
*
@ -236,13 +236,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg,
H5O__eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg,
uint8_t *gap_loc, size_t gap_size)
{
uint8_t *move_start, *move_end; /* Pointers to area of messages to move */
hbool_t null_before_gap; /* Flag whether the null message is before the gap or not */
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_ENTER_STATIC_NOERR
/* check args */
HDassert(oh);
@ -319,7 +319,7 @@ H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg,
*chk_dirtied = TRUE;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5O_eliminate_gap() */
} /* H5O__eliminate_gap() */
/*-------------------------------------------------------------------------
@ -369,7 +369,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx,
alloc_msg->raw_size = new_size;
/* Add the gap to the chunk */
if(H5O_add_gap(f, oh, alloc_msg->chunkno, &chk_dirtied, null_idx, alloc_msg->raw + alloc_msg->raw_size, gap_size) < 0)
if(H5O__add_gap(f, oh, alloc_msg->chunkno, &chk_dirtied, null_idx, alloc_msg->raw + alloc_msg->raw_size, gap_size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk")
} /* end if */
else {
@ -378,7 +378,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx,
/* Check if we need to extend message table to hold the new null message */
if(oh->nmesgs >= oh->alloc_nmesgs) {
if(H5O_alloc_msgs(oh, (size_t)1) < 0)
if(H5O__alloc_msgs(oh, (size_t)1) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
/* "Retarget" 'alloc_msg' pointer into newly re-allocated array of messages */
@ -402,7 +402,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx,
unsigned null_chunkno = null_msg->chunkno; /* Chunk w/gap */
/* Eliminate the gap in the chunk */
if(H5O_eliminate_gap(oh, &chk_dirtied, null_msg,
if(H5O__eliminate_gap(oh, &chk_dirtied, null_msg,
((oh->chunk[null_chunkno].image + oh->chunk[null_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[null_chunkno].gap)),
oh->chunk[null_chunkno].gap) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk")
@ -432,7 +432,7 @@ done:
/*-------------------------------------------------------------------------
*
* Function: H5O_alloc_msgs
* Function: H5O__alloc_msgs
*
* Purpose: Allocate more messages for a header
*
@ -445,14 +445,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5O_alloc_msgs(H5O_t *oh, size_t min_alloc)
H5O__alloc_msgs(H5O_t *oh, size_t min_alloc)
{
size_t old_alloc; /* Old number of messages allocated */
size_t na; /* New number of messages allocated */
H5O_mesg_t *new_mesg; /* Pointer to new message array */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_PACKAGE
/* check args */
HDassert(oh);
@ -474,7 +474,7 @@ H5O_alloc_msgs(H5O_t *oh, size_t min_alloc)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_alloc_msgs() */
} /* H5O__alloc_msgs() */
/*-------------------------------------------------------------------------
@ -590,7 +590,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size,
/* Protect chunk */
if(NULL == (chk_proxy = H5O__chunk_protect(f, oh, chunkno)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk")
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk")
/* Determine whether the chunk can be extended */
was_extended = H5MF_try_extend(f, H5FD_MEM_OHDR, oh->chunk[chunkno].addr, (hsize_t)(oh->chunk[chunkno].size), (hsize_t)(delta + extra_prfx_size));
@ -618,7 +618,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size,
else {
/* Create a new null message */
if(oh->nmesgs >= oh->alloc_nmesgs)
if(H5O_alloc_msgs(oh, (size_t)1) < 0)
if(H5O__alloc_msgs(oh, (size_t)1) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
/* Set extension message */
@ -690,7 +690,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size,
} /* end for */
/* Resize the chunk in the cache */
if(H5O_chunk_resize(oh, chk_proxy) < 0)
if(H5O__chunk_resize(oh, chk_proxy) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize object header chunk")
/* Set new message index */
@ -958,7 +958,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null,
* that could be generated below.
*/
if(oh->nmesgs + 3 > oh->alloc_nmesgs)
if(H5O_alloc_msgs(oh, (size_t)3) < 0)
if(H5O__alloc_msgs(oh, (size_t)3) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
/* Check if we need to move multiple messages, in order to make room for the new message */
@ -1361,7 +1361,7 @@ done:
/*-------------------------------------------------------------------------
*
* Function: H5O_release_mesg
* Function: H5O__release_mesg
*
* Purpose: Convert a message into a null message
*
@ -1374,13 +1374,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link)
H5O__release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link)
{
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
FUNC_ENTER_PACKAGE
/* check args */
HDassert(f);
@ -1395,7 +1395,7 @@ H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link)
/* Protect chunk */
if(NULL == (chk_proxy = H5O__chunk_protect(f, oh, mesg->chunkno)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk")
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk")
/* Free any native information */
H5O__msg_free_mesg(mesg);
@ -1415,7 +1415,7 @@ H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link)
/* Check if chunk has a gap currently */
if(oh->chunk[mesg->chunkno].gap) {
/* Eliminate the gap in the chunk */
if(H5O_eliminate_gap(oh, &chk_dirtied, mesg,
if(H5O__eliminate_gap(oh, &chk_dirtied, mesg,
((oh->chunk[mesg->chunkno].image + oh->chunk[mesg->chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[mesg->chunkno].gap)),
oh->chunk[mesg->chunkno].gap) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk")
@ -1427,11 +1427,11 @@ done:
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_release_mesg() */
} /* H5O__release_mesg() */
/*-------------------------------------------------------------------------
* Function: H5O_move_cont
* Function: H5O__move_cont
*
* Purpose: Check and move message(s) forward into a continuation message
*
@ -1444,7 +1444,7 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u)
H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u)
{
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that continuation message is in */
H5O_mesg_t *cont_msg; /* Pointer to the continuation message */
@ -1452,7 +1452,7 @@ H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u)
hbool_t chk_dirtied = FALSE; /* Flags for unprotecting chunk */
htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(f);
@ -1500,7 +1500,7 @@ H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u)
/* Convert continuation message into a null message. Do not delete
* the target chunk yet, so we can still copy messages from it. */
if(H5O_release_mesg(f, oh, cont_msg, FALSE) < 0)
if(H5O__release_mesg(f, oh, cont_msg, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to convert into null message")
/* Protect chunk */
@ -1549,7 +1549,7 @@ H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u)
/* Check if there is space that should be a gap */
if(gap_size > 0) {
/* Convert remnant into gap in chunk */
if(H5O_add_gap(f, oh, cont_chunkno, &chk_dirtied, cont_u, move_start, gap_size) < 0)
if(H5O__add_gap(f, oh, cont_chunkno, &chk_dirtied, cont_u, move_start, gap_size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk")
} /* end if */
@ -1594,12 +1594,12 @@ done:
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_move_cont() */
} /* H5O__move_cont() */
/*-------------------------------------------------------------------------
*
* Function: H5O_move_msgs_forward
* Function: H5O__move_msgs_forward
*
* Purpose: Move messages toward first chunk
*
@ -1612,7 +1612,7 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
H5O_move_msgs_forward(H5F_t *f, H5O_t *oh)
H5O__move_msgs_forward(H5F_t *f, H5O_t *oh)
{
H5O_chunk_proxy_t *null_chk_proxy = NULL; /* Chunk that null message is in */
H5O_chunk_proxy_t *curr_chk_proxy = NULL; /* Chunk that message is in */
@ -1623,7 +1623,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh)
hbool_t did_packing = FALSE; /* Whether any messages were packed */
htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_STATIC
/* check args */
HDassert(oh);
@ -1706,7 +1706,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh)
if(H5O_CONT_ID == curr_msg->type->id) {
htri_t status; /* Status from moving messages */
if((status = H5O_move_cont(f, oh, u)) < 0)
if((status = H5O__move_cont(f, oh, u)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "Error in moving messages into cont message")
else if(status > 0) { /* Message(s) got moved into "continuation" message */
packed_msg = TRUE;
@ -1818,7 +1818,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh)
/* Check for gap in null message's chunk */
if(oh->chunk[old_chunkno].gap > 0) {
/* Eliminate the gap in the chunk */
if(H5O_eliminate_gap(oh, &null_chk_dirtied, null_msg,
if(H5O__eliminate_gap(oh, &null_chk_dirtied, null_msg,
((oh->chunk[old_chunkno].image + oh->chunk[old_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[old_chunkno].gap)),
oh->chunk[old_chunkno].gap) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk")
@ -1845,7 +1845,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh)
null_chk_dirtied = TRUE;
/* Add the gap to the chunk */
if(H5O_add_gap(f, oh, null_msg->chunkno, &null_chk_dirtied, v, null_msg->raw + null_msg->raw_size, gap_size) < 0)
if(H5O__add_gap(f, oh, null_msg->chunkno, &null_chk_dirtied, v, null_msg->raw + null_msg->raw_size, gap_size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk")
/* Re-use message # for new null message taking place of non-null message */
@ -1862,7 +1862,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh)
/* Create new null message for previous location of non-null message */
if(oh->nmesgs >= oh->alloc_nmesgs) {
if(H5O_alloc_msgs(oh, (size_t)1) < 0)
if(H5O__alloc_msgs(oh, (size_t)1) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
/* "Retarget" 'curr_msg' pointer into newly re-allocated array of messages */
@ -1893,7 +1893,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh)
/* Check for gap in new null message's chunk */
if(oh->chunk[old_chunkno].gap > 0) {
/* Eliminate the gap in the chunk */
if(H5O_eliminate_gap(oh, &curr_chk_dirtied, &oh->mesg[new_null_msg],
if(H5O__eliminate_gap(oh, &curr_chk_dirtied, &oh->mesg[new_null_msg],
((oh->chunk[old_chunkno].image + oh->chunk[old_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[old_chunkno].gap)),
oh->chunk[old_chunkno].gap) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk")
@ -1945,12 +1945,12 @@ done:
HDassert(!null_chk_proxy && !curr_chk_proxy && !cont_targ_chk_proxy);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_move_msgs_forward() */
} /* H5O__move_msgs_forward() */
/*-------------------------------------------------------------------------
*
* Function: H5O_merge_null
* Function: H5O__merge_null
*
* Purpose: Merge neighboring null messages in an object header
*
@ -1963,13 +1963,13 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
H5O_merge_null(H5F_t *f, H5O_t *oh)
H5O__merge_null(H5F_t *f, H5O_t *oh)
{
hbool_t merged_msg; /* Flag to indicate that messages were merged */
hbool_t did_merging = FALSE; /* Whether any messages were merged */
htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_STATIC
/* check args */
HDassert(oh != NULL);
@ -2051,7 +2051,7 @@ H5O_merge_null(H5F_t *f, H5O_t *oh)
oh->nmesgs--;
/* The merge null message might span the entire chunk: scan for empty chunk to remove */
if((result = H5O_remove_empty_chunks(f, oh)) < 0)
if((result = H5O__remove_empty_chunks(f, oh)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't remove empty chunk")
else if(result > 0)
/* Get out of loop */
@ -2084,12 +2084,12 @@ H5O_merge_null(H5F_t *f, H5O_t *oh)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_merge_null() */
} /* H5O__merge_null() */
/*-------------------------------------------------------------------------
*
* Function: H5O_remove_empty_chunks
* Function: H5O__remove_empty_chunks
*
* Purpose: Attempt to eliminate empty chunks from object header.
*
@ -2106,13 +2106,13 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh)
H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh)
{
hbool_t deleted_chunk; /* Whether to a chunk was deleted */
hbool_t did_deleting = FALSE; /* Whether any chunks were deleted */
htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_STATIC
/* check args */
HDassert(oh != NULL);
@ -2173,7 +2173,7 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh)
deleted_chunkno = null_msg->chunkno;
/* Convert continuation message into a null message */
if(H5O_release_mesg(f, oh, cont_msg, TRUE) < 0)
if(H5O__release_mesg(f, oh, cont_msg, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to convert into null message")
/*
@ -2273,12 +2273,12 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_remove_empty_chunks() */
} /* H5O__remove_empty_chunks() */
/*-------------------------------------------------------------------------
*
* Function: H5O_condense_header
* Function: H5O__condense_header
*
* Purpose: Attempt to eliminate empty chunks from object header.
*
@ -2291,13 +2291,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5O_condense_header(H5F_t *f, H5O_t *oh)
H5O__condense_header(H5F_t *f, H5O_t *oh)
{
hbool_t rescan_header; /* Whether to rescan header */
htri_t result; /* Result from packing/merging/etc */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_NOAPI(FAIL)
FUNC_ENTER_PACKAGE
/* check args */
HDassert(oh != NULL);
@ -2308,33 +2308,33 @@ H5O_condense_header(H5F_t *f, H5O_t *oh)
rescan_header = FALSE;
/* Scan for messages that can be moved earlier in chunks */
result = H5O_move_msgs_forward(f, oh);
result = H5O__move_msgs_forward(f, oh);
if(result < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't move header messages forward")
if(result > 0)
rescan_header = TRUE;
/* Scan for adjacent null messages & merge them */
result = H5O_merge_null(f, oh);
result = H5O__merge_null(f, oh);
if(result < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack null header messages")
if(result > 0)
rescan_header = TRUE;
/* Scan for empty chunks to remove */
result = H5O_remove_empty_chunks(f, oh);
result = H5O__remove_empty_chunks(f, oh);
if(result < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't remove empty chunk")
if(result > 0)
rescan_header = TRUE;
} while(rescan_header);
#ifdef H5O_DEBUG
H5O_assert(oh);
H5O__assert(oh);
#endif /* H5O_DEBUG */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_condense_header() */
} /* H5O__condense_header() */
/*-------------------------------------------------------------------------
@ -2523,7 +2523,7 @@ H5O__alloc_shrink_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno)
HDassert(new_size <= old_size);
/* Resize the chunk in the cache */
if(H5O_chunk_resize(oh, chk_proxy) < 0)
if(H5O__chunk_resize(oh, chk_proxy) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize object header chunk")
/* Free the unused space in the file */

@ -44,48 +44,48 @@ static herr_t H5O__attr_debug(H5F_t *f, const void *_mesg, FILE * stream,
int indent, int fwidth);
/* Set up & include shared message "interface" info */
#define H5O_SHARED_TYPE H5O_MSG_ATTR
#define H5O_SHARED_DECODE H5O_attr_shared_decode
#define H5O_SHARED_DECODE_REAL H5O_attr_decode
#define H5O_SHARED_ENCODE H5O_attr_shared_encode
#define H5O_SHARED_ENCODE_REAL H5O_attr_encode
#define H5O_SHARED_SIZE H5O_attr_shared_size
#define H5O_SHARED_SIZE_REAL H5O_attr_size
#define H5O_SHARED_DELETE H5O__attr_shared_delete
#define H5O_SHARED_DELETE_REAL H5O__attr_delete
#define H5O_SHARED_LINK H5O__attr_shared_link
#define H5O_SHARED_LINK_REAL H5O__attr_link
#define H5O_SHARED_COPY_FILE H5O__attr_shared_copy_file
#define H5O_SHARED_COPY_FILE_REAL H5O__attr_copy_file
#define H5O_SHARED_POST_COPY_FILE H5O_attr_shared_post_copy_file
#define H5O_SHARED_POST_COPY_FILE_REAL H5O__attr_post_copy_file
#define H5O_SHARED_TYPE H5O_MSG_ATTR
#define H5O_SHARED_DECODE H5O_attr_shared_decode
#define H5O_SHARED_DECODE_REAL H5O_attr_decode
#define H5O_SHARED_ENCODE H5O_attr_shared_encode
#define H5O_SHARED_ENCODE_REAL H5O_attr_encode
#define H5O_SHARED_SIZE H5O_attr_shared_size
#define H5O_SHARED_SIZE_REAL H5O_attr_size
#define H5O_SHARED_DELETE H5O__attr_shared_delete
#define H5O_SHARED_DELETE_REAL H5O__attr_delete
#define H5O_SHARED_LINK H5O__attr_shared_link
#define H5O_SHARED_LINK_REAL H5O__attr_link
#define H5O_SHARED_COPY_FILE H5O__attr_shared_copy_file
#define H5O_SHARED_COPY_FILE_REAL H5O__attr_copy_file
#define H5O_SHARED_POST_COPY_FILE H5O_attr_shared_post_copy_file
#define H5O_SHARED_POST_COPY_FILE_REAL H5O__attr_post_copy_file
#undef H5O_SHARED_POST_COPY_FILE_UPD
#define H5O_SHARED_DEBUG H5O_attr_shared_debug
#define H5O_SHARED_DEBUG_REAL H5O__attr_debug
#define H5O_SHARED_DEBUG H5O_attr_shared_debug
#define H5O_SHARED_DEBUG_REAL H5O__attr_debug
#include "H5Oshared.h" /* Shared Object Header Message Callbacks */
/* This message derives from H5O message class */
const H5O_msg_class_t H5O_MSG_ATTR[1] = {{
H5O_ATTR_ID, /* message id number */
"attribute", /* message name for debugging */
sizeof(H5A_t), /* native message size */
H5O_SHARE_IS_SHARABLE, /* messages are sharable? */
H5O_attr_shared_decode, /* decode message */
H5O_attr_shared_encode, /* encode message */
H5O_attr_copy, /* copy the native value */
H5O_attr_shared_size, /* size of raw message */
H5O__attr_reset, /* reset method */
H5O__attr_free, /* free method */
H5O__attr_shared_delete, /* file delete method */
H5O__attr_shared_link, /* link method */
NULL, /*set share method */
NULL, /*can share method */
H5O_attr_pre_copy_file, /* pre copy native value to file */
H5O__attr_shared_copy_file, /* copy native value to file */
H5O_attr_shared_post_copy_file, /* post copy native value to file */
H5O_attr_get_crt_index, /* get creation index */
H5O_attr_set_crt_index, /* set creation index */
H5O_attr_shared_debug /* debug the message */
H5O_ATTR_ID, /* message id number */
"attribute", /* message name for debugging */
sizeof(H5A_t), /* native message size */
H5O_SHARE_IS_SHARABLE, /* messages are sharable? */
H5O_attr_shared_decode, /* decode message */
H5O_attr_shared_encode, /* encode message */
H5O_attr_copy, /* copy the native value */
H5O_attr_shared_size, /* size of raw message */
H5O__attr_reset, /* reset method */
H5O__attr_free, /* free method */
H5O__attr_shared_delete, /* file delete method */
H5O__attr_shared_link, /* link method */
NULL, /* set share method */
NULL, /* can share method */
H5O_attr_pre_copy_file, /* pre copy native value to file */
H5O__attr_shared_copy_file, /* copy native value to file */
H5O_attr_shared_post_copy_file, /* post copy native value to file */
H5O_attr_get_crt_index, /* get creation index */
H5O_attr_set_crt_index, /* set creation index */
H5O_attr_shared_debug /* debug the message */
}};
/* Flags for attribute flag encoding */
@ -474,7 +474,7 @@ H5O_attr_size(const H5F_t H5_ATTR_UNUSED *f, const void *_mesg)
* Purpose: Frees resources within a attribute message, but doesn't free
* the message itself.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Tuesday, December 9, 1997
@ -491,11 +491,11 @@ H5O__attr_reset(void H5_ATTR_UNUSED *_mesg)
/*-------------------------------------------------------------------------
* Function: H5O__attr_free
* Function: H5O__attr_free
*
* Purpose: Frees the message
* Purpose: Frees the message
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, November 18, 2004
@ -525,7 +525,7 @@ done:
*
* Purpose: Free file space referenced by message
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Friday, September 26, 2003
@ -563,7 +563,7 @@ done:
* Purpose: Increment reference count on any objects referenced by
* message
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Friday, September 26, 2003
@ -604,9 +604,7 @@ done:
* Purpose: Perform any necessary actions before copying message between
* files for attribute messages.
*
* Return: Success: Non-negative
*
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, June 26, 2006
@ -628,7 +626,8 @@ H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *native_src,
HDassert(cpy_info->file_dst);
/* Check to ensure that the version of the message to be copied does not exceed
the message version allowed by the destination file's high bound */
* the message version allowed by the destination file's high bound.
*/
if(attr_src->shared->version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "attribute message version out of bounds")
@ -649,7 +648,6 @@ done:
* Purpose: Copies a message from _MESG to _DEST in file
*
* Return: Success: Ptr to _DEST
*
* Failure: NULL
*
* Programmer: Quincey Koziol
@ -695,7 +693,7 @@ done:
* an object may have a reference attribute that points to the
* object itself.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Peter Cao
* March 6, 2005
@ -719,12 +717,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O_attr_get_crt_index
* Function: H5O_attr_get_crt_index
*
* Purpose: Get creation index from the message
* Purpose: Get creation index from the message
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, January 18, 2007
@ -749,12 +746,11 @@ H5O_attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx /*out*/)
/*-------------------------------------------------------------------------
* Function: H5O_attr_set_crt_index
* Function: H5O_attr_set_crt_index
*
* Purpose: Set creation index from the message
* Purpose: Set creation index from the message
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, January 18, 2007

@ -13,11 +13,9 @@
/*-------------------------------------------------------------------------
*
* Created: H5Oattribute.c
* Dec 11 2006
* Quincey Koziol <koziol@hdfgroup.org>
* Created: H5Oattribute.c
*
* Purpose: Object header attribute routines.
* Purpose: Object header attribute routines.
*
*-------------------------------------------------------------------------
*/
@ -26,21 +24,21 @@
/* Module Setup */
/****************/
#define H5A_FRIEND /*suppress error about including H5Apkg */
#define H5A_FRIEND /* Suppress error about including H5Apkg.h */
#include "H5Omodule.h" /* This source code file is part of the H5O module */
/***********/
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Apkg.h" /* Attributes */
#include "H5Eprivate.h" /* Error handling */
#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object headers */
#include "H5SMprivate.h" /* Shared Object Header Messages */
#include "H5Iprivate.h" /* IDs */
#include "H5Fprivate.h" /* File */
#include "H5private.h" /* Generic Functions */
#include "H5Apkg.h" /* Attributes */
#include "H5Eprivate.h" /* Error handling */
#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object headers */
#include "H5SMprivate.h" /* Shared Object Header Messages */
#include "H5Iprivate.h" /* IDs */
#include "H5Fprivate.h" /* File */
/****************/
@ -129,8 +127,24 @@ typedef struct {
/********************/
/* Local Prototypes */
/********************/
static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr,
static herr_t H5O__attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg,
unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata);
static htri_t H5O__attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr,
const char* name_to_open);
static herr_t H5O__attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg, unsigned sequence,
unsigned H5_ATTR_UNUSED *oh_modified, void *_udata);
static herr_t H5O__attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr);
static herr_t H5O__attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg,
unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata);
static herr_t H5O__attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg,
unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata);
static herr_t H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg,
unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata);
static herr_t H5O__attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo);
static herr_t H5O__attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg,
unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata);
static herr_t H5O__attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg,
unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata);
/*********************/
/* Package Variables */
@ -149,12 +163,12 @@ static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr,
/*-------------------------------------------------------------------------
* Function: H5O_attr_to_dense_cb
* Function: H5O__attr_to_dense_cb
*
* Purpose: Object header iterator callback routine to convert compact
* Purpose: Object header iterator callback routine to convert compact
* attributes to dense attributes
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -163,14 +177,14 @@ static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr,
*-------------------------------------------------------------------------
*/
static herr_t
H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
H5O__attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_cvt_t *udata = (H5O_iter_cvt_t *)_udata; /* Operator user data */
H5A_t *attr = (H5A_t *)mesg->native; /* Pointer to attribute to insert */
herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_STATIC
/* check args */
HDassert(oh);
@ -186,7 +200,7 @@ H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
/* Convert message into a null message in the header */
/* (don't delete attribute's space in the file though) */
if(H5O_release_mesg(udata->f, oh, mesg, FALSE) < 0)
if(H5O__release_mesg(udata->f, oh, mesg, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message")
/* Indicate that the object header was modified */
@ -194,15 +208,15 @@ H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_to_dense_cb() */
} /* end H5O__attr_to_dense_cb() */
/*-------------------------------------------------------------------------
* Function: H5O__attr_create
* Function: H5O__attr_create
*
* Purpose: Create a new attribute in the object header.
* Purpose: Create a new attribute in the object header.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Friday, December 8, 2006
@ -283,7 +297,7 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr)
/* Iterate over existing attributes, moving them to dense storage */
op.op_type = H5O_MESG_OP_LIB;
op.u.lib_op = H5O_attr_to_dense_cb;
op.u.lib_op = H5O__attr_to_dense_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTCONVERT, FAIL, "error converting attributes to dense storage")
} /* end if */
@ -337,7 +351,8 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr)
/* Increment reference count for shared attribute object for the
* object handle created by the caller function H5A__create. The count
* for the cached object header has been incremented in the step above
* (in H5O__msg_append_real). The dense storage doesn't need a count. */
* (in H5O__msg_append_real). The dense storage doesn't need a count.
*/
attr->shared->nrefs += 1;
/* Was new attribute shared? */
@ -392,12 +407,12 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O_attr_open_cb
* Function: H5O__attr_open_cb
*
* Purpose: Object header iterator callback routine to open an
* Purpose: Object header iterator callback routine to open an
* attribute stored compactly.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -406,13 +421,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5O_attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
H5O__attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_opn_t *udata = (H5O_iter_opn_t *)_udata; /* Operator user data */
herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_STATIC
/* check args */
HDassert(oh);
@ -437,15 +452,15 @@ H5O_attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_open_cb() */
} /* end H5O__attr_open_cb() */
/*-------------------------------------------------------------------------
* Function: H5O__attr_open_by_name
* Function: H5O__attr_open_by_name
*
* Purpose: Open an existing attribute in an object header.
* Purpose: Open an existing attribute in an object header.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, December 11, 2006
@ -470,7 +485,7 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name)
/* Protect the object header to iterate over */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header")
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@ -483,7 +498,7 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name)
/* If found the attribute is already opened, make a copy of it to share the
* object information. If not, open attribute as a new object
*/
if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, name)) < 0)
if((found_open_attr = H5O__attr_find_opened_attr(loc, &exist_attr, name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "failed in finding opened attribute")
else if(found_open_attr == TRUE) {
if(NULL == (opened_attr = H5A__copy(NULL, exist_attr)))
@ -506,7 +521,7 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name)
/* Iterate over attributes, to locate correct one to open */
op.op_type = H5O_MESG_OP_LIB;
op.u.lib_op = H5O_attr_open_cb;
op.u.lib_op = H5O__attr_open_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "error updating attribute")
@ -541,12 +556,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O_attr_open_by_idx_cb
* Function: H5O__attr_open_by_idx_cb
*
* Purpose: Callback routine opening an attribute by index
* Purpose: Callback routine opening an attribute by index
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -555,12 +569,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5O_attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr)
H5O__attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr)
{
H5A_t **ret_attr = (H5A_t **)_ret_attr; /* 'User data' passed in */
herr_t ret_value = H5_ITER_STOP; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_STATIC
/* check arguments */
HDassert(attr);
@ -572,16 +586,16 @@ H5O_attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_open_by_idx_cb() */
} /* end H5O__attr_open_by_idx_cb() */
/*-------------------------------------------------------------------------
* Function: H5O__attr_open_by_idx
* Function: H5O__attr_open_by_idx
*
* Purpose: Open an existing attribute in an object header according to
* Purpose: Open an existing attribute in an object header according to
* an index.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, December 18, 2006
@ -605,7 +619,7 @@ H5O__attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
/* Build attribute operator info */
attr_op.op_type = H5A_ATTR_OP_LIB;
attr_op.u.lib_op = H5O_attr_open_by_idx_cb;
attr_op.u.lib_op = H5O__attr_open_by_idx_cb;
/* Iterate over attributes to locate correct one */
if(H5O_attr_iterate_real((hid_t)-1, loc, idx_type, order, n, NULL, &attr_op, &opened_attr) < 0)
@ -615,7 +629,7 @@ H5O__attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
* and make a copy of the already opened object to share the object info.
*/
if(opened_attr) {
if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, opened_attr->shared->name)) < 0)
if((found_open_attr = H5O__attr_find_opened_attr(loc, &exist_attr, opened_attr->shared->name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "failed in finding opened attribute")
/* If found that the attribute is already opened, make a copy of it
@ -647,12 +661,12 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O_attr_find_opened_attr
* Function: H5O__attr_find_opened_attr
*
* Purpose: Find out whether an attribute has been opened by giving
* Purpose: Find out whether an attribute has been opened by giving
* the name. Return the pointer to the object if found.
*
* Return: TRUE: found the already opened object
* Return: TRUE: found the already opened object
* FALSE: didn't find the opened object
* FAIL: function failed.
*
@ -662,14 +676,14 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_to_open)
H5O__attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_to_open)
{
hid_t *attr_id_list = NULL; /* List of IDs for opened attributes */
unsigned long loc_fnum; /* File serial # for object */
size_t num_open_attr; /* Number of opened attributes */
htri_t ret_value = FALSE; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_STATIC
/* Get file serial number for the location of attribute */
if(H5F_get_fileno(loc->file, &loc_fnum) < 0)
@ -691,8 +705,8 @@ H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_t
/* Retrieve the IDs of all opened attributes */
if(H5F_get_obj_ids(loc->file, H5F_OBJ_ATTR | H5F_OBJ_LOCAL, num_open_attr, attr_id_list, FALSE, &check_num_attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get IDs of opened attributes")
if(check_num_attr != num_open_attr)
HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "open attribute count mismatch")
if(check_num_attr != num_open_attr)
HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "open attribute count mismatch")
/* Iterate over the attributes */
for(u = 0; u < num_open_attr; u++) {
@ -724,15 +738,15 @@ done:
H5MM_free(attr_id_list);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_find_opened_attr */
} /* end H5O__attr_find_opened_attr() */
/*-------------------------------------------------------------------------
* Function: H5O__attr_update_shared
* Function: H5O__attr_update_shared
*
* Purpose: Update a shared attribute.
* Purpose: Update a shared attribute.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -802,25 +816,21 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O_attr_write_cb
* Function: H5O__attr_write_cb
*
* Purpose: Object header iterator callback routine to update an
* Purpose: Object header iterator callback routine to update an
* attribute stored compactly.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
* Dec 4 2006
*
* Modification:Raymond Lu
* 4 June 2008
* Took out the data copying part because the attribute data
* is shared between attribute handle and object header.
*-------------------------------------------------------------------------
*/
static herr_t
H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
H5O__attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_wrt_t *udata = (H5O_iter_wrt_t *)_udata; /* Operator user data */
@ -828,7 +838,7 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */
herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_STATIC
/* check args */
HDassert(oh);
@ -885,15 +895,15 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_write_cb() */
} /* end H5O__attr_write_cb() */
/*-------------------------------------------------------------------------
* Function: H5O__attr_write
* Function: H5O__attr_write
*
* Purpose: Write a new value to an attribute.
* Purpose: Write a new value to an attribute.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, December 4, 2006
@ -915,7 +925,7 @@ H5O__attr_write(const H5O_loc_t *loc, H5A_t *attr)
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@ -942,7 +952,7 @@ H5O__attr_write(const H5O_loc_t *loc, H5A_t *attr)
/* Iterate over attributes, to locate correct one to update */
op.op_type = H5O_MESG_OP_LIB;
op.u.lib_op = H5O_attr_write_cb;
op.u.lib_op = H5O__attr_write_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute")
@ -964,12 +974,12 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O_attr_rename_chk_cb
* Function: H5O__attr_rename_chk_cb
*
* Purpose: Object header iterator callback routine to check for
* Purpose: Object header iterator callback routine to check for
* duplicate name during rename
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -978,13 +988,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
H5O__attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_ren_t *udata = (H5O_iter_ren_t *)_udata; /* Operator user data */
herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_ENTER_STATIC_NOERR
/* check args */
HDassert(oh);
@ -1001,21 +1011,21 @@ H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_rename_chk_cb() */
} /* end H5O__attr_rename_chk_cb() */
/*-------------------------------------------------------------------------
* Function: H5O_attr_rename_mod_cb
* Function: H5O__attr_rename_mod_cb
*
* Purpose: Object header iterator callback routine to change name of
* Purpose: Object header iterator callback routine to change name of
* attribute during rename
*
* Note: This routine doesn't currently allow an attribute to change
* Note: This routine doesn't currently allow an attribute to change
* its "shared" status, if the name change would cause a size
* difference that would put it into a different category.
* Something for later...
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -1024,7 +1034,7 @@ H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
*-------------------------------------------------------------------------
*/
static herr_t
H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_ren_t *udata = (H5O_iter_ren_t *)_udata; /* Operator user data */
@ -1032,7 +1042,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */
herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_STATIC
/* check args */
HDassert(oh);
@ -1096,7 +1106,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
/* (doesn't decrement the link count on shared components because
* the "native" pointer has been reset)
*/
if(H5O_release_mesg(udata->f, oh, mesg, FALSE) < 0)
if(H5O__release_mesg(udata->f, oh, mesg, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to release previous attribute")
*oh_modified = H5O_MODIFY_CONDENSE;
@ -1130,15 +1140,15 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_rename_mod_cb() */
} /* end H5O__attr_rename_mod_cb() */
/*-------------------------------------------------------------------------
* Function: H5O__attr_rename
* Function: H5O__attr_rename
*
* Purpose: Rename an attribute.
* Purpose: Rename an attribute.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Tuesday, December 5, 2006
@ -1162,7 +1172,7 @@ H5O__attr_rename(const H5O_loc_t *loc, const char *old_name,
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@ -1190,7 +1200,7 @@ H5O__attr_rename(const H5O_loc_t *loc, const char *old_name,
/* Iterate over attributes, to check if "new name" exists already */
op.op_type = H5O_MESG_OP_LIB;
op.u.lib_op = H5O_attr_rename_chk_cb;
op.u.lib_op = H5O__attr_rename_chk_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute")
@ -1200,7 +1210,7 @@ H5O__attr_rename(const H5O_loc_t *loc, const char *old_name,
/* Iterate over attributes again, to actually rename attribute with old name */
op.op_type = H5O_MESG_OP_LIB;
op.u.lib_op = H5O_attr_rename_mod_cb;
op.u.lib_op = H5O__attr_rename_mod_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute")
@ -1218,15 +1228,15 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5O__attr_rename */
} /* end H5O__attr_rename() */
/*-------------------------------------------------------------------------
* Function: H5O_attr_iterate_real
* Function: H5O_attr_iterate_real
*
* Purpose: Internal routine to iterate over attributes for an object.
* Purpose: Internal routine to iterate over attributes for an object.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Tuesday, December 5, 2006
@ -1309,11 +1319,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O__attr_iterate
* Function: H5O__attr_iterate
*
* Purpose: Iterate over attributes for an object.
* Purpose: Iterate over attributes for an object.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Tuesday, December 5, 2006
@ -1322,8 +1332,7 @@ done:
*/
herr_t
H5O__attr_iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
hsize_t skip, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op,
void *op_data)
hsize_t skip, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, void *op_data)
{
H5G_loc_t loc; /* Object location */
herr_t ret_value = FAIL; /* Return value */
@ -1347,11 +1356,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O_attr_remove_update
* Function: H5O__attr_remove_update
*
* Purpose: Check for reverting from dense to compact attribute storage
* Purpose: Check for reverting from dense to compact attribute storage
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Wednesday, February 14, 2007
@ -1367,12 +1376,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo)
H5O__attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo)
{
H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_STATIC
/* Check arguments */
HDassert(loc);
@ -1427,7 +1436,7 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo)
/* Insert attribute message into object header (Will increment
reference count on shared attributes) */
/* Find out whether the attribute has been opened */
if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, (atable.attrs[u])->shared->name)) < 0)
if((found_open_attr = H5O__attr_find_opened_attr(loc, &exist_attr, (atable.attrs[u])->shared->name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "failed in finding opened attribute")
/* If found the attribute is already opened, use the opened message to insert.
@ -1450,7 +1459,8 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo)
/* Update the message after removing the attribute */
/* This is particularly needed when removing the last attribute that is
accessed via fractal heap/v2 B-tree (HDFFV-9277) */
* accessed via fractal heap/v2 B-tree (HDFFV-9277)
*/
if(H5O__msg_write_real(loc->file, oh, H5O_MSG_AINFO, H5O_MSG_FLAG_DONTSHARE, 0, ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info message")
@ -1468,16 +1478,16 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_remove_update() */
} /* end H5O__attr_remove_update() */
/*-------------------------------------------------------------------------
* Function: H5O_attr_remove_cb
* Function: H5O__attr_remove_cb
*
* Purpose: Object header iterator callback routine to remove an
* Purpose: Object header iterator callback routine to remove an
* attribute stored compactly.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -1486,13 +1496,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
H5O__attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */
herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_STATIC
/* check args */
HDassert(oh);
@ -1502,7 +1512,7 @@ H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
/* Check for correct attribute message to modify */
if(HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) {
/* Convert message into a null message (i.e. delete it) */
if(H5O_release_mesg(udata->f, oh, mesg, TRUE) < 0)
if(H5O__release_mesg(udata->f, oh, mesg, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message")
/* Indicate that the object header was modified */
@ -1517,15 +1527,15 @@ H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_remove_cb() */
} /* end H5O__attr_remove_cb() */
/*-------------------------------------------------------------------------
* Function: H5O__attr_remove
* Function: H5O__attr_remove
*
* Purpose: Delete an attribute on an object.
* Purpose: Delete an attribute on an object.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, December 11, 2006
@ -1548,7 +1558,7 @@ H5O__attr_remove(const H5O_loc_t *loc, const char *name)
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@ -1575,7 +1585,7 @@ H5O__attr_remove(const H5O_loc_t *loc, const char *name)
/* Iterate over attributes, to locate correct one to delete */
op.op_type = H5O_MESG_OP_LIB;
op.u.lib_op = H5O_attr_remove_cb;
op.u.lib_op = H5O__attr_remove_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "error deleting attribute")
@ -1586,7 +1596,7 @@ H5O__attr_remove(const H5O_loc_t *loc, const char *name)
/* Update the attribute information after removing an attribute */
if(ainfo_exists)
if(H5O_attr_remove_update(loc, oh, &ainfo) < 0)
if(H5O__attr_remove_update(loc, oh, &ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info")
/* Update the modification time, if any */
@ -1602,12 +1612,12 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O__attr_remove_by_idx
* Function: H5O__attr_remove_by_idx
*
* Purpose: Delete an attribute on an object, according to an order within
* an index.
* Purpose: Delete an attribute on an object, according to an order within
* an index.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Wednesday, February 14, 2007
@ -1631,7 +1641,7 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@ -1666,7 +1676,7 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
/* Iterate over attributes, to locate correct one to delete */
op.op_type = H5O_MESG_OP_LIB;
op.u.lib_op = H5O_attr_remove_cb;
op.u.lib_op = H5O__attr_remove_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "error deleting attribute")
@ -1677,7 +1687,7 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
/* Update the attribute information after removing an attribute */
if(ainfo_exists)
if(H5O_attr_remove_update(loc, oh, &ainfo) < 0)
if(H5O__attr_remove_update(loc, oh, &ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info")
/* Update the modification time, if any */
@ -1695,11 +1705,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O_attr_count_real
* Function: H5O__attr_count_real
*
* Purpose: Determine the # of attributes on an object
* Purpose: Determine the # of attributes on an object
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, March 9, 2007
@ -1707,11 +1717,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5O_attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs)
H5O__attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_TAG(oh->cache_info.addr)
FUNC_ENTER_PACKAGE_TAG(oh->cache_info.addr)
/* Check arguments */
HDassert(f);
@ -1745,16 +1755,16 @@ H5O_attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs)
done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5O_attr_count_real */
} /* end H5O__attr_count_real */
/*-------------------------------------------------------------------------
* Function: H5O_attr_exists_cb
* Function: H5O__attr_exists_cb
*
* Purpose: Object header iterator callback routine to check for an
* Purpose: Object header iterator callback routine to check for an
* attribute stored compactly, by name.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -1763,13 +1773,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5O_attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
H5O__attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */
herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_ENTER_STATIC_NOERR
/* check args */
HDassert(mesg);
@ -1785,15 +1795,15 @@ H5O_attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_exists_cb() */
} /* end H5O__attr_exists_cb() */
/*-------------------------------------------------------------------------
* Function: H5O__attr_exists
* Function: H5O__attr_exists
*
* Purpose: Determine if an attribute with a particular name exists on an object
* Purpose: Determine if an attribute with a particular name exists on an object
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, December 11, 2006
@ -1815,7 +1825,7 @@ H5O__attr_exists(const H5O_loc_t *loc, const char *name)
/* Protect the object header to iterate over */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@ -1842,7 +1852,7 @@ H5O__attr_exists(const H5O_loc_t *loc, const char *name)
/* Iterate over existing attributes, checking for attribute with same name */
op.op_type = H5O_MESG_OP_LIB;
op.u.lib_op = H5O_attr_exists_cb;
op.u.lib_op = H5O__attr_exists_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error checking for existence of attribute")
@ -1863,7 +1873,7 @@ done:
*
* Purpose: For 1.8 attribute, returns storage amount for btree and fractal heap
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Vailin Choi
* June 19, 2007
@ -1943,11 +1953,11 @@ done:
#ifndef H5_NO_DEPRECATED_SYMBOLS
/*-------------------------------------------------------------------------
* Function: H5O__attr_count
* Function: H5O__attr_count
*
* Purpose: Determine the # of attributes on an object
* Purpose: Determine the # of attributes on an object
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, December 11, 2006
@ -1968,10 +1978,10 @@ H5O__attr_count(const H5O_loc_t *loc)
/* Protect the object header to iterate over */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Retrieve # of attributes on object */
if(H5O_attr_count_real(loc->file, oh, &nattrs) < 0)
if(H5O__attr_count_real(loc->file, oh, &nattrs) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve attribute count")
/* Set return value */

@ -75,7 +75,7 @@ const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1] = {{
0, /*native message size */
0, /* messages are sharable? */
H5O__bogus_decode, /*decode message */
H5O__bogus_encode, /*encode message */
H5O_bogus_encode, /*encode message */
NULL, /*copy the native value */
H5O_bogus_size, /*raw message size */
NULL, /*free internal memory */

@ -437,7 +437,7 @@ H5O__cache_serialize(const H5F_t *f, void *image, size_t len, void *_thing)
HDassert(oh->cache_info.type == H5AC_OHDR);
HDassert(oh->chunk[0].size == len);
#ifdef H5O_DEBUG
H5O_assert(oh);
H5O__assert(oh);
#endif /* H5O_DEBUG */
/* Point to raw data 'image' for first chunk, which
@ -1430,9 +1430,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
/* Check for combining two adjacent 'null' messages */
if((udata->file_intent & H5F_ACC_RDWR) &&
H5O_NULL_ID == id && oh->nmesgs > 0 &&
H5O_NULL_ID == oh->mesg[oh->nmesgs - 1].type->id &&
oh->mesg[oh->nmesgs - 1].chunkno == chunkno) {
H5O_NULL_ID == id && oh->nmesgs > 0 &&
H5O_NULL_ID == oh->mesg[oh->nmesgs - 1].type->id &&
oh->mesg[oh->nmesgs - 1].chunkno == chunkno) {
size_t mesgno; /* Current message to operate on */
@ -1448,7 +1448,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
/* Check if we need to extend message table to hold the new message */
if(oh->nmesgs >= oh->alloc_nmesgs)
if(H5O_alloc_msgs(oh, (size_t)1) < 0)
if(H5O__alloc_msgs(oh, (size_t)1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "can't allocate more space for messages")
/* Get pointer to message to set up */
@ -1470,9 +1470,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
/* (Usually from future versions of the library) */
if(id >= H5O_UNKNOWN_ID ||
#ifdef H5O_ENABLE_BOGUS
id == H5O_BOGUS_VALID_ID ||
id == H5O_BOGUS_VALID_ID ||
#endif
NULL == H5O_msg_class_g[id]) {
NULL == H5O_msg_class_g[id]) {
H5O_unknown_t *unknown; /* Pointer to "unknown" message info */
@ -1491,9 +1491,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
/* Check for "fail if unknown" message flags */
if(((udata->file_intent & H5F_ACC_RDWR) &&
(flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE))
|| (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS))
HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "unknown message with 'fail if unknown' flag found")
(flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE))
|| (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS))
HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "unknown message with 'fail if unknown' flag found")
/* Check for "mark if unknown" message flag, etc. */
else if((flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN) &&
!(flags & H5O_MSG_FLAG_WAS_UNKNOWN) &&

@ -77,12 +77,11 @@ H5FL_DEFINE(H5O_chunk_proxy_t);
/*-------------------------------------------------------------------------
* Function: H5O__chunk_add
* Function: H5O__chunk_add
*
* Purpose: Add new chunk for object header to metadata cache
* Purpose: Add new chunk for object header to metadata cache
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -107,7 +106,7 @@ H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno)
/* Allocate space for the object header data structure */
if(NULL == (chk_proxy = H5FL_CALLOC(H5O_chunk_proxy_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Increment reference count on object header */
if(H5O__inc_rc(oh) < 0)
@ -128,6 +127,7 @@ H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno)
/* Insert the chunk proxy into the cache */
if(H5AC_insert_entry(f, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header chunk")
chk_proxy = NULL;
done:
@ -146,12 +146,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O__chunk_protect
* Function: H5O_chunk_protect
*
* Purpose: Protect an object header chunk for modifications
* Purpose: Protect an object header chunk for modifications
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -221,12 +220,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O__chunk_unprotect
* Function: H5O__chunk_unprotect
*
* Purpose: Unprotect an object header chunk after modifications
* Purpose: Unprotect an object header chunk after modifications
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -273,12 +271,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O_chunk_resize
* Function: H5O__chunk_resize
*
* Purpose: Resize an object header chunk
* Purpose: Resize an object header chunk
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -287,11 +284,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5O_chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy)
H5O__chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
FUNC_ENTER_PACKAGE
/* check args */
HDassert(oh);
@ -311,16 +308,15 @@ H5O_chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_chunk_resize() */
} /* end H5O__chunk_resize() */
/*-------------------------------------------------------------------------
* Function: H5O__chunk_update_idx
* Function: H5O__chunk_update_idx
*
* Purpose: Update the chunk index for a chunk proxy
* Purpose: Update the chunk index for a chunk proxy
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -367,12 +363,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O__chunk_delete
* Function: H5O__chunk_delete
*
* Purpose: Notify metadata cache that a chunk has been deleted
* Purpose: Notify metadata cache that a chunk has been deleted
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -413,12 +408,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O__chunk_dest
* Function: H5O__chunk_dest
*
* Purpose: Destroy a chunk proxy object
* Purpose: Destroy a chunk proxy object
*
* Return: Success: SUCCEED
* Failure: FAIL
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org

@ -36,10 +36,10 @@
/* PRIVATE PROTOTYPES */
static void *H5O_cont_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags,
static void *H5O__cont_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags,
unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_cont_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static size_t H5O_cont_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
static herr_t H5O__cont_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static size_t H5O__cont_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
static herr_t H5O__cont_free(void *mesg);
static herr_t H5O__cont_delete(H5F_t *f, H5O_t *open_oh, void *_mesg);
static herr_t H5O__cont_debug(H5F_t *f, const void *_mesg, FILE * stream,
@ -51,10 +51,10 @@ const H5O_msg_class_t H5O_MSG_CONT[1] = {{
"hdr continuation", /*message name for debugging */
sizeof(H5O_cont_t), /*native message size */
0, /* messages are sharable? */
H5O_cont_decode, /*decode message */
H5O_cont_encode, /*encode message */
H5O__cont_decode, /*decode message */
H5O__cont_encode, /*encode message */
NULL, /*no copy method */
H5O_cont_size, /*size of header continuation */
H5O__cont_size, /*size of header continuation */
NULL, /*reset method */
H5O__cont_free, /* free method */
H5O__cont_delete, /* file delete method */
@ -74,7 +74,7 @@ H5FL_DEFINE(H5O_cont_t);
/*-------------------------------------------------------------------------
* Function: H5O_cont_decode
* Function: H5O__cont_decode
*
* Purpose: Decode the raw header continuation message.
*
@ -89,14 +89,14 @@ H5FL_DEFINE(H5O_cont_t);
*-------------------------------------------------------------------------
*/
static void *
H5O_cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
H5O__cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_cont_t *cont = NULL;
void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_STATIC
/* check args */
HDassert(f);
@ -116,11 +116,11 @@ H5O_cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_cont_decode() */
} /* end H5O__cont_decode() */
/*-------------------------------------------------------------------------
* Function: H5O_cont_encode
* Function: H5O__cont_encode
*
* Purpose: Encodes a continuation message.
*
@ -133,11 +133,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5O_cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
H5O__cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
{
const H5O_cont_t *cont = (const H5O_cont_t *) _mesg;
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_ENTER_STATIC_NOERR
/* check args */
HDassert(f);
@ -151,11 +151,11 @@ H5O_cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con
H5F_ENCODE_LENGTH(f, p, cont->size);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_cont_encode() */
} /* end H5O__cont_encode() */
/*-------------------------------------------------------------------------
* Function: H5O_cont_size
* Function: H5O__cont_size
*
* Purpose: Returns the size of the raw message in bytes not counting
* the message type or size fields, but only the data fields.
@ -172,18 +172,18 @@ H5O_cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con
*-------------------------------------------------------------------------
*/
static size_t
H5O_cont_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg)
H5O__cont_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg)
{
size_t ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_ENTER_STATIC_NOERR
/* Set return value */
ret_value = (size_t)(H5F_SIZEOF_ADDR(f) + /* Continuation header address */
H5F_SIZEOF_SIZE(f)); /* Continuation header length */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_cont_size() */
} /* end H5O__cont_size() */
/*-------------------------------------------------------------------------
@ -256,8 +256,6 @@ done:
* matzke@llnl.gov
* Aug 6 1997
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static herr_t

@ -13,11 +13,9 @@
/*-------------------------------------------------------------------------
*
* Created: H5Ocopy.c
* Nov 6 2006
* Quincey Koziol <koziol@hdfgroup.org>
* Created: H5Ocopy.c
*
* Purpose: Object copying routines.
* Purpose: Object copying routines.
*
*-------------------------------------------------------------------------
*/
@ -32,19 +30,19 @@
/***********/
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Aprivate.h" /* Attributes */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free lists */
#include "H5Iprivate.h" /* IDs */
#include "H5HGprivate.h" /* Global Heaps */
#include "H5FOprivate.h" /* File objects */
#include "H5Lprivate.h" /* Links */
#include "H5MFprivate.h" /* File memory management */
#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object headers */
#include "H5Pprivate.h" /* Property lists */
#include "H5private.h" /* Generic Functions */
#include "H5Aprivate.h" /* Attributes */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free lists */
#include "H5Iprivate.h" /* IDs */
#include "H5HGprivate.h" /* Global Heaps */
#include "H5FOprivate.h" /* File objects */
#include "H5Lprivate.h" /* Links */
#include "H5MFprivate.h" /* File memory management */
#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object headers */
#include "H5Pprivate.h" /* Property lists */
/****************/
@ -79,8 +77,6 @@ typedef struct H5O_copy_search_comm_dt_ud_t {
/* Local Prototypes */
/********************/
static herr_t H5O__copy(const H5G_loc_t *loc, const char *src_name,
H5G_loc_t *dst_loc, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id);
static herr_t H5O__copy_free_addrmap_cb(void *item, void *key, void *op_data);
static herr_t H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
H5O_copy_t *cpy_info, H5O_type_t *obj_type, void **udata);
@ -240,7 +236,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Copy the object */
if(H5O__copy(&loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id) < 0)
if(H5O_copy(&loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
done:
@ -249,7 +245,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O__copy
* Function: H5O_copy
*
* Purpose: Private version of H5Ocopy
*
@ -260,8 +256,8 @@ done:
*
*-------------------------------------------------------------------------
*/
static herr_t
H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc,
herr_t
H5O_copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc,
const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id)
{
H5G_loc_t src_loc; /* Source object group location */
@ -272,7 +268,7 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc,
hbool_t obj_open = FALSE; /* Entry at 'name' found */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
FUNC_ENTER_NOAPI_NOINIT
/* Check arguments */
HDassert(loc);
@ -312,7 +308,7 @@ done:
HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__copy() */
} /* end H5O_copy() */
/*-------------------------------------------------------------------------
@ -431,7 +427,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
} /* end if */
/* Flush any dirty messages in source object header to update the header chunks */
if(H5O_flush_msgs(oloc_src->file, oh_src) < 0)
if(H5O__flush_msgs(oloc_src->file, oh_src) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object header messages")
/* Allocate the destination object header and fill in header fields */
@ -766,7 +762,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
/* Make sure we have enough space for new NULL message */
if(oh_dst->nmesgs + 1 > oh_dst->alloc_nmesgs)
if(H5O_alloc_msgs(oh_dst, (size_t)1) < 0)
if(H5O__alloc_msgs(oh_dst, (size_t)1) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
/* Create null message for [rest of] space in new chunk */
@ -1215,7 +1211,7 @@ H5O__copy_obj(H5G_loc_t *src_loc, H5G_loc_t *dst_loc, const char *dst_name,
/* Insert the new object in the destination file's group */
if(H5L_link(dst_loc, dst_name, &new_loc, lcpl_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert link")
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert link")
entry_inserted = TRUE;
done:
@ -1898,7 +1894,7 @@ H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src,
/* Traverse the destination file, adding committed datatypes to the skip
* list */
if(H5G_visit(H5F_FILE_ID(oloc_dst->file), "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5O__copy_search_comm_dt_cb, &udata) < 0)
if(H5G_visit(&dst_root_loc, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5O__copy_search_comm_dt_cb, &udata) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
cpy_info->dst_dt_list_complete = TRUE;
} /* end if */

@ -76,12 +76,12 @@
#ifdef H5O_DEBUG
/*-------------------------------------------------------------------------
* Function: H5O_assert
* Function: H5O__assert
*
* Purpose: Sanity check the information for an object header data
* Purpose: Sanity check the information for an object header data
* structure.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED (Doesn't fail, just crashes)
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@ -90,7 +90,7 @@
*-------------------------------------------------------------------------
*/
herr_t
H5O_assert(const H5O_t *oh)
H5O__assert(const H5O_t *oh)
{
H5O_mesg_t *curr_msg; /* Pointer to current message to examine */
H5O_mesg_t *tmp_msg; /* Pointer to temporary message to examine */
@ -101,7 +101,7 @@ H5O_assert(const H5O_t *oh)
size_t hdr_size; /* Size of header's chunks */
unsigned u, v; /* Local index variables */
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_ENTER_PACKAGE_NOERR
/* Initialize the tracking variables */
hdr_size = 0;
@ -223,7 +223,7 @@ H5O_assert(const H5O_t *oh)
HDassert(hdr_size == (free_space + meta_space + mesg_space));
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_assert() */
} /* end H5O__assert() */
#endif /* H5O_DEBUG */
@ -270,31 +270,27 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O_debug_real
* Function: H5O__debug_real
*
* Purpose: Prints debugging info about an object header.
* Purpose: Prints debugging info about an object header.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* matzke@llnl.gov
* Aug 6 1997
*
* Modifications:
* Feb. 2009: Vailin Choi
* Fixed bug in the accumulation of chunk_total
* Used the appropriate flag when printing creation order tracked/indexed
*-------------------------------------------------------------------------
*/
herr_t
H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth)
H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth)
{
size_t mesg_total = 0, chunk_total = 0, gap_total = 0;
unsigned *sequence = NULL;
unsigned i; /* Local index variable */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
FUNC_ENTER_PACKAGE
/* check args */
HDassert(f);
@ -323,16 +319,16 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int
/* Extra information for later versions */
if(oh->version > H5O_VERSION_1) {
/* Display object's status flags */
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Attribute creation order tracked:",
(oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) ? "Yes" : "No");
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Attribute creation order indexed:",
(oh->flags & H5O_HDR_ATTR_CRT_ORDER_INDEXED) ? "Yes" : "No");
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Attribute storage phase change values:",
(oh->flags & H5O_HDR_ATTR_STORE_PHASE_CHANGE) ? "Non-default" : "Default");
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Timestamps:",
(oh->flags & H5O_HDR_STORE_TIMES) ? "Enabled" : "Disabled");
if(oh->flags & ~H5O_HDR_ALL_FLAGS)
@ -385,14 +381,14 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int
for(i = 0, chunk_total = 0; i < oh->nchunks; i++) {
size_t chunk_size;
HDfprintf(stream, "%*sChunk %d...\n", indent, "", i);
HDfprintf(stream, "%*sChunk %d...\n", indent, "", i);
HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3),
HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3),
"Address:",
oh->chunk[i].addr);
/* Decrement chunk 0's size by the object header prefix size */
if(0 == i) {
if(0 == i) {
if(H5F_addr_ne(oh->chunk[i].addr, addr))
HDfprintf(stream, "*** WRONG ADDRESS FOR CHUNK #0!\n");
chunk_size = oh->chunk[i].size - (size_t)H5O_SIZEOF_HDR(oh);
@ -401,54 +397,53 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int
chunk_size = oh->chunk[i].size;
/* Accumulate chunk's size to total */
chunk_total += chunk_size;
gap_total += oh->chunk[i].gap;
chunk_total += chunk_size;
gap_total += oh->chunk[i].gap;
HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3),
HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3),
"Size in bytes:",
chunk_size);
HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3),
HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3),
"Gap:",
oh->chunk[i].gap);
} /* end for */
/* debug each message */
if(NULL == (sequence = (unsigned *)H5MM_calloc(NELMTS(H5O_msg_class_g) * sizeof(unsigned))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
for(i = 0, mesg_total = 0; i < oh->nmesgs; i++) {
const H5O_msg_class_t *debug_type; /* Type of message to use for callbacks */
unsigned chunkno; /* Chunk for message */
/* Accumulate message's size to total */
mesg_total += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[i].raw_size;
mesg_total += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[i].raw_size;
/* For version 2 object header, add size of "OCHK" for continuation chunk */
if (oh->mesg[i].type->id == H5O_CONT_ID)
mesg_total += H5O_SIZEOF_CHKHDR_OH(oh);
/* For version 2 object header, add size of "OCHK" for continuation chunk */
if(oh->mesg[i].type->id == H5O_CONT_ID)
mesg_total += H5O_SIZEOF_CHKHDR_OH(oh);
HDfprintf(stream, "%*sMessage %d...\n", indent, "", i);
HDfprintf(stream, "%*sMessage %d...\n", indent, "", i);
/* check for bad message id */
if(oh->mesg[i].type->id >= (int)NELMTS(H5O_msg_class_g)) {
HDfprintf(stream, "*** BAD MESSAGE ID 0x%04x\n",
oh->mesg[i].type->id);
continue;
} /* end if */
/* check for bad message id */
if(oh->mesg[i].type->id >= (int)NELMTS(H5O_msg_class_g)) {
HDfprintf(stream, "*** BAD MESSAGE ID 0x%04x\n", oh->mesg[i].type->id);
continue;
} /* end if */
/* message name and size */
HDfprintf(stream, "%*s%-*s 0x%04x `%s' (%d)\n",
/* message name and size */
HDfprintf(stream, "%*s%-*s 0x%04x `%s' (%d)\n",
indent + 3, "", MAX(0, fwidth - 3),
"Message ID (sequence number):",
(unsigned) (oh->mesg[i].type->id),
oh->mesg[i].type->name,
sequence[oh->mesg[i].type->id]++);
HDfprintf(stream, "%*s%-*s %t\n", indent + 3, "", MAX (0, fwidth - 3),
HDfprintf(stream, "%*s%-*s %t\n", indent + 3, "", MAX (0, fwidth - 3),
"Dirty:",
oh->mesg[i].dirty);
HDfprintf(stream, "%*s%-*s ", indent + 3, "", MAX (0, fwidth - 3),
"Message flags:");
if(oh->mesg[i].flags) {
if(oh->mesg[i].flags) {
hbool_t flag_printed = FALSE;
/* Sanity check that all flags in format are covered below */
@ -497,39 +492,40 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int
} /* end if */
else
HDfprintf(stream, "<none>\n");
HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", MAX(0, fwidth - 3),
HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", MAX(0, fwidth - 3),
"Chunk number:",
oh->mesg[i].chunkno);
chunkno = oh->mesg[i].chunkno;
if(chunkno >= oh->nchunks)
HDfprintf(stream, "*** BAD CHUNK NUMBER\n");
HDfprintf(stream, "%*s%-*s (%Zu, %Zu) bytes\n", indent + 3, "", MAX(0, fwidth - 3),
chunkno = oh->mesg[i].chunkno;
if(chunkno >= oh->nchunks)
HDfprintf(stream, "*** BAD CHUNK NUMBER\n");
HDfprintf(stream, "%*s%-*s (%Zu, %Zu) bytes\n", indent + 3, "", MAX(0, fwidth - 3),
"Raw message data (offset, size) in chunk:",
(size_t)(oh->mesg[i].raw - oh->chunk[chunkno].image),
oh->mesg[i].raw_size);
/* check the size */
if((oh->mesg[i].raw + oh->mesg[i].raw_size >
/* check the size */
if((oh->mesg[i].raw + oh->mesg[i].raw_size >
oh->chunk[chunkno].image + oh->chunk[chunkno].size) ||
(oh->mesg[i].raw < oh->chunk[chunkno].image))
HDfprintf(stream, "*** BAD MESSAGE RAW ADDRESS\n");
HDfprintf(stream, "*** BAD MESSAGE RAW ADDRESS\n");
/* decode the message */
debug_type = oh->mesg[i].type;
if(NULL == oh->mesg[i].native && debug_type->decode)
/* decode the message */
debug_type = oh->mesg[i].type;
if(NULL == oh->mesg[i].native && debug_type->decode)
H5O_LOAD_NATIVE(f, H5O_DECODEIO_NOCHANGE, oh, &oh->mesg[i], FAIL)
/* print the message */
HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
/* print the message */
HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
"Message Information:");
if(debug_type->debug && oh->mesg[i].native != NULL)
(debug_type->debug)(f, oh->mesg[i].native, stream, indent + 6, MAX(0, fwidth - 6));
else
HDfprintf(stream, "%*s<No info for this message>\n", indent + 6, "");
if(debug_type->debug && oh->mesg[i].native != NULL)
(debug_type->debug)(f, oh->mesg[i].native, stream, indent + 6, MAX(0, fwidth - 6));
else
HDfprintf(stream, "%*s<No info for this message>\n", indent + 6, "");
} /* end for */
if((mesg_total + gap_total) != chunk_total)
HDfprintf(stream, "*** TOTAL SIZE DOES NOT MATCH ALLOCATED SIZE!\n");
HDfprintf(stream, "*** TOTAL SIZE DOES NOT MATCH ALLOCATED SIZE!\n");
done:
/* Release resources */
@ -537,7 +533,7 @@ done:
sequence = (unsigned *)H5MM_xfree(sequence);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_debug_real() */
} /* end H5O__debug_real() */
/*-------------------------------------------------------------------------
@ -575,14 +571,15 @@ H5O_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth)
loc.holding_file = FALSE;
if(NULL == (oh = H5O_protect(&loc, H5AC__READ_ONLY_FLAG, FALSE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* debug */
H5O_debug_real(f, oh, addr, stream, indent, fwidth);
if(H5O__debug_real(f, oh, addr, stream, indent, fwidth) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "debug dump call failed")
done:
if(oh && H5O_unprotect(&loc, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_debug() */

@ -98,11 +98,11 @@ H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo)
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")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL")
/* Retrieve the object's information */
if(H5G_loc_info(&loc, ".", oinfo/*out*/, H5O_INFO_ALL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info")
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
done:
FUNC_LEAVE_API(ret_value)
@ -131,12 +131,14 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t la
/* 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(!name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
if(!*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
if(!oinfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL")
/* Verify access property list and set up collective metadata if appropriate */
/* 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")
@ -169,8 +171,6 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type,
{
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 */
@ -243,12 +243,15 @@ 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 */
H5G_loc_t loc;
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(H5G_loc(obj_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
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)
@ -256,8 +259,8 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
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)
/* Visit the objects */
if((ret_value = H5O__visit(&loc, ".", idx_type, order, op, op_data, H5O_INFO_ALL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
done:
@ -301,15 +304,20 @@ 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 */
H5G_loc_t loc;
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(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be NULL")
if(!*obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be an empty string")
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)
@ -321,8 +329,8 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
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)
/* Visit the objects */
if((ret_value = H5O__visit(&loc, obj_name, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
done:

@ -15,13 +15,13 @@
#define H5T_FRIEND /*prevent warning from including H5Tpkg */
#include "H5private.h" /* Generic Functions */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* Files */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Gprivate.h" /* Groups */
#include "H5MMprivate.h" /* Memory management */
#include "H5private.h" /* Generic Functions */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* Files */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Gprivate.h" /* Groups */
#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object headers */
#include "H5Tpkg.h" /* Datatypes */
#include "H5VMprivate.h" /* Vectors and arrays */

@ -754,8 +754,8 @@ H5O_fill_reset_dyn(H5O_fill_t *fill)
} /* end if */
fill->size = 0;
if(fill->type) {
(void)H5T_close_real(fill->type);
fill->type = NULL;
(void)H5T_close_real(fill->type);
fill->type = NULL;
} /* end if */
done:
@ -1008,7 +1008,7 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed)
* Can we convert between source and destination data types?
*/
if(NULL == (tpath = H5T_path_find(fill->type, dset_type)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes")
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes")
/* Don't bother doing anything if there will be no actual conversion */
if(!H5T_path_noop(tpath)) {

@ -41,11 +41,9 @@
#include "H5Iprivate.h" /* IDs */
#include "H5Opkg.h" /* Objects */
/********************/
/* Local Prototypes */
/********************/
static herr_t H5O__flush(hid_t obj_id);
static herr_t H5O__oh_tag(const H5O_loc_t *oloc, haddr_t *tag);
static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc,
H5G_loc_t *obj_loc);
@ -58,11 +56,11 @@ static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc,
/*-------------------------------------------------------------------------
* Function: H5Oflush
* Function: H5Oflush
*
* Purpose: Flushes all buffers associated with an object to disk.
* Purpose: Flushes all buffers associated with an object to disk.
*
* Return: Non-negative on success, negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Mike McGreevy
* May 19, 2010
@ -72,23 +70,71 @@ static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc,
herr_t
H5Oflush(hid_t obj_id)
{
herr_t ret_value = SUCCEED; /* Return value */
H5O_loc_t *oloc; /* Object location */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", obj_id);
/* Check args */
if(NULL == (oloc = H5O_get_loc(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(obj_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
/* Call internal routine */
if(H5O__flush(obj_id) < 0)
/* Flush the object */
if(H5O_flush(oloc, obj_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Oflush() */
/*-------------------------------------------------------------------------
* Function: H5O_flush
*
* Purpose: Internal routine to flush an object
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
* December 29, 2017
*
*-------------------------------------------------------------------------
*/
herr_t
H5O_flush(H5O_loc_t *oloc, hid_t obj_id)
{
void *obj_ptr; /* Pointer to object */
const H5O_obj_class_t *obj_class; /* Class of object */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Get the object pointer */
if(NULL == (obj_ptr = H5I_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Get the object class */
if(NULL == (obj_class = H5O__obj_class(oloc)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object class")
/* Flush the object of this class */
if(obj_class->flush && obj_class->flush(obj_ptr) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object")
/* Flush the object metadata and invoke flush callback */
if(H5O_flush_common(oloc, obj_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object and object flush callback")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_flush() */
/*-------------------------------------------------------------------------
* Function: H5O_flush_common
@ -120,60 +166,12 @@ H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id)
/* Check to invoke callback */
if(H5F_object_flush_cb(oloc->file, obj_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to do object flush callback")
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to do object flush callback")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_flush_common() */
/*-------------------------------------------------------------------------
* Function: H5O__flush
*
* Purpose: Internal routine to flush an object
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
* December 29, 2017
*
*-------------------------------------------------------------------------
*/
static herr_t
H5O__flush(hid_t obj_id)
{
H5O_loc_t *oloc; /* Object location */
void *obj_ptr; /* Pointer to object */
const H5O_obj_class_t *obj_class; /* Class of object */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Check args */
if(NULL == (oloc = H5O_get_loc(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object")
/* Get the object pointer */
if(NULL == (obj_ptr = H5I_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Get the object class */
if(NULL == (obj_class = H5O__obj_class(oloc)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object class")
/* Flush the object of this class */
if(obj_class->flush && obj_class->flush(obj_ptr) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object")
/* Flush the object metadata and invoke flush callback */
if(H5O_flush_common(oloc, obj_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object and object flush callback")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__flush() */
/*-------------------------------------------------------------------------
* Function: H5O__oh_tag
@ -219,9 +217,9 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Orefresh
*
* Purpose: Refreshes all buffers associated with an object.
* Purpose: Refreshes all buffers associated with an object.
*
* Return: Non-negative on success, negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Mike McGreevy
* July 28, 2010
@ -239,13 +237,13 @@ H5Orefresh(hid_t oid)
/* Check args */
if(NULL == (oloc = H5O_get_loc(oid)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(oid) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
/* Call internal routine */
/* Refresh the object */
if(H5O_refresh_metadata(oid, *oloc) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object")
@ -354,8 +352,8 @@ H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc)
/* Get object's type */
if(H5I_get_type(oid) == H5I_DATASET)
if(H5D_mult_refresh_close(oid) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset")
if(H5D_mult_refresh_close(oid) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset")
/* Retrieve tag for object */
if(H5O__oh_tag(&oloc, &tag) < 0)
@ -379,8 +377,8 @@ H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc)
/* Re-cork object with tag */
if(corked)
if(H5AC_cork(oloc.file, tag, H5AC__SET_CORK, &corked) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_SYSTEM, FAIL, "unable to cork the object")
if(H5AC_cork(oloc.file, tag, H5AC__SET_CORK, &corked) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_SYSTEM, FAIL, "unable to cork the object")
done:
FUNC_LEAVE_NOAPI(ret_value);
@ -404,12 +402,15 @@ done:
herr_t
H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr)
{
void *object = NULL; /* Dataset for this operation */
void *object = NULL; /* Object for this operation */
H5I_type_t type; /* Type of object for the ID */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(obj_loc);
/* Get object's type */
type = H5I_get_type(oid);
@ -455,7 +456,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr)
/* Re-register ID for the object */
if((H5I_register_with_id(type, object, TRUE, oid)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to re-register object atom")
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to re-register object ID after refresh")
done:
FUNC_LEAVE_NOAPI(ret_value);

@ -113,7 +113,7 @@ H5O_ginfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh,
/* Allocate space for message */
if(NULL == (ginfo = H5FL_CALLOC(H5O_ginfo_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Get the flags for the group */
flags = *p++;
@ -231,7 +231,7 @@ H5O_ginfo_copy(const void *_mesg, void *_dest)
/* check args */
HDassert(ginfo);
if(!dest && NULL == (dest = H5FL_MALLOC(H5O_ginfo_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* copy */
*dest = *ginfo;

@ -42,7 +42,6 @@
#include "H5MMprivate.h" /* Memory management */
#endif /* H5O_ENABLE_BOGUS */
#include "H5Opkg.h" /* Object headers */
#include "H5SMprivate.h" /* Shared object header messages */
/****************/
@ -514,12 +513,12 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O_open_name
* Function: H5O_open_name
*
* Purpose: Opens an object within an HDF5 file.
* Purpose: Opens an object within an HDF5 file.
*
* Return: Success: An open object identifier
* Failure: Negative
* Return: Success: Open object identifier
* Failure: H5I_INVALID_HID
*
* Programmer: Quincey Koziol
* March 5 2007
@ -552,7 +551,7 @@ H5O_open_name(const H5G_loc_t *loc, const char *name, hbool_t app_ref)
loc_found = TRUE;
/* Open the object */
if((ret_value = H5O__open_by_loc(&obj_loc, app_ref)) < 0)
if((ret_value = H5O_open_by_loc(&obj_loc, app_ref)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
done:
@ -565,12 +564,12 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O__open_by_idx
* Function: H5O_open_by_idx
*
* Purpose: Internal routine to open an object by index within group
*
* Return: Success: Non-negative
* Failure: Negative
* Return: Success: Open object identifier
* Failure: H5I_INVALID_HID
*
* Programmer: Quincey Koziol
* December 28, 2017
@ -578,7 +577,7 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
H5O_open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n)
{
H5G_loc_t obj_loc; /* Location used to open group */
@ -587,7 +586,7 @@ H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
hbool_t loc_found = FALSE; /* Entry at 'name' found */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_PACKAGE
FUNC_ENTER_NOAPI(H5I_INVALID_HID)
/* Check arguments */
HDassert(loc);
@ -603,7 +602,7 @@ H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
loc_found = TRUE;
/* Open the object */
if((ret_value = H5O__open_by_loc(&obj_loc, TRUE)) < 0)
if((ret_value = H5O_open_by_loc(&obj_loc, TRUE)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
done:
@ -613,16 +612,16 @@ done:
HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5I_INVALID_HID, "can't free location")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__open_by_idx() */
} /* end H5O_open_by_idx() */
/*-------------------------------------------------------------------------
* Function: H5O__open_by_addr
* Function: H5O_open_by_addr
*
* Purpose: Internal routine to open an object by its address
*
* Return: Success: Non-negative
* Failure: Negative
* Return: Success: Open object identifier
* Failure: H5I_INVALID_HID
*
* Programmer: Quincey Koziol
* December 28, 2017
@ -630,14 +629,14 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr)
H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr)
{
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 */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_PACKAGE
FUNC_ENTER_NOAPI(H5I_INVALID_HID)
/* Check arguments */
HDassert(loc);
@ -651,21 +650,21 @@ H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr)
H5G_name_reset(obj_loc.path); /* objects opened through this routine don't have a path name */
/* Open the object */
if((ret_value = H5O__open_by_loc(&obj_loc, TRUE)) < 0)
if((ret_value = H5O_open_by_loc(&obj_loc, TRUE)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__open_by_addr() */
} /* end H5O_open_by_addr() */
/*-------------------------------------------------------------------------
* Function: H5O__open_by_loc
* Function: H5O_open_by_loc
*
* Purpose: Opens an object and returns an ID given its group loction.
* Purpose: Opens an object and returns an ID given its group loction.
*
* Return: Success: Open object identifier
* Failure: Negative
* Return: Success: Open object identifier
* Failure: H5I_INVALID_HID
*
* Programmer: James Laird
* July 25 2006
@ -673,12 +672,12 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
H5O__open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref)
H5O_open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref)
{
const H5O_obj_class_t *obj_class; /* Class of object for location */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_PACKAGE
FUNC_ENTER_NOAPI(H5I_INVALID_HID)
HDassert(obj_loc);
@ -693,7 +692,7 @@ H5O__open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__open_by_loc() */
} /* end H5O_open_by_loc() */
/*-------------------------------------------------------------------------
@ -735,10 +734,9 @@ H5O_close(H5O_loc_t *loc, hbool_t *file_closed /*out*/)
#ifdef H5O_DEBUG
if(H5DEBUG(O)) {
if(H5F_FILE_ID(loc->file)< 0 && 1 == H5F_NREFS(loc->file))
HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n",
loc->addr, (unsigned long)H5F_NOPEN_OBJS(loc->file));
else
HDfprintf(H5DEBUG(O), "< %a\n", loc->addr);
HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n", loc->addr, (unsigned long)H5F_NOPEN_OBJS(loc->file));
else
HDfprintf(H5DEBUG(O), "< %a\n", loc->addr);
}
#endif
@ -761,14 +759,14 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O__link_oh
* Function: H5O__link_oh
*
* Purpose: Adjust the link count for an open object header by adding
* ADJUST to the link count.
* Purpose: Adjust the link count for an open object header by adding
* ADJUST to the link count.
*
* Return: Success: New link count
* Return: Success: New link count
*
* Failure: Negative
* Failure: -1
*
* Programmer: Robb Matzke
* matzke@llnl.gov
@ -794,14 +792,14 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
if(adjust < 0) {
/* Check for too large of an adjustment */
if((unsigned)(-adjust) > oh->nlink)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "link count would be negative")
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, (-1), "link count would be negative")
/* Adjust the link count for the object header */
oh->nlink = (unsigned)((int)oh->nlink + adjust);
/* Mark object header as dirty in cache */
if(H5AC_mark_entry_dirty(oh) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, (-1), "unable to mark object header as dirty")
/* Check if the object should be deleted */
if(oh->nlink == 0) {
@ -809,7 +807,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
if(H5FO_opened(f, addr) != NULL) {
/* Flag the object to be deleted when it's closed */
if(H5FO_mark(f, addr, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't mark object for deletion")
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "can't mark object for deletion")
} /* end if */
else {
/* Mark the object header for deletion */
@ -824,7 +822,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
if(H5FO_marked(f, addr)) {
/* Remove "delete me" flag on the object */
if(H5FO_mark(f, addr, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't mark object for deletion")
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "can't mark object for deletion")
} /* end if */
} /* end if */
@ -833,7 +831,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
/* Mark object header as dirty in cache */
if(H5AC_mark_entry_dirty(oh) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, (-1), "unable to mark object header as dirty")
} /* end if */
/* Check for operations on refcount message */
@ -843,7 +841,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
/* Check for removing refcount message */
if(oh->nlink <= 1) {
if(H5O__msg_remove_real(f, oh, H5O_MSG_REFCOUNT, H5O_ALL, NULL, NULL, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete refcount message")
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "unable to delete refcount message")
oh->has_refcount_msg = FALSE;
} /* end if */
/* Update refcount message with new link count */
@ -851,7 +849,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
H5O_refcount_t refcount = oh->nlink;
if(H5O__msg_write_real(f, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update refcount message")
HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, (-1), "unable to update refcount message")
} /* end else */
} /* end if */
else {
@ -860,7 +858,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
H5O_refcount_t refcount = oh->nlink;
if(H5O__msg_append_real(f, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to create new refcount message")
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, (-1), "unable to create new refcount message")
oh->has_refcount_msg = TRUE;
} /* end if */
} /* end else */
@ -1061,7 +1059,7 @@ H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks)
} /* end if */
#ifdef H5O_DEBUG
H5O_assert(oh);
H5O__assert(oh);
#endif /* H5O_DEBUG */
/* Pin the other chunks also when requested, so that the object header
@ -1325,8 +1323,9 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force)
chk_dirtied = TRUE;
} /* end if */
else {
/* XXX: For now, update access time & change fields in the object header */
/* (will need to add some code to update modification time appropriately) */
/* XXX: For now, update access time & change fields in the object header
* (will need to add some code to update modification time appropriately)
*/
oh->atime = oh->ctime = now;
/* Mark object header as dirty in cache */
@ -1426,25 +1425,25 @@ H5O_bogus_oh(H5F_t *f, H5O_t *oh, unsigned bogus_id, unsigned mesg_flags)
H5O_bogus_t *bogus; /* Pointer to the bogus information */
/* Allocate the native message in memory */
if(NULL == (bogus = H5MM_malloc(sizeof(H5O_bogus_t))))
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for 'bogus' message")
if(NULL == (bogus = H5MM_malloc(sizeof(H5O_bogus_t))))
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for 'bogus' message")
/* Update the native value */
bogus->u = H5O_BOGUS_VALUE;
if(bogus_id == H5O_BOGUS_VALID_ID)
type = H5O_MSG_BOGUS_VALID;
else if(bogus_id == H5O_BOGUS_INVALID_ID)
type = H5O_MSG_BOGUS_INVALID;
else
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID for 'bogus' message")
if(bogus_id == H5O_BOGUS_VALID_ID)
type = H5O_MSG_BOGUS_VALID;
else if(bogus_id == H5O_BOGUS_INVALID_ID)
type = H5O_MSG_BOGUS_INVALID;
else
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID for 'bogus' message")
/* Allocate space in the object header for bogus message */
if(H5O__msg_alloc(f, oh, type, &mesg_flags, bogus, &idx) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message")
if(H5O__msg_alloc(f, oh, type, &mesg_flags, bogus, &idx) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message")
/* Point to "bogus" information (take it over) */
oh->mesg[idx].native = bogus;
oh->mesg[idx].native = bogus;
/* Set the appropriate flags for the message */
oh->mesg[idx].flags = mesg_flags;
@ -1634,23 +1633,23 @@ H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type)
/* Set type to "unknown" */
*obj_type = H5O_TYPE_UNKNOWN;
} /* end if */
}
else {
/* Set object type */
*obj_type = obj_class->type;
} /* end else */
}
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O__obj_type_real() */
/*-------------------------------------------------------------------------
* Function: H5O__obj_class
* Function: H5O__obj_class
*
* Purpose: Returns the class of object pointed to by `loc'.
* Purpose: Returns the class of object pointed to by 'loc'.
*
* Return: Success: An object class
* Failure: NULL
* Return: Success: An object class
* Failure: NULL
*
* Programmer: Quincey Koziol
* Monday, November 6, 2006
@ -1663,7 +1662,7 @@ H5O__obj_class(const H5O_loc_t *loc)
H5O_t *oh = NULL; /* Object header for location */
const H5O_obj_class_t *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC_TAG(loc->addr)
FUNC_ENTER_PACKAGE_TAG(loc->addr)
/* Load the object header */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
@ -1675,7 +1674,7 @@ H5O__obj_class(const H5O_loc_t *loc)
done:
if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5O__obj_class() */
@ -1714,7 +1713,7 @@ H5O__obj_class_real(const H5O_t *oh)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type")
else if(isa)
HGOTO_DONE(H5O_obj_class_g[i - 1])
} /* end for */
}
if(0 == i)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type")
@ -2164,7 +2163,7 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields)
/* Retrieve # of attributes */
if(fields & H5O_INFO_NUM_ATTRS)
if(H5O_attr_count_real(loc->file, oh, &oinfo->num_attrs) < 0)
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 */
@ -2580,7 +2579,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O__visit
* Function: H5O__visit
*
* Purpose: Recursively visit an object and all the objects reachable
* from it. If the starting object is a group, all the objects
@ -2601,12 +2600,12 @@ done:
* 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.
* 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.
* library, or the negative value returned by one
* of the operators.
*
* Programmer: Quincey Koziol
* November 24 2007
@ -2614,17 +2613,16 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
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 */
H5G_loc_t obj_loc; /* Location used to open object */
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 */
H5O_info_t oinfo; /* Object info struct */
hid_t obj_id = (-1); /* ID of object */
hid_t obj_id = H5I_INVALID_HID; /* ID of object */
herr_t ret_value = FAIL; /* Return value */
FUNC_ENTER_PACKAGE
@ -2633,8 +2631,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HDmemset(&udata, 0, sizeof(udata));
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
HDassert(loc);
/* Set up opened group location to fill in */
obj_loc.oloc = &obj_oloc;
@ -2642,7 +2639,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
H5G_loc_reset(&obj_loc);
/* Find the object's location */
if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/) < 0)
if(H5G_loc_find(loc, obj_name, &obj_loc/*out*/) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
loc_found = TRUE;
@ -2652,7 +2649,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* Open the object */
/* (Takes ownership of the obj_loc information) */
if((obj_id = H5O__open_by_loc(&obj_loc, TRUE)) < 0)
if((obj_id = H5O_open_by_loc(&obj_loc, TRUE)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
/* Make callback for starting object */
@ -2698,20 +2695,21 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* Add to list of visited objects */
if(H5SL_insert(udata.visited, obj_pos, obj_pos) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object node into visited list")
} /* end if */
}
/* Call internal group visitation routine */
if((ret_value = H5G_visit(obj_id, ".", idx_type, order, H5O__visit_cb, &udata)) < 0)
if((ret_value = H5G_visit(&start_loc, ".", idx_type, order, H5O__visit_cb, &udata)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
} /* end if */
done:
if(obj_id > 0) {
if(obj_id != H5I_INVALID_HID) {
if(H5I_dec_app_ref(obj_id) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object")
} /* end if */
}
else if(loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
if(udata.visited)
H5SL_destroy(udata.visited, H5O__free_visit_visited, NULL);

@ -44,13 +44,13 @@ static size_t H5O_linfo_size(const H5F_t *f, hbool_t disable_shared, const void
static herr_t H5O__linfo_free(void *_mesg);
static herr_t H5O__linfo_delete(H5F_t *f, H5O_t *open_oh, void *_mesg);
static void *H5O__linfo_copy_file(H5F_t *file_src, void *native_src,
H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags,
H5O_copy_t *cpy_info, void *udata);
H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags,
H5O_copy_t *cpy_info, void *udata);
static herr_t H5O__linfo_post_copy_file(const H5O_loc_t *parent_src_oloc,
const void *mesg_src, H5O_loc_t *dst_oloc, void *mesg_dst,
unsigned *mesg_flags, H5O_copy_t *cpy_info);
static herr_t H5O__linfo_debug(H5F_t *f, const void *_mesg,
FILE * stream, int indent, int fwidth);
const void *mesg_src, H5O_loc_t *dst_oloc, void *mesg_dst,
unsigned *mesg_flags, H5O_copy_t *cpy_info);
static herr_t H5O__linfo_debug(H5F_t *f, const void *_mesg, FILE * stream,
int indent, int fwidth);
/* This message derives from H5O message class */
const H5O_msg_class_t H5O_MSG_LINFO[1] = {{

@ -127,11 +127,11 @@ H5O_msg_create(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags,
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Go append message to object header */
if(H5O_msg_append_oh(loc->file, oh, type_id, mesg_flags, update_flags, mesg) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header")
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header")
done:
if(oh && H5O_unpin(oh) < 0)
@ -225,7 +225,7 @@ H5O__msg_append_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
if(H5O__copy_mesg(f, oh, idx, type, mesg, mesg_flags, update_flags) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to write message")
#ifdef H5O_DEBUG
H5O_assert(oh);
H5O__assert(oh);
#endif /* H5O_DEBUG */
done:
@ -276,7 +276,7 @@ H5O_msg_write(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags,
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Call the "real" modify routine */
if(H5O__msg_write_real(loc->file, oh, type, mesg_flags, update_flags, mesg) < 0)
@ -384,7 +384,7 @@ H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
/* Check for modifying a constant message */
if(!(update_flags & H5O_UPDATE_FORCE) && (idx_msg->flags & H5O_MSG_FLAG_CONSTANT))
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to modify constant message")
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to modify constant message")
/* This message is shared, but it's being modified. */
else if((idx_msg->flags & H5O_MSG_FLAG_SHARED) || (idx_msg->flags & H5O_MSG_FLAG_SHAREABLE)) {
htri_t status; /* Status of "try share" call */
@ -427,7 +427,7 @@ H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
if(H5O__copy_mesg(f, oh, idx, type, mesg, mesg_flags, update_flags) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to write message")
#ifdef H5O_DEBUG
H5O_assert(oh);
H5O__assert(oh);
#endif /* H5O_DEBUG */
done:
@ -474,15 +474,15 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg)
/* Get the object header */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header")
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header")
/* Call the "real" read routine */
if(NULL == (ret_value = H5O_msg_read_oh(loc->file, oh, type_id, mesg)))
HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header message")
HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header message")
done:
if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5O_msg_read() */
@ -616,12 +616,12 @@ H5O__msg_reset_real(const H5O_msg_class_t *type, void *native)
HDassert(type);
if(native) {
if(type->reset) {
if((type->reset)(native) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "reset method failed")
} /* end if */
if(type->reset) {
if((type->reset)(native) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "reset method failed")
} /* end if */
else
HDmemset(native, 0, type->native_size);
HDmemset(native, 0, type->native_size);
} /* end if */
done:
@ -658,7 +658,7 @@ H5O_msg_free(unsigned type_id, void *mesg)
HDassert(type);
/* Call the "real" free routine */
ret_value = H5O__msg_free_real(type, mesg);
ret_value = H5O_msg_free_real(type, mesg);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_free() */
@ -667,7 +667,7 @@ H5O_msg_free(unsigned type_id, void *mesg)
/*-------------------------------------------------------------------------
* Function: H5O__msg_free_mesg
*
* Purpose: Call H5O__msg_free_real() on a message.
* Purpose: Call H5O_msg_free_real() on a message.
*
* Return: Non-negative on success/Negative on failure
*
@ -685,14 +685,14 @@ H5O__msg_free_mesg(H5O_mesg_t *mesg)
HDassert(mesg);
/* Free any native information */
mesg->native = H5O__msg_free_real(mesg->type, mesg->native);
mesg->native = H5O_msg_free_real(mesg->type, mesg->native);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O__msg_free_mesg() */
/*-------------------------------------------------------------------------
* Function: H5O__msg_free_real
* Function: H5O_msg_free_real
*
* Purpose: Similar to H5O_msg_reset() except it also frees the message
* pointer.
@ -706,9 +706,9 @@ H5O__msg_free_mesg(H5O_mesg_t *mesg)
*-------------------------------------------------------------------------
*/
void *
H5O__msg_free_real(const H5O_msg_class_t *type, void *msg_native)
H5O_msg_free_real(const H5O_msg_class_t *type, void *msg_native)
{
FUNC_ENTER_PACKAGE_NOERR
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* check args */
HDassert(type);
@ -722,7 +722,7 @@ H5O__msg_free_real(const H5O_msg_class_t *type, void *msg_native)
} /* end if */
FUNC_LEAVE_NOAPI(NULL)
} /* end H5O__msg_free_real() */
} /* end H5O_msg_free_real() */
/*-------------------------------------------------------------------------
@ -798,22 +798,22 @@ H5O_msg_count(const H5O_loc_t *loc, unsigned type_id)
/* Load the object header */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header")
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header")
/* Count the messages of the correct type */
msg_count = H5O_msg_count_real(oh, type);
msg_count = H5O__msg_count_real(oh, type);
H5_CHECKED_ASSIGN(ret_value, int, msg_count, unsigned);
done:
if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_count() */
/*-------------------------------------------------------------------------
* Function: H5O_msg_count_real
* Function: H5O__msg_count_real
*
* Purpose: Counts the number of messages in an object header which are a
* certain type.
@ -828,12 +828,12 @@ done:
*-------------------------------------------------------------------------
*/
unsigned
H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type)
H5O__msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type)
{
unsigned u; /* Local index variable */
unsigned ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_ENTER_PACKAGE_NOERR
/* Check args */
HDassert(oh);
@ -841,11 +841,11 @@ H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type)
/* Loop over all messages, counting the ones of the type looked for */
for(u = ret_value = 0; u < oh->nmesgs; u++)
if(oh->mesg[u].type == type)
if(oh->mesg[u].type == type)
ret_value++;
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_count_real() */
} /* end H5O__msg_count_real() */
/*-------------------------------------------------------------------------
@ -976,11 +976,11 @@ H5O_msg_remove(const H5O_loc_t *loc, unsigned type_id, int sequence, hbool_t adj
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Call the "real" remove routine */
if((ret_value = H5O__msg_remove_real(loc->file, oh, type, sequence, NULL, NULL, adj_link)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message")
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message")
done:
if(oh && H5O_unpin(oh) < 0)
@ -1028,11 +1028,11 @@ H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence,
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Call the "real" remove routine */
if((ret_value = H5O__msg_remove_real(loc->file, oh, type, sequence, op, op_data, adj_link)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message")
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message")
done:
if(oh && H5O_unpin(oh) < 0)
@ -1090,7 +1090,7 @@ H5O__msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
* (OK to remove constant messages - QAK)
*/
/* Convert message into a null message */
if(H5O_release_mesg(udata->f, oh, mesg, udata->adj_link) < 0)
if(H5O__release_mesg(udata->f, oh, mesg, udata->adj_link) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to release message")
/* Indicate that the object header was modified */
@ -1315,8 +1315,8 @@ done:
* message removal)
*/
if(oh_modified & H5O_MODIFY_CONDENSE)
if(H5O_condense_header(f, oh) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack object header")
if(H5O__condense_header(f, oh) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack object header")
/* Mark object header as changed */
if(H5O_touch_oh(f, oh, FALSE) < 0)
@ -1973,7 +1973,7 @@ H5O__copy_mesg(H5F_t *f, H5O_t *oh, size_t idx, const H5O_msg_class_t *type,
/* Protect chunk */
if(NULL == (chk_proxy = H5O__chunk_protect(f, oh, idx_msg->chunkno)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk")
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk")
/* Reset existing native information for the header's message */
H5O__msg_reset_real(type, idx_msg->native);
@ -1991,7 +1991,7 @@ H5O__copy_mesg(H5F_t *f, H5O_t *oh, size_t idx, const H5O_msg_class_t *type,
/* Release chunk */
if(H5O__chunk_unprotect(f, chk_proxy, chk_dirtied) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk")
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk")
chk_proxy = NULL;
/* Update the modification time, if requested */
@ -2197,7 +2197,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O_flush_msgs
* Function: H5O__flush_msgs
*
* Purpose: Flushes messages for object header.
*
@ -2210,13 +2210,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5O_flush_msgs(H5F_t *f, H5O_t *oh)
H5O__flush_msgs(H5F_t *f, H5O_t *oh)
{
H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
FUNC_ENTER_PACKAGE
/* check args */
HDassert(f);
@ -2240,7 +2240,7 @@ H5O_flush_msgs(H5F_t *f, H5O_t *oh)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_flush_msgs() */
} /* end H5O__flush_msgs() */
/*-------------------------------------------------------------------------

@ -442,8 +442,6 @@ H5O__mtime_free(void *mesg)
* matzke@llnl.gov
* Jul 24 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static herr_t
@ -454,7 +452,7 @@ H5O__mtime_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream,
struct tm *tm;
char buf[128];
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_ENTER_STATIC_NOERR
/* check args */
HDassert(f);

@ -63,7 +63,7 @@
)
#define H5O_ALIGN_OH(O, X) \
H5O_ALIGN_VERS((O)->version, X)
#define H5O_ALIGN_F(F, X) \
#define H5O_ALIGN_F(F, X) \
H5O_ALIGN_VERS(MAX(H5O_VERSION_1, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(F)]), X)
/* Size of checksum (on disk) */
@ -555,15 +555,11 @@ H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATASET[1];
H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1];
/* Package-local function prototypes */
H5_DLL hid_t H5O__open_by_idx(const H5G_loc_t *loc, const char *name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
H5_DLL hid_t H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr);
H5_DLL hid_t H5O__open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref);
H5_DLL const H5O_obj_class_t *H5O__obj_class(const H5O_loc_t *loc);
H5_DLL int H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted);
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, unsigned fields);
H5_DLL herr_t H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
H5_DLL herr_t H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
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);
@ -576,9 +572,8 @@ H5_DLL herr_t H5O__msg_append_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *t
unsigned mesg_flags, unsigned update_flags, void *mesg);
H5_DLL herr_t H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
unsigned mesg_flags, unsigned update_flags, void *mesg);
H5_DLL void *H5O__msg_free_real(const H5O_msg_class_t *type, void *mesg);
H5_DLL herr_t H5O__msg_free_mesg(H5O_mesg_t *mesg);
H5_DLL unsigned H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type);
H5_DLL unsigned H5O__msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type);
H5_DLL herr_t H5O__msg_remove_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
int sequence, H5O_operator_t op, void *op_data, hbool_t adj_link);
H5_DLL void *H5O__msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src,
@ -586,17 +581,15 @@ H5_DLL void *H5O__msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src,
unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata);
H5_DLL herr_t H5O__msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
const H5O_mesg_operator_t *op, void *op_data);
H5_DLL herr_t H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg);
H5_DLL herr_t H5O_flush_msgs(H5F_t *f, H5O_t *oh);
H5_DLL herr_t H5O__flush_msgs(H5F_t *f, H5O_t *oh);
H5_DLL herr_t H5O__delete_mesg(H5F_t *f, H5O_t *open_oh, H5O_mesg_t *mesg);
/* Object header chunk routines */
H5_DLL herr_t H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno);
H5_DLL H5O_chunk_proxy_t *H5O__chunk_protect(H5F_t *f, H5O_t *oh, unsigned idx);
H5_DLL herr_t H5O__chunk_unprotect(H5F_t *f, H5O_chunk_proxy_t *chk_proxy,
hbool_t chk_dirtied);
H5_DLL herr_t H5O__chunk_unprotect(H5F_t *f, H5O_chunk_proxy_t *chk_proxy, hbool_t chk_dirtied);
H5_DLL herr_t H5O__chunk_update_idx(H5F_t *f, H5O_t *oh, unsigned idx);
H5_DLL herr_t H5O_chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy);
H5_DLL herr_t H5O__chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy);
H5_DLL herr_t H5O__chunk_delete(H5F_t *f, H5O_t *oh, unsigned idx);
H5_DLL herr_t H5O__chunk_dest(H5O_chunk_proxy_t *chunk_proxy);
@ -604,20 +597,20 @@ H5_DLL herr_t H5O__chunk_dest(H5O_chunk_proxy_t *chunk_proxy);
H5_DLL herr_t H5O__attr_bh_info(H5F_t *f, H5O_t *oh, H5_ih_info_t *bh_info);
/* Object header allocation routines */
H5_DLL herr_t H5O_alloc_msgs(H5O_t *oh, size_t min_alloc);
H5_DLL herr_t H5O__alloc_msgs(H5O_t *oh, size_t min_alloc);
H5_DLL herr_t H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size,
size_t found_null, const H5O_msg_alloc_info_t *found_msg, size_t *new_idx);
H5_DLL herr_t H5O__alloc(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
const void *mesg, size_t *mesg_idx);
H5_DLL herr_t H5O_condense_header(H5F_t *f, H5O_t *oh);
H5_DLL herr_t H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg,
H5_DLL herr_t H5O__condense_header(H5F_t *f, H5O_t *oh);
H5_DLL herr_t H5O__release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg,
hbool_t adj_link);
/* Shared object operators */
H5_DLL void * H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
H5_DLL void * H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
const uint8_t *buf, const H5O_msg_class_t *type);
H5_DLL herr_t H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg);
H5_DLL size_t H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg);
H5_DLL herr_t H5O__shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg);
H5_DLL size_t H5O__shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg);
H5_DLL herr_t H5O__shared_delete(H5F_t *f, H5O_t *open_oh,
const H5O_msg_class_t *mesg_type, H5O_shared_t *sh_mesg);
H5_DLL herr_t H5O__shared_link(H5F_t *f, H5O_t *open_oh,
@ -629,17 +622,18 @@ H5_DLL herr_t H5O__shared_copy_file(H5F_t *file_src, H5F_t *file_dst,
H5_DLL herr_t H5O__shared_post_copy_file (H5F_t *f,
const H5O_msg_class_t *mesg_type, const H5O_shared_t *shared_src,
H5O_shared_t *shared_dst, unsigned *mesg_flags, H5O_copy_t *cpy_info);
H5_DLL herr_t H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream,
H5_DLL herr_t H5O__shared_debug(const H5O_shared_t *mesg, FILE *stream,
int indent, int fwidth);
/* Attribute message operators */
H5_DLL herr_t H5O__attr_reset(void *_mesg);
H5_DLL herr_t H5O__attr_delete(H5F_t *f, H5O_t *open_oh, void *_mesg);
H5_DLL herr_t H5O__attr_link(H5F_t *f, H5O_t *open_oh, void *_mesg);
H5_DLL herr_t H5O_attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs);
H5_DLL herr_t H5O__attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs);
/* Arrays of versions for:
Object header, Attribute/Fill value/Filter pipeline messages */
* Object header, Attribute/Fill value/Filter pipeline messages
*/
/* Layout/Datatype/Dataspace arrays of versions are in H5Dpkg.h, H5Tpkg.h and H5Spkg.h */
H5_DLLVAR const unsigned H5O_obj_ver_bounds[H5F_LIBVER_NBOUNDS];
H5_DLLVAR const unsigned H5O_attr_ver_bounds[H5F_LIBVER_NBOUNDS];
@ -661,10 +655,9 @@ H5_DLL herr_t H5O__msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type);
/* Object header debugging routines */
#ifdef H5O_DEBUG
H5_DLL herr_t H5O_assert(const H5O_t *oh);
H5_DLL herr_t H5O__assert(const H5O_t *oh);
#endif /* H5O_DEBUG */
H5_DLL herr_t H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream,
int indent, int fwidth);
H5_DLL herr_t H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth);
#endif /* _H5Opkg_H */

@ -866,10 +866,13 @@ H5_DLL herr_t H5O_init(void);
H5_DLL herr_t H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc,
hid_t ocpl_id, H5O_loc_t *loc/*out*/);
H5_DLL herr_t H5O_open(H5O_loc_t *loc);
H5_DLL hid_t H5O_open_by_idx(const H5G_loc_t *loc, const char *name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
H5_DLL hid_t H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr);
H5_DLL hid_t H5O_open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref);
H5_DLL herr_t H5O_close(H5O_loc_t *loc, hbool_t *file_closed/*out*/);
H5_DLL int H5O_link(const H5O_loc_t *loc, int adjust);
H5_DLL H5O_t *H5O_protect(const H5O_loc_t *loc, unsigned prot_flags,
hbool_t pin_all_chunks);
H5_DLL H5O_t *H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks);
H5_DLL H5O_t *H5O_pin(const H5O_loc_t *loc);
H5_DLL herr_t H5O_unpin(H5O_t *oh);
H5_DLL herr_t H5O_dec_rc_by_loc(const H5O_loc_t *loc);
@ -900,10 +903,12 @@ H5_DLL herr_t H5O_msg_write(const H5O_loc_t *loc, unsigned type_id,
unsigned mesg_flags, unsigned update_flags, void *mesg);
H5_DLL herr_t H5O_msg_write_oh(H5F_t *f, H5O_t *oh, unsigned type_id,
unsigned mesg_flags, unsigned update_flags, void *mesg);
H5_DLL herr_t H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg);
H5_DLL void *H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg);
H5_DLL void *H5O_msg_read_oh(H5F_t *f, H5O_t *oh, unsigned type_id, void *mesg);
H5_DLL herr_t H5O_msg_reset(unsigned type_id, void *native);
H5_DLL void *H5O_msg_free(unsigned type_id, void *mesg);
H5_DLL void *H5O_msg_free_real(const H5O_msg_class_t *type, void *mesg);
H5_DLL void *H5O_msg_copy(unsigned type_id, const void *mesg, void *dst);
H5_DLL int H5O_msg_count(const H5O_loc_t *loc, unsigned type_id);
H5_DLL htri_t H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id);
@ -937,6 +942,7 @@ H5_DLL herr_t H5O_msg_delete(H5F_t *f, H5O_t *open_oh, unsigned type_id,
H5_DLL herr_t H5O_msg_get_flags(const H5O_loc_t *loc, unsigned type_id, uint8_t *flags);
/* Object metadata flush/refresh routines */
H5_DLL herr_t H5O_flush(H5O_loc_t *oloc, hid_t obj_id);
H5_DLL herr_t H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id);
H5_DLL herr_t H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc);
H5_DLL herr_t H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr);
@ -948,6 +954,8 @@ H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst
H5_DLL herr_t H5O_copy_expand_ref(H5F_t *file_src, void *_src_ref,
H5F_t *file_dst, void *_dst_ref, size_t ref_count, H5R_type_t ref_type,
H5O_copy_t *cpy_info);
H5_DLL herr_t H5O_copy(const H5G_loc_t *src_loc, const char *src_name,
H5G_loc_t *dst_loc, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id);
/* Debugging routines */
H5_DLL herr_t H5O_debug_id(unsigned type_id, H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidth);

@ -69,6 +69,10 @@
/********************/
/* Local Prototypes */
/********************/
static void *H5O__shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
const H5O_shared_t *shared, const H5O_msg_class_t *type);
static herr_t H5O__shared_link_adj(H5F_t *f, H5O_t *open_oh,
const H5O_msg_class_t *type, H5O_shared_t *shared, int adjust);
/*********************/
@ -88,14 +92,14 @@
/*-------------------------------------------------------------------------
* Function: H5O_shared_read
* Function: H5O__shared_read
*
* Purpose: Reads a message referred to by a shared message.
* Purpose: Reads a message referred to by a shared message.
*
* Return: Success: Ptr to message in native format. The message
* should be freed by calling H5O_msg_reset().
* Return: Success: Ptr to message in native format. The message
* should be freed by calling H5O_msg_reset().
*
* Failure: NULL
* Failure: NULL
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
@ -104,7 +108,7 @@
*-------------------------------------------------------------------------
*/
static void *
H5O_shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
H5O__shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
const H5O_shared_t *shared, const H5O_msg_class_t *type)
{
H5HF_t *fheap = NULL;
@ -112,7 +116,7 @@ H5O_shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
uint8_t mesg_buf[H5O_MESG_BUF_SIZE]; /* Buffer for deserializing messages */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_STATIC
/* check args */
HDassert(f);
@ -194,13 +198,13 @@ done:
HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, NULL, "can't close wrapped buffer")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_shared_read() */
} /* end H5O__shared_read() */
/*-------------------------------------------------------------------------
* Function: H5O__shared_link_adj
* Function: H5O__shared_link_adj
*
* Purpose: Changes the link count for the object referenced by a shared
* Purpose: Changes the link count for the object referenced by a shared
* message.
*
* This function changes the object header link count and is
@ -209,8 +213,7 @@ done:
* reference count is stored in the file-wide shared message
* index and is changed in a different place in the code.
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
@ -294,11 +297,12 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O_shared_decode
* Function: H5O__shared_decode
*
* Purpose: Decodes a shared object message
* Purpose: Decodes a shared object message
*
* Return: Non-negative on success/Negative on failure
* Return: Success: A buffer containing the decoded shared object
* Failure: NULL
*
* Programmer: Quincey Koziol
* Monday, January 22, 2007
@ -306,14 +310,14 @@ done:
*-------------------------------------------------------------------------
*/
void *
H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *buf,
H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *buf,
const H5O_msg_class_t *type)
{
H5O_shared_t sh_mesg; /* Shared message info */
unsigned version; /* Shared message version */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_PACKAGE
/* Check args */
HDassert(f);
@ -373,20 +377,20 @@ H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *bu
sh_mesg.msg_type_id = type->id;
/* Retrieve actual message, through decoded shared message info */
if(NULL == (ret_value = H5O_shared_read(f, open_oh, ioflags, &sh_mesg, type)))
if(NULL == (ret_value = H5O__shared_read(f, open_oh, ioflags, &sh_mesg, type)))
HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to retrieve native message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_shared_decode() */
} /* end H5O__shared_decode() */
/*-------------------------------------------------------------------------
* Function: H5O_shared_encode
* Function: H5O__shared_encode
*
* Purpose: Encodes message _MESG into buffer BUF.
* Purpose: Encodes message _MESG into buffer BUF.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Thursday, April 2, 1998
@ -394,11 +398,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg)
H5O__shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg)
{
unsigned version;
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_ENTER_PACKAGE_NOERR
/* Check args */
HDassert(f);
@ -427,15 +431,15 @@ H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_me
H5F_addr_encode(f, &buf, sh_mesg->u.loc.oh_addr);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_shared_encode() */
} /* end H5O__shared_encode() */
/*-------------------------------------------------------------------------
* Function: H5O_set_shared
* Function: H5O_set_shared
*
* Purpose: Sets the shared component for a message.
* Purpose: Sets the shared component for a message.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
@ -460,12 +464,12 @@ H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src)
/*-------------------------------------------------------------------------
* Function: H5O_shared_size
* Function: H5O__shared_size
*
* Purpose: Returns the length of a shared object message.
* Purpose: Returns the length of a shared object message.
*
* Return: Success: Length
* Failure: 0
* Return: Success: Length
* Failure: 0
*
* Programmer: Robb Matzke
* Thursday, April 2, 1998
@ -473,26 +477,26 @@ H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src)
*-------------------------------------------------------------------------
*/
size_t
H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg)
H5O__shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg)
{
size_t ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_ENTER_PACKAGE_NOERR
if(sh_mesg->type == H5O_SHARE_TYPE_COMMITTED) {
ret_value = (size_t)1 + /*version */
(size_t)1 + /*the type field */
(size_t)H5F_SIZEOF_ADDR(f); /*sharing by another obj hdr */
ret_value = (size_t)1 + /* Version */
(size_t)1 + /* Type field */
(size_t)H5F_SIZEOF_ADDR(f); /* Sharing by another obj hdr */
} /* end if */
else {
HDassert(sh_mesg->type == H5O_SHARE_TYPE_SOHM);
ret_value = 1 + /*version */
1 + /*the type field */
H5O_FHEAP_ID_LEN; /* Shared in the heap */
ret_value = 1 + /* Version */
1 + /* Type field */
H5O_FHEAP_ID_LEN; /* Shared in the heap */
} /* end else */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_shared_size() */
} /* end H5O__shared_size() */
/*-------------------------------------------------------------------------
@ -500,7 +504,7 @@ H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg)
*
* Purpose: Free file space referenced by message
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Friday, September 26, 2003
@ -521,7 +525,7 @@ H5O__shared_delete(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type,
/*
* Committed datatypes increment the OH of the original message when they
* are written (in H5O__shared_link) and decrement it here.
* are written (in H5O_shared_link) and decrement it here.
* SOHMs in the heap behave differently; their refcount is incremented
* during H5SM_share when they are going to be written (in H5O_msg_append
* or H5O_msg_write). Their refcount in the SOHM indexes still needs to
@ -543,7 +547,7 @@ done:
* Purpose: Increment reference count on any objects referenced by
* message
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Friday, September 26, 2003
@ -558,7 +562,7 @@ H5O__shared_link(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type,
FUNC_ENTER_PACKAGE
/* check args */
/* Check args */
HDassert(f);
HDassert(sh_mesg);
@ -576,8 +580,7 @@ done:
*
* Purpose: Copies a message from _MESG to _DEST in file
*
* Return: Success: Non-negative
* Failure: Negative
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* January 22, 2007
@ -647,7 +650,7 @@ done:
* to complish that is to delete the old message and write the
* new message with the correct values.
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Peter Cao
* xcao@hdfgroup.org
@ -696,7 +699,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O_shared_debug
* Function: H5O__shared_debug
*
* Purpose: Prints debugging info for the message
*
@ -708,9 +711,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth)
H5O__shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_ENTER_PACKAGE_NOERR
/* Check args */
HDassert(mesg);
@ -756,5 +759,5 @@ H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth)
} /* end switch */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_shared_debug() */
} /* end H5O__shared_debug() */

@ -66,7 +66,7 @@ H5O_SHARED_DECODE(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags,
/* Check for shared message */
if(mesg_flags & H5O_MSG_FLAG_SHARED) {
/* Retrieve native message info indirectly through shared message */
if(NULL == (ret_value = H5O_shared_decode(f, open_oh, ioflags, p, H5O_SHARED_TYPE)))
if(NULL == (ret_value = H5O__shared_decode(f, open_oh, ioflags, p, H5O_SHARED_TYPE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message")
/* We currently do not support automatically fixing shared messages */
@ -129,13 +129,13 @@ H5O_SHARED_ENCODE(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mes
/* Check for message stored elsewhere */
if(H5O_IS_STORED_SHARED(sh_mesg->type) && !disable_shared) {
/* Encode shared message into buffer */
if(H5O_shared_encode(f, p, sh_mesg) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode shared message")
if(H5O__shared_encode(f, p, sh_mesg) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode shared message")
} /* end if */
else {
/* Encode native message directly */
if(H5O_SHARED_ENCODE_REAL(f, p, _mesg) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode native message")
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode native message")
} /* end else */
done:
@ -181,13 +181,13 @@ H5O_SHARED_SIZE(const H5F_t *f, hbool_t disable_shared, const void *_mesg)
/* Check for message stored elsewhere */
if(H5O_IS_STORED_SHARED(sh_mesg->type) && !disable_shared) {
/* Retrieve encoded size of shared message */
if(0 == (ret_value = H5O_shared_size(f, sh_mesg)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of shared message")
if(0 == (ret_value = H5O__shared_size(f, sh_mesg)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of shared message")
} /* end if */
else {
/* Retrieve size of native message directly */
if(0 == (ret_value = H5O_SHARED_SIZE_REAL(f, _mesg)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of native message")
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of native message")
} /* end else */
done:
@ -232,13 +232,13 @@ H5O_SHARED_DELETE(H5F_t *f, H5O_t *open_oh, void *_mesg)
if(H5O_IS_TRACKED_SHARED(sh_mesg->type)) {
/* Decrement the reference count on the shared message/object */
if(H5O__shared_delete(f, open_oh, H5O_SHARED_TYPE, sh_mesg) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for shared message")
HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for shared message")
} /* end if */
#ifdef H5O_SHARED_DELETE_REAL
else {
/* Decrement the reference count on the native message directly */
if(H5O_SHARED_DELETE_REAL(f, open_oh, _mesg) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for native message")
HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for native message")
} /* end else */
#endif /* H5O_SHARED_DELETE_REAL */
@ -284,13 +284,13 @@ H5O_SHARED_LINK(H5F_t *f, H5O_t *open_oh, void *_mesg)
if(H5O_IS_TRACKED_SHARED(sh_mesg->type)) {
/* Increment the reference count on the shared message/object */
if(H5O__shared_link(f, open_oh, H5O_SHARED_TYPE, sh_mesg) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for shared message")
HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for shared message")
} /* end if */
#ifdef H5O_SHARED_LINK_REAL
else {
/* Increment the reference count on the native message directly */
if(H5O_SHARED_LINK_REAL(f, open_oh, _mesg) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for native message")
HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for native message")
} /* end else */
#endif /* H5O_SHARED_LINK_REAL */
@ -473,7 +473,7 @@ H5O_SHARED_DEBUG(H5F_t *f, const void *_mesg, FILE *stream, int indent,
/* Check for message stored elsewhere */
if(H5O_IS_STORED_SHARED(sh_mesg->type)) {
/* Print shared message information */
if(H5O_shared_debug(sh_mesg, stream, indent, fwidth) < 0)
if(H5O__shared_debug(sh_mesg, stream, indent, fwidth) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display shared message info")
} /* end if */

@ -37,9 +37,9 @@
/* PRIVATE PROTOTYPES */
static void *H5O__stab_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags,
unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_stab_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_stab_copy(const void *_mesg, void *_dest);
static size_t H5O_stab_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
static herr_t H5O__stab_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O__stab_copy(const void *_mesg, void *_dest);
static size_t H5O__stab_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
static herr_t H5O__stab_free(void *_mesg);
static herr_t H5O__stab_delete(H5F_t *f, H5O_t *open_oh, void *_mesg);
static void *H5O__stab_copy_file(H5F_t *file_src, void *native_src,
@ -58,9 +58,9 @@ const H5O_msg_class_t H5O_MSG_STAB[1] = {{
sizeof(H5O_stab_t), /*native message size */
0, /* messages are sharable? */
H5O__stab_decode, /*decode message */
H5O_stab_encode, /*encode message */
H5O_stab_copy, /*copy the native value */
H5O_stab_size, /*size of symbol table entry */
H5O__stab_encode, /*encode message */
H5O__stab_copy, /*copy the native value */
H5O__stab_size, /*size of symbol table entry */
NULL, /*default reset method */
H5O__stab_free, /* free method */
H5O__stab_delete, /* file delete method */
@ -111,7 +111,7 @@ H5O__stab_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
/* decode */
if(NULL == (stab = H5FL_CALLOC(H5O_stab_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
H5F_addr_decode(f, &p, &(stab->btree_addr));
H5F_addr_decode(f, &p, &(stab->heap_addr));
@ -129,7 +129,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O_stab_encode
* Function: H5O__stab_encode
*
* Purpose: Encodes a symbol table message.
*
@ -142,11 +142,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5O_stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
H5O__stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
{
const H5O_stab_t *stab = (const H5O_stab_t *) _mesg;
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_ENTER_STATIC_NOERR
/* check args */
HDassert(f);
@ -158,11 +158,11 @@ H5O_stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con
H5F_addr_encode(f, &p, stab->heap_addr);
FUNC_LEAVE_NOAPI(SUCCEED)
}
} /* end H5O__stab_encode() */
/*-------------------------------------------------------------------------
* Function: H5O_stab_copy
* Function: H5O__stab_copy
*
* Purpose: Copies a message from _MESG to _DEST, allocating _DEST if
* necessary.
@ -178,18 +178,18 @@ H5O_stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con
*-------------------------------------------------------------------------
*/
static void *
H5O_stab_copy(const void *_mesg, void *_dest)
H5O__stab_copy(const void *_mesg, void *_dest)
{
const H5O_stab_t *stab = (const H5O_stab_t *) _mesg;
H5O_stab_t *dest = (H5O_stab_t *) _dest;
void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_STATIC
/* check args */
HDassert(stab);
if(!dest && NULL == (dest = H5FL_MALLOC(H5O_stab_t)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
/* copy */
*dest = *stab;
@ -199,11 +199,11 @@ H5O_stab_copy(const void *_mesg, void *_dest)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_stab_copy() */
} /* end H5O__stab_copy() */
/*-------------------------------------------------------------------------
* Function: H5O_stab_size
* Function: H5O__stab_size
*
* Purpose: Returns the size of the raw message in bytes not counting
* the message type or size fields, but only the data fields.
@ -220,17 +220,17 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
H5O_stab_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg)
H5O__stab_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg)
{
size_t ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_ENTER_STATIC_NOERR
/* Set return value */
ret_value = (size_t)(2 * H5F_SIZEOF_ADDR(f));
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_stab_size() */
} /* end H5O__stab_size() */
/*-------------------------------------------------------------------------
@ -327,14 +327,14 @@ H5O__stab_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst,
/* Get the old local heap's size and use that as the hint for the new heap */
if(H5HL_get_size(file_src, stab_src->heap_addr, &size_hint) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, NULL, "can't query local heap size")
HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, NULL, "can't query local heap size")
/* Set copy metadata tag */
H5_BEGIN_TAG(H5AC__COPIED_TAG);
/* Create components of symbol table message */
if(H5G__stab_create_components(file_dst, stab_dst, size_hint) < 0)
HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTINIT, NULL, "can't create symbol table components")
HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTINIT, NULL, "can't create symbol table components")
/* Reset metadata tag */
H5_END_TAG

@ -127,7 +127,7 @@ H5O__is_attr_dense_test(hid_t oid)
/* Check if dense storage is being used */
if(H5F_addr_defined(ainfo.fheap_addr)) {
/* Check for any messages in object header */
HDassert(H5O_msg_count_real(oh, H5O_MSG_ATTR) == 0);
HDassert(H5O__msg_count_real(oh, H5O_MSG_ATTR) == 0);
ret_value = TRUE;
} /* end if */
@ -197,7 +197,7 @@ H5O__is_attr_empty_test(hid_t oid)
} /* end if */
/* Retrieve the number of attribute messages in header */
nattrs = H5O_msg_count_real(oh, H5O_MSG_ATTR);
nattrs = H5O__msg_count_real(oh, H5O_MSG_ATTR);
/* Check for later version of object header format & attribute info available */
if(oh->version > H5O_VERSION_1) {
@ -299,7 +299,7 @@ H5O__num_attrs_test(hid_t oid, hsize_t *nattrs)
} /* end if */
/* Retrieve the number of attribute messages in header */
obj_nattrs = H5O_msg_count_real(oh, H5O_MSG_ATTR);
obj_nattrs = H5O__msg_count_real(oh, H5O_MSG_ATTR);
/* Check for later version of object header format */
if(oh->version > H5O_VERSION_1) {

@ -63,11 +63,11 @@ H5FL_DEFINE(H5O_unknown_t);
/*-------------------------------------------------------------------------
* Function: H5O__unknown_free
* Function: H5O__unknown_free
*
* Purpose: Frees the message
* Purpose: Frees the message
*
* Return: Non-negative on success/Negative on failure
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Tuesday, May 1, 2007

@ -1,5 +1,5 @@
HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#000: (file name) line (number) in H5Aopen(): unable to load attribute info from object header for attribute: 'attr'
#000: (file name) line (number) in H5Aopen(): unable to open attribute: 'attr'
major: Attribute
minor: Can't open object
#001: (file name) line (number) in H5A__open(): unable to load attribute info from object header for attribute: 'attr'

@ -8,7 +8,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#002: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
#003: (file name) line (number) in H5G_traverse_real(): traversal operator failed
#003: (file name) line (number) in H5G__traverse_real(): traversal operator failed
major: Symbol table
minor: Callback failed
#004: (file name) line (number) in H5G_loc_find_cb(): object 'Dataset1' doesn't exist
@ -24,7 +24,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#002: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
#003: (file name) line (number) in H5G_traverse_real(): traversal operator failed
#003: (file name) line (number) in H5G__traverse_real(): traversal operator failed
major: Symbol table
minor: Callback failed
#004: (file name) line (number) in H5L_get_info_cb(): name doesn't exist

@ -64,7 +64,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#002: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
#003: (file name) line (number) in H5G_traverse_real(): traversal operator failed
#003: (file name) line (number) in H5G__traverse_real(): traversal operator failed
major: Symbol table
minor: Callback failed
#004: (file name) line (number) in H5G_loc_find_cb(): object 'Dataset1' doesn't exist
@ -80,7 +80,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#002: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
#003: (file name) line (number) in H5G_traverse_real(): traversal operator failed
#003: (file name) line (number) in H5G__traverse_real(): traversal operator failed
major: Symbol table
minor: Callback failed
#004: (file name) line (number) in H5L_get_info_cb(): name doesn't exist