diff options
Diffstat (limited to 'src/H5Aint.c')
-rw-r--r-- | src/H5Aint.c | 259 |
1 files changed, 36 insertions, 223 deletions
diff --git a/src/H5Aint.c b/src/H5Aint.c index 55560c7..807c67e 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -87,8 +87,6 @@ typedef struct { /* Local Prototypes */ /********************/ -static H5A_t *H5A__create_common(const H5G_loc_t *loc, const char *name, - const H5T_t *type, const H5S_t *space, hid_t acpl_id); 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*/); @@ -127,7 +125,7 @@ H5FL_SEQ_DEFINE(H5A_t_ptr); /*------------------------------------------------------------------------- - * Function: H5A__create_common + * Function: H5A__create * * Purpose: This is the guts of creating an attribute. * @@ -138,8 +136,8 @@ H5FL_SEQ_DEFINE(H5A_t_ptr); * *------------------------------------------------------------------------- */ -static H5A_t * -H5A__create_common(const H5G_loc_t *loc, const char *name, const H5T_t *type, +H5A_t * +H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, const H5S_t *space, hid_t acpl_id) { H5A_t *attr = NULL; /* Attribute created */ @@ -148,7 +146,7 @@ H5A__create_common(const H5G_loc_t *loc, const char *name, const H5T_t *type, htri_t exists; /* Whether attribute exists */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_STATIC_TAG(loc->oloc->addr) + FUNC_ENTER_PACKAGE_TAG(loc->oloc->addr) /* Check args */ HDassert(loc); @@ -285,45 +283,6 @@ done: HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* H5A__create_common() */ - - -/*------------------------------------------------------------------------- - * Function: H5A__create - * - * Purpose: Entry point for creating attribute on an object - * - * Note: This routine is needed so that there's a non-API routine for - * creating attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Attribute structure on success, NULL on Failure. - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -H5A_t * -H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, - const H5S_t *space, hid_t acpl_id) -{ - H5A_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check args */ - HDassert(loc); - HDassert(name); - HDassert(type); - HDassert(space); - - /* Go do the real work for attaching the attribute to the object */ - if(NULL == (ret_value = H5A__create_common(loc, name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, NULL, "unable to create attribute") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) } /* H5A__create() */ @@ -350,7 +309,7 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -368,8 +327,8 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr loc_found = TRUE; /* Go do the real work for attaching the attribute to the object */ - if(NULL == (attr = H5A__create_common(&obj_loc, attr_name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") + if(NULL == (attr = H5A__create(&obj_loc, attr_name, type, space, acpl_id))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") /* Set return value */ ret_value = attr; @@ -384,7 +343,7 @@ done: if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__create_by_name() */ @@ -450,10 +409,6 @@ done: * * Purpose: Open an attribute in an object header * - * Note: This routine is needed so that there's a non-API routine for - * creating attributes that can set up VOL / SWMR info - * (which need a DXPL). - * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol @@ -467,7 +422,7 @@ H5A__open(const H5G_loc_t *loc, const char *attr_name) H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -490,7 +445,7 @@ done: if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open() */ @@ -517,7 +472,7 @@ H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -554,7 +509,7 @@ done: if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open_by_idx() */ @@ -580,7 +535,7 @@ H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_n H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -618,7 +573,7 @@ done: if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open_by_name() */ @@ -652,7 +607,7 @@ H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf) size_t buf_size; /* desired buffer size */ herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE_VOL_TAG(attr->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(attr->oloc.addr) HDassert(attr); HDassert(mem_type); @@ -721,7 +676,7 @@ done: if(bkg_buf) bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5A__read() */ @@ -756,7 +711,7 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf) size_t buf_size; /* desired buffer size */ herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE_VOL_TAG(attr->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(attr->oloc.addr) HDassert(attr); HDassert(mem_type); @@ -835,7 +790,7 @@ done: if(bkg_buf) bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5A__write() */ @@ -939,7 +894,7 @@ H5A__get_type(H5A_t *attr) H5T_t *dt = NULL; hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(attr); @@ -970,7 +925,7 @@ 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") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__get_type() */ @@ -1192,7 +1147,7 @@ H5A__close_cb(H5A_t *attr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(attr); @@ -1203,7 +1158,7 @@ H5A__close_cb(H5A_t *attr) HGOTO_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "problem closing attribute") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__close_cb() */ @@ -1355,39 +1310,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__exists - * - * Purpose: Private version of H5Aexists - * - * Note: This routine is needed so that there's a non-API routine for - * detecting attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: TRUE/FALSE - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -htri_t -H5A__exists(const H5G_loc_t *loc, const char *name) -{ - htri_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check if the attribute exists */ - if((ret_value = H5O__attr_exists(loc->oloc, name)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__exists() */ - - -/*------------------------------------------------------------------------- * Function: H5A__exists_by_name * * Purpose: Private version of H5Aexists_by_name @@ -1409,7 +1331,7 @@ H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name) hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1430,7 +1352,7 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__exists_by_name() */ @@ -2599,39 +2521,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__rename - * - * Purpose: Private version of H5Arename - * - * Note: This routine is needed so that there's a non-API routine for - * renaming attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5A__rename(const H5G_loc_t *loc, const char *old_name, const char *new_name) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Call object header attribute rename routine */ - if(H5O__attr_rename(loc->oloc, old_name, new_name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__rename() */ - - -/*------------------------------------------------------------------------- * Function: H5A__rename_by_name * * Purpose: Private version of H5Arename_by_name @@ -2654,7 +2543,7 @@ H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_na hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -2675,44 +2564,9 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__rename_by_name() */ -#ifndef H5_NO_DEPRECATED_SYMBOLS - -/*------------------------------------------------------------------------- - * Function: H5A__get_num_attrs - * - * Purpose: Private version of deprecated H5Aget_num_attrs - * - * Note: This routine is needed so that there's a non-API routine for - * querying the attribute count that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -int -H5A__get_num_attrs(const H5O_loc_t *loc) -{ - int ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* 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") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__get_num_attrs() */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - /*------------------------------------------------------------------------- * Function: H5A__iterate_common @@ -2755,10 +2609,6 @@ H5A__iterate_common(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, * * Purpose: Private version of H5Aiterate2 * - * Note: This routine is needed so that there's a non-API routine for - * iterating over attributes that can set up VOL / SWMR info - * (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -2774,7 +2624,7 @@ H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, H5A_attr_iter_op_t attr_op; /* Attribute operator */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Build attribute operator info */ attr_op.op_type = H5A_ATTR_OP_APP2; @@ -2785,7 +2635,7 @@ H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__iterate() */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -2811,7 +2661,7 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, hsize_t idx; /* Index of attribute to start iterating at */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Build attribute operator info */ attr_op.op_type = H5A_ATTR_OP_APP; @@ -2829,7 +2679,7 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, *attr_num = (unsigned)idx; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__iterate_old() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -2839,10 +2689,6 @@ done: * * Purpose: Private version of H5Aiterate_by_name * - * Note: This routine is needed so that there's a non-API routine for - * iterating over attributes that can set up VOL / SWMR info - * (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -2863,7 +2709,7 @@ H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_ H5A_attr_iter_op_t attr_op; /* Attribute operator */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -2896,44 +2742,11 @@ done: else if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__iterate_by_name() */ /*------------------------------------------------------------------------- - * Function: H5A__delete - * - * Purpose: Private version of H5Adelete - * - * Note: This routine is needed so that there's a non-API routine for - * deleting attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5A__delete(const H5G_loc_t *loc, const char *name) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Call object header attribute delete attribute routine */ - if(H5O__attr_remove(loc->oloc, name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__delete() */ - - -/*------------------------------------------------------------------------- * Function: H5A__delete_by_name * * Purpose: Private version of H5Adelete_by_name @@ -2955,7 +2768,7 @@ H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -2976,7 +2789,7 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__delete_by_name() */ @@ -3003,7 +2816,7 @@ H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_ty hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -3024,6 +2837,6 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__delete_by_idx() */ |