summaryrefslogtreecommitdiffstats
path: root/src/H5Oattribute.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Oattribute.c')
-rw-r--r--src/H5Oattribute.c706
1 files changed, 331 insertions, 375 deletions
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index 2223564..d498be5 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -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 */
/****************/
@@ -55,7 +53,6 @@
/* User data for iteration when converting attributes to dense storage */
typedef struct {
H5F_t *f; /* Pointer to file for insertion */
- hid_t dxpl_id; /* DXPL during iteration */
H5O_ainfo_t *ainfo; /* Attribute info struct */
} H5O_iter_cvt_t;
@@ -72,7 +69,6 @@ typedef struct {
typedef struct {
/* down */
H5F_t *f; /* Pointer to file attribute is in */
- hid_t dxpl_id; /* DXPL for operation */
H5A_t *attr; /* Attribute data to update object header with */
/* up */
@@ -83,7 +79,6 @@ typedef struct {
typedef struct {
/* down */
H5F_t *f; /* Pointer to file attribute is in */
- hid_t dxpl_id; /* DXPL for operation */
const char *old_name; /* Old name of attribute */
const char *new_name; /* New name of attribute */
@@ -91,40 +86,16 @@ typedef struct {
hbool_t found; /* Whether the attribute was found */
} H5O_iter_ren_t;
-/* User data for iteration when iterating over attributes */
-typedef struct {
- /* down */
- H5F_t *f; /* Pointer to file attribute is in */
- hid_t dxpl_id; /* DXPL for operation */
- hid_t loc_id; /* ID of object being iterated over */
- unsigned skip; /* # of attributes to skip over */
- H5A_operator_t op; /* Callback routine for each attribute */
- void *op_data; /* User data for callback */
-
- /* up */
- unsigned count; /* Count of attributes examined */
-} H5O_iter_itr_t;
-
/* User data for iteration when removing an attribute */
typedef struct {
/* down */
H5F_t *f; /* Pointer to file attribute is in */
- hid_t dxpl_id; /* DXPL for operation */
const char *name; /* Name of attribute to open */
/* up */
hbool_t found; /* Found attribute to delete */
} H5O_iter_rm_t;
-/* User data for iteration when checking if an attribute exists */
-typedef struct {
- /* down */
- const char *name; /* Name of attribute to open */
-
- /* up */
- hbool_t found; /* Found attribute */
-} H5O_iter_xst_t;
-
/********************/
/* Package Typedefs */
@@ -134,8 +105,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 */
@@ -154,12 +141,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
@@ -168,14 +155,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,12 +173,12 @@ H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
HDassert(attr);
/* Insert attribute into dense storage */
- if(H5A_dense_insert(udata->f, udata->dxpl_id, udata->ainfo, attr) < 0)
+ if(H5A__dense_insert(udata->f, udata->ainfo, attr) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, H5_ITER_ERROR, "unable to add to dense storage")
/* 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, udata->dxpl_id, 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 */
@@ -199,15 +186,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
@@ -215,7 +202,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
+H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr)
{
H5O_t *oh = NULL; /* Pointer to actual object header */
H5O_ainfo_t ainfo; /* Attribute information for object */
@@ -229,7 +216,7 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
HDassert(attr);
/* Pin the object header */
- if(NULL == (oh = H5O_pin(loc, dxpl_id)))
+ if(NULL == (oh = H5O_pin(loc)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Check if this object already has attribute information */
@@ -238,7 +225,7 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
htri_t ainfo_exists; /* Whether the attribute info was retrieved */
/* Check for (& retrieve if available) attribute info */
- if((ainfo_exists = H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo)) < 0)
+ if((ainfo_exists = H5A__get_ainfo(loc->file, oh, &ainfo)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message")
if(!ainfo_exists) {
/* Initialize attribute information */
@@ -266,7 +253,7 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
size_t raw_size = 0; /* Raw size of message */
/* Check for attribute being sharable */
- if((sharable = H5SM_can_share(loc->file, dxpl_id, NULL, NULL, H5O_ATTR_ID, attr)) < 0)
+ if((sharable = H5SM_can_share(loc->file, NULL, NULL, H5O_ATTR_ID, attr)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "can't determine attribute sharing status")
else if(sharable == FALSE) {
/* Compute the size needed to encode the attribute */
@@ -279,18 +266,17 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
H5O_mesg_operator_t op; /* Wrapper for operator */
/* Create dense storage for attributes */
- if(H5A_dense_create(loc->file, dxpl_id, &ainfo) < 0)
+ if(H5A__dense_create(loc->file, &ainfo) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create dense storage for attributes")
/* Set up user data for callback */
udata.f = loc->file;
- udata.dxpl_id = dxpl_id;
udata.ainfo = &ainfo;
/* 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;
- if(H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0)
+ 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 */
} /* end if */
@@ -313,14 +299,13 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
/* Add the attribute information message, if one is needed */
if(new_ainfo) {
- if(H5O_msg_append_real(loc->file, dxpl_id, oh, H5O_MSG_AINFO, H5O_MSG_FLAG_DONTSHARE, 0, &ainfo) < 0)
+ if(H5O__msg_append_real(loc->file, oh, H5O_MSG_AINFO, H5O_MSG_FLAG_DONTSHARE, 0, &ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to create new attribute info message")
} /* end if */
/* Otherwise, update existing message */
- else {
- if(H5O_msg_write_real(loc->file, dxpl_id, oh, H5O_MSG_AINFO, H5O_MSG_FLAG_DONTSHARE, 0, &ainfo) < 0)
+ else
+ 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")
- } /* end else */
} /* end if */
else {
/* Set "bogus" creation index for attribute */
@@ -333,19 +318,19 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
/* Check for storing attribute with dense storage */
if(H5F_addr_defined(ainfo.fheap_addr)) {
/* Insert attribute into dense storage */
- if(H5A_dense_insert(loc->file, dxpl_id, &ainfo, attr) < 0)
+ if(H5A__dense_insert(loc->file, &ainfo, attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to add to dense storage")
} /* end if */
- else {
+ else
/* Append new message to object header */
- if(H5O_msg_append_real(loc->file, dxpl_id, oh, H5O_MSG_ATTR, 0, 0, attr) < 0)
+ if(H5O__msg_append_real(loc->file, oh, H5O_MSG_ATTR, 0, 0, attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to create new attribute in header")
- } /* end else */
/* Increment reference count for shared attribute object for the
- * object handle created by the caller function H5A_create. The count
+ * 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? */
@@ -353,7 +338,7 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
hsize_t attr_rc; /* Attribute's ref count in shared message storage */
/* Retrieve ref count for shared attribute */
- if(H5SM_get_refcount(loc->file, dxpl_id, H5O_ATTR_ID, &attr->sh_loc, &attr_rc) < 0)
+ if(H5SM_get_refcount(loc->file, H5O_ATTR_ID, &attr->sh_loc, &attr_rc) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve shared message ref count")
/* If this is not the first copy of the attribute in the shared message
@@ -380,7 +365,7 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
* *ick* -QAK, 2007/01/08
*/
if(attr_rc > 1) {
- if(H5O_attr_delete(loc->file, dxpl_id, oh, attr) < 0)
+ if(H5O__attr_delete(loc->file, oh, attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
} /* end if */
} /* end if */
@@ -388,7 +373,7 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "error determining if message should be shared")
/* Update the modification time, if any */
- if(H5O_touch_oh(loc->file, dxpl_id, oh, FALSE) < 0)
+ if(H5O_touch_oh(loc->file, oh, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object")
done:
@@ -396,16 +381,16 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_create() */
+} /* end H5O__attr_create() */
/*-------------------------------------------------------------------------
- * 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
@@ -414,13 +399,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);
@@ -430,7 +415,7 @@ H5O_attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
/* Check for correct attribute message to modify */
if(HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) {
/* Make a copy of the attribute to return */
- if(NULL == (udata->attr = H5A_copy(NULL, (H5A_t *)mesg->native)))
+ if(NULL == (udata->attr = H5A__copy(NULL, (H5A_t *)mesg->native)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy attribute")
/* Assign [somewhat arbitrary] creation order value, for older versions
@@ -445,28 +430,23 @@ 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
*
- * Modification:Raymond Lu
- * 23 June 2008
- * If the attribute is in dense storage and has already been
- * opened, make a copy of already opened object to share some
- * object information.
*-------------------------------------------------------------------------
*/
H5A_t *
-H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
+H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name)
{
H5O_t *oh = NULL; /* Pointer to actual object header */
H5O_ainfo_t ainfo; /* Attribute information for object */
@@ -475,38 +455,38 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
htri_t found_open_attr = FALSE; /* Whether opened object is found */
H5A_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, loc->addr, NULL)
+ FUNC_ENTER_PACKAGE_TAG(loc->addr)
/* Check arguments */
HDassert(loc);
HDassert(name);
/* Protect the object header to iterate over */
- if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header")
+ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
if(oh->version > H5O_VERSION_1) {
/* Check for (& retrieve if available) attribute info */
- if(H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo) < 0)
+ if(H5A__get_ainfo(loc->file, oh, &ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't check for attribute info message")
} /* end if */
/* 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)))
+ if(NULL == (opened_attr = H5A__copy(NULL, exist_attr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "can't copy existing attribute")
} /* end else if */
else {
/* Check for attributes in dense storage */
if(H5F_addr_defined(ainfo.fheap_addr)) {
/* Open attribute with dense storage */
- if(NULL == (opened_attr = H5A_dense_open(loc->file, dxpl_id, &ainfo, name)))
+ if(NULL == (opened_attr = H5A__dense_open(loc->file, &ainfo, name)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "can't open attribute")
} /* end if */
else {
@@ -519,8 +499,8 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
/* Iterate over attributes, to locate correct one to open */
op.op_type = H5O_MESG_OP_LIB;
- op.u.lib_op = H5O_attr_open_cb;
- if(H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0)
+ 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")
/* Check that we found the attribute */
@@ -533,7 +513,7 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
} /* end else */
/* Mark datatype as being on disk now */
- if(H5T_set_loc(opened_attr->shared->dt, loc->file, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(opened_attr->shared->dt, H5F_VOL_OBJ(loc->file), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location")
} /* end else */
@@ -541,25 +521,24 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
ret_value = opened_attr;
done:
- if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
+ if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
/* Release any resources, on error */
if(NULL == ret_value && opened_attr)
- if(H5A_close(opened_attr) < 0)
+ if(H5A__close(opened_attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, NULL, "can't close attribute")
- FUNC_LEAVE_NOAPI_TAG(ret_value, NULL)
-} /* end H5O_attr_open_by_name() */
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
+} /* end H5O__attr_open_by_name() */
/*-------------------------------------------------------------------------
- * 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
@@ -568,90 +547,80 @@ 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);
HDassert(ret_attr);
/* Copy attribute information. Shared some attribute information. */
- if(NULL == (*ret_attr = H5A_copy(NULL, attr)))
+ if(NULL == (*ret_attr = H5A__copy(NULL, attr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy attribute")
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
*
- * Modification:Raymond Lu
- * 23 June 2008
- * After opening the attribute, check whether it's in dense
- * storage and has already been opened. If it has, close the
- * opened object and make a copy of already opened object.
*-------------------------------------------------------------------------
*/
H5A_t *
-H5O_attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, hid_t dxpl_id)
+H5O__attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n)
{
- H5O_t *oh = NULL; /* Object header */
H5A_attr_iter_op_t attr_op; /* Attribute operator */
H5A_t *exist_attr = NULL; /* Existing opened attribute object */
H5A_t *opened_attr = NULL; /* Newly opened attribute object */
htri_t found_open_attr = FALSE; /* Whether opened object is found */
H5A_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(loc);
/* 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, dxpl_id, idx_type, order, n, NULL, &attr_op, &opened_attr) < 0)
+ if(H5O_attr_iterate_real((hid_t)-1, loc, idx_type, order, n, NULL, &attr_op, &opened_attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_BADITER, NULL, "can't locate attribute")
- /* Protect the object header to iterate over */
- if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header")
-
/* Find out whether it has already been opened. If it has, close the object
* 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
* and close the object just opened.
*/
if(found_open_attr && exist_attr) {
- if(H5A_close(opened_attr) < 0)
+ if(H5A__close(opened_attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, NULL, "can't close attribute")
- if(NULL == (opened_attr = H5A_copy(NULL, exist_attr)))
+ if(NULL == (opened_attr = H5A__copy(NULL, exist_attr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "can't copy existing attribute")
} else {
/* Mark datatype as being on disk now */
- if(H5T_set_loc(opened_attr->shared->dt, loc->file, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(opened_attr->shared->dt, H5F_VOL_OBJ(loc->file), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location")
} /* end if */
} /* end if */
@@ -660,25 +629,22 @@ H5O_attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
ret_value = opened_attr;
done:
- if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
-
/* Release any resources, on error */
if(NULL == ret_value && opened_attr)
- if(H5A_close(opened_attr) < 0)
+ if(H5A__close(opened_attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, NULL, "can't close attribute")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_open_by_idx() */
+} /* end H5O__attr_open_by_idx() */
/*-------------------------------------------------------------------------
- * 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.
*
@@ -688,14 +654,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)
@@ -717,15 +683,15 @@ 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++) {
unsigned long attr_fnum; /* Attributes file serial number */
/* Get pointer to attribute */
- if(NULL == (*attr = (H5A_t *)H5I_object_verify(attr_id_list[u], H5I_ATTR)))
+ if(NULL == (*attr = (H5A_t *)H5VL_object_verify(attr_id_list[u], H5I_ATTR)))
HGOTO_ERROR(H5E_ATTR, H5E_BADTYPE, FAIL, "not an attribute")
/* Get file serial number for attribute */
@@ -750,15 +716,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
@@ -767,15 +733,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_attr_update_shared(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5A_t *attr,
- H5O_shared_t *update_sh_mesg)
+H5O__attr_update_shared(H5F_t *f, H5O_t *oh, H5A_t *attr, H5O_shared_t *update_sh_mesg)
{
H5O_shared_t sh_mesg; /* Shared object header message */
hsize_t attr_rc; /* Attribute's ref count in shared message storage */
htri_t shared_mesg; /* Whether the message should be shared */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(f);
@@ -791,13 +756,13 @@ H5O_attr_update_shared(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5A_t *attr,
/* Store new version of message as a SOHM */
/* (should always work, since we're not changing the size of the attribute) */
- if((shared_mesg = H5SM_try_share(f, dxpl_id, oh, 0, H5O_ATTR_ID, attr, NULL)) == 0)
+ if((shared_mesg = H5SM_try_share(f, oh, 0, H5O_ATTR_ID, attr, NULL)) == 0)
HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "attribute changed sharing status")
else if(shared_mesg < 0)
HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "can't share attribute")
/* Retrieve shared message storage ref count for new shared attribute */
- if(H5SM_get_refcount(f, dxpl_id, H5O_ATTR_ID, &attr->sh_loc, &attr_rc) < 0)
+ if(H5SM_get_refcount(f, H5O_ATTR_ID, &attr->sh_loc, &attr_rc) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve shared message ref count")
/* If the newly shared attribute needs to share "ownership" of the shared
@@ -809,14 +774,13 @@ H5O_attr_update_shared(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5A_t *attr,
*
* *ick* -QAK, 2007/01/08
*/
- if(attr_rc == 1) {
+ if(attr_rc == 1)
/* Increment reference count on attribute components */
- if(H5O_attr_link(f, dxpl_id, oh, attr) < 0)
+ if(H5O__attr_link(f, oh, attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust attribute link count")
- } /* end if */
/* Remove the old attribute from the SOHM storage */
- if(H5SM_delete(f, dxpl_id, oh, &sh_mesg) < 0)
+ if(H5SM_delete(f, oh, &sh_mesg) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to delete shared attribute in shared storage")
/* Extract updated shared message info from modified attribute, if requested */
@@ -826,29 +790,25 @@ H5O_attr_update_shared(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5A_t *attr,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_update_shared() */
+} /* end H5O__attr_update_shared() */
/*-------------------------------------------------------------------------
- * 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 */
@@ -856,7 +816,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);
@@ -866,11 +826,11 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
/* Check for correct attribute message to modify */
if(0 == HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->attr->shared->name)) {
/* Protect chunk */
- if(NULL == (chk_proxy = H5O_chunk_protect(udata->f, udata->dxpl_id, oh, mesg->chunkno)))
+ if(NULL == (chk_proxy = H5O__chunk_protect(udata->f, oh, mesg->chunkno)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to load object header chunk")
/* Because the attribute structure is shared now. The only situation that requires
- * copying the data is when the metadata cache evicts and reloads this attribute.
+ * copying the data is when the metadata cache evicts and reloads this attribute.
* The shared attribute structure will be different in that situation. SLU-2010/7/29 */
if(((H5A_t *)mesg->native)->shared != udata->attr->shared) {
/* Sanity check */
@@ -880,7 +840,7 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
/* (Needs to occur before updating the shared message, or the hash
* value on the old & new messages will be the same) */
- HDmemcpy(((H5A_t *)mesg->native)->shared->data, udata->attr->shared->data, udata->attr->shared->data_size);
+ H5MM_memcpy(((H5A_t *)mesg->native)->shared->data, udata->attr->shared->data, udata->attr->shared->data_size);
} /* end if */
/* Mark the message as modified */
@@ -888,13 +848,13 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
chk_dirtied = TRUE;
/* Release chunk */
- if(H5O_chunk_unprotect(udata->f, udata->dxpl_id, chk_proxy, chk_dirtied) < 0)
+ if(H5O__chunk_unprotect(udata->f, chk_proxy, chk_dirtied) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk")
chk_proxy = NULL;
/* Update the shared attribute in the SOHM storage */
if(mesg->flags & H5O_MSG_FLAG_SHARED)
- if(H5O_attr_update_shared(udata->f, udata->dxpl_id, oh, udata->attr, (H5O_shared_t *)mesg->native) < 0)
+ if(H5O__attr_update_shared(udata->f, oh, udata->attr, (H5O_shared_t *)mesg->native) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, H5_ITER_ERROR, "unable to update attribute in shared storage")
/* Indicate that the object header was modified */
@@ -909,19 +869,19 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
done:
/* Release chunk, if not already done */
- if(chk_proxy && H5O_chunk_unprotect(udata->f, udata->dxpl_id, chk_proxy, chk_dirtied) < 0)
+ if(chk_proxy && H5O__chunk_unprotect(udata->f, chk_proxy, chk_dirtied) < 0)
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
@@ -929,34 +889,34 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_attr_write(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
+H5O__attr_write(const H5O_loc_t *loc, H5A_t *attr)
{
H5O_t *oh = NULL; /* Pointer to actual object header */
H5O_ainfo_t ainfo; /* Attribute information for object */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(loc);
HDassert(attr);
/* Pin the object header */
- if(NULL == (oh = H5O_pin(loc, dxpl_id)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
+ if(NULL == (oh = H5O_pin(loc)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
if(oh->version > H5O_VERSION_1) {
/* Check for (& retrieve if available) attribute info */
- if(H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo) < 0)
+ if(H5A__get_ainfo(loc->file, oh, &ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message")
} /* end if */
/* Check for attributes stored densely */
if(H5F_addr_defined(ainfo.fheap_addr)) {
/* Modify the attribute data in dense storage */
- if(H5A_dense_write(loc->file, dxpl_id, &ainfo, attr) < 0)
+ if(H5A__dense_write(loc->file, &ainfo, attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute")
} /* end if */
else {
@@ -965,14 +925,13 @@ H5O_attr_write(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
/* Set up user data for callback */
udata.f = loc->file;
- udata.dxpl_id = dxpl_id;
udata.attr = attr;
udata.found = FALSE;
/* Iterate over attributes, to locate correct one to update */
op.op_type = H5O_MESG_OP_LIB;
- op.u.lib_op = H5O_attr_write_cb;
- if(H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0)
+ 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")
/* Check that we found the attribute */
@@ -981,7 +940,7 @@ H5O_attr_write(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
} /* end else */
/* Update the modification time, if any */
- if(H5O_touch_oh(loc->file, dxpl_id, oh, FALSE) < 0)
+ if(H5O_touch_oh(loc->file, oh, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object")
done:
@@ -989,16 +948,16 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_write */
+} /* end H5O__attr_write */
/*-------------------------------------------------------------------------
- * 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
@@ -1007,13 +966,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);
@@ -1030,21 +989,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
@@ -1053,7 +1012,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 */
@@ -1061,7 +1020,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);
@@ -1073,7 +1032,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned old_version = ((H5A_t *)mesg->native)->shared->version; /* Old version of the attribute */
/* Protect chunk */
- if(NULL == (chk_proxy = H5O_chunk_protect(udata->f, udata->dxpl_id, oh, mesg->chunkno)))
+ if(NULL == (chk_proxy = H5O__chunk_protect(udata->f, oh, mesg->chunkno)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to load object header chunk")
/* Change the name for the attribute */
@@ -1081,7 +1040,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
((H5A_t *)mesg->native)->shared->name = H5MM_xstrdup(udata->new_name);
/* Recompute the version to encode the attribute with */
- if(H5A_set_version(udata->f, ((H5A_t *)mesg->native)) < 0)
+ if(H5A__set_version(udata->f, ((H5A_t *)mesg->native)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5_ITER_ERROR, "unable to update attribute version")
/* Mark the message as modified */
@@ -1089,14 +1048,14 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
chk_dirtied = TRUE;
/* Release chunk */
- if(H5O_chunk_unprotect(udata->f, udata->dxpl_id, chk_proxy, chk_dirtied) < 0)
+ if(H5O__chunk_unprotect(udata->f, chk_proxy, chk_dirtied) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk")
chk_proxy = NULL;
/* Check for shared message */
if(mesg->flags & H5O_MSG_FLAG_SHARED) {
/* Update the shared attribute in the SOHM storage */
- if(H5O_attr_update_shared(udata->f, udata->dxpl_id, oh, (H5A_t *)mesg->native, NULL) < 0)
+ if(H5O__attr_update_shared(udata->f, oh, (H5A_t *)mesg->native, NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, H5_ITER_ERROR, "unable to update attribute in shared storage")
} /* end if */
else {
@@ -1122,24 +1081,24 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
mesg->native = NULL;
/* Delete old attribute */
- /* (doesn't decrement the link count on shared components becuase
+ /* (doesn't decrement the link count on shared components because
* the "native" pointer has been reset)
*/
- if(H5O_release_mesg(udata->f, udata->dxpl_id, 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;
/* Append renamed attribute to object header */
/* (Don't let it become shared) */
- if(H5O_msg_append_real(udata->f, udata->dxpl_id, oh, H5O_MSG_ATTR, (mesg->flags | H5O_MSG_FLAG_DONTSHARE), 0, attr) < 0)
+ if(H5O__msg_append_real(udata->f, oh, H5O_MSG_ATTR, (mesg->flags | H5O_MSG_FLAG_DONTSHARE), 0, attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, H5_ITER_ERROR, "unable to relocate renamed attribute in header")
/* Sanity check */
HDassert(H5O_msg_is_shared(H5O_ATTR_ID, attr) == FALSE);
/* Close the local copy of the attribute */
- H5A_close(attr);
+ H5A__close(attr);
} /* end if */
} /* end else */
@@ -1155,19 +1114,19 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
done:
/* Release chunk, if not already done */
- if(chk_proxy && H5O_chunk_unprotect(udata->f, udata->dxpl_id, chk_proxy, chk_dirtied) < 0)
+ if(chk_proxy && H5O__chunk_unprotect(udata->f, chk_proxy, chk_dirtied) < 0)
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
@@ -1175,14 +1134,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, const char *old_name,
+H5O__attr_rename(const H5O_loc_t *loc, const char *old_name,
const char *new_name)
{
H5O_t *oh = NULL; /* Pointer to actual object header */
H5O_ainfo_t ainfo; /* Attribute information for object */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, loc->addr, FAIL)
+ FUNC_ENTER_PACKAGE_TAG(loc->addr)
/* Check arguments */
HDassert(loc);
@@ -1190,21 +1149,21 @@ H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, const char *old_name,
HDassert(new_name);
/* Pin the object header */
- if(NULL == (oh = H5O_pin(loc, dxpl_id)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
+ if(NULL == (oh = H5O_pin(loc)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
if(oh->version > H5O_VERSION_1) {
/* Check for (& retrieve if available) attribute info */
- if(H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo) < 0)
+ if(H5A__get_ainfo(loc->file, oh, &ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message")
} /* end if */
/* Check for attributes stored densely */
if(H5F_addr_defined(ainfo.fheap_addr)) {
/* Rename the attribute data in dense storage */
- if(H5A_dense_rename(loc->file, dxpl_id, &ainfo, old_name, new_name) < 0)
+ if(H5A__dense_rename(loc->file, &ainfo, old_name, new_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute")
} /* end if */
else {
@@ -1213,15 +1172,14 @@ H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, const char *old_name,
/* Set up user data for callback */
udata.f = loc->file;
- udata.dxpl_id = dxpl_id;
udata.old_name = old_name;
udata.new_name = new_name;
udata.found = FALSE;
/* 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;
- if(H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0)
+ 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")
/* If the new name was found, indicate an error */
@@ -1230,8 +1188,8 @@ H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, 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;
- if(H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0)
+ 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")
/* Check that we found the attribute to rename */
@@ -1240,23 +1198,23 @@ H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, const char *old_name,
} /* end else */
/* Update the modification time, if any */
- if(H5O_touch_oh(loc->file, dxpl_id, oh, FALSE) < 0)
+ if(H5O_touch_oh(loc->file, oh, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object")
done:
if(oh && H5O_unpin(oh) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
- FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
-} /* end H5O_attr_rename */
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
+} /* 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
@@ -1264,16 +1222,16 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_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)
+H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, 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)
{
H5O_t *oh = NULL; /* Pointer to actual object header */
H5O_ainfo_t ainfo; /* Attribute information for object */
H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */
herr_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, loc->addr, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT_TAG(loc->addr)
/* Check arguments */
HDassert(loc);
@@ -1282,14 +1240,14 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id,
HDassert(attr_op);
/* Protect the object header to iterate over */
- if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
+ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
if(oh->version > H5O_VERSION_1) {
/* Check for (& retrieve if available) attribute info */
- if(H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo) < 0)
+ if(H5A__get_ainfo(loc->file, oh, &ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message")
} /* end if */
@@ -1300,21 +1258,21 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified")
/* Release the object header */
- if(H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
+ if(H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
oh = NULL;
/* Iterate over attributes in dense storage */
- if((ret_value = H5A_dense_iterate(loc->file, dxpl_id, loc_id, &ainfo, idx_type, order, skip, last_attr, attr_op, op_data)) < 0)
+ if((ret_value = H5A__dense_iterate(loc->file, loc_id, &ainfo, idx_type, order, skip, last_attr, attr_op, op_data)) < 0)
HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
} /* end if */
else {
/* Build table of attributes for compact storage */
- if(H5A_compact_build_table(loc->file, dxpl_id, oh, idx_type, order, &atable) < 0)
+ if(H5A__compact_build_table(loc->file, oh, idx_type, order, &atable) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table")
/* Release the object header */
- if(H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
+ if(H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
oh = NULL;
@@ -1323,27 +1281,27 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified")
/* Iterate over attributes in table */
- if((ret_value = H5A_attr_iterate_table(&atable, skip, last_attr, loc_id, attr_op, op_data)) < 0)
- HERROR(H5E_ATTR, H5E_CANTNEXT, "iteration operator failed");
+ if((ret_value = H5A__attr_iterate_table(&atable, skip, last_attr, loc_id, attr_op, op_data)) < 0)
+ HERROR(H5E_ATTR, H5E_BADITER, "iteration operator failed");
} /* end else */
done:
/* Release resources */
- if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
+ if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
- if(atable.attrs && H5A_attr_release_table(&atable) < 0)
+ if(atable.attrs && H5A__attr_release_table(&atable) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table")
- FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5O_attr_iterate_real() */
/*-------------------------------------------------------------------------
- * 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
@@ -1351,14 +1309,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_attr_iterate(hid_t loc_id, hid_t dxpl_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)
+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)
{
H5G_loc_t loc; /* Object location */
herr_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(attr_op);
@@ -1368,20 +1325,20 @@ H5O_attr_iterate(hid_t loc_id, hid_t dxpl_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
/* Iterate over attributes to locate correct one */
- if((ret_value = H5O_attr_iterate_real(loc_id, loc.oloc, dxpl_id, idx_type, order, skip, last_attr, attr_op, op_data)) < 0)
+ if((ret_value = H5O_attr_iterate_real(loc_id, loc.oloc, idx_type, order, skip, last_attr, attr_op, op_data)) < 0)
HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_iterate() */
+} /* end H5O__attr_iterate() */
/*-------------------------------------------------------------------------
- * 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
@@ -1397,13 +1354,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo,
- hid_t dxpl_id)
+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);
@@ -1419,7 +1375,7 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo,
size_t u; /* Local index */
/* Build the table of attributes for this object */
- if(H5A_dense_build_table(loc->file, dxpl_id, ainfo, H5_INDEX_NAME, H5_ITER_NATIVE, &atable) < 0)
+ if(H5A__dense_build_table(loc->file, ainfo, H5_INDEX_NAME, H5_ITER_NATIVE, &atable) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table")
/* Inspect attributes in table for ones that can't be converted back
@@ -1447,7 +1403,7 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo,
else if(shared_mesg == 0) {
/* Increment reference count on attribute components */
/* (so that they aren't deleted when the dense attribute storage is deleted) */
- if(H5O_attr_link(loc->file, dxpl_id, oh, (atable.attrs[u])) < 0)
+ if(H5O__attr_link(loc->file, oh, (atable.attrs[u])) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust attribute link count")
} /* end if */
else {
@@ -1458,55 +1414,58 @@ 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.
If not, still use the message in the attribute table. */
if(found_open_attr && exist_attr) {
- if(H5O_msg_append_real(loc->file, dxpl_id, oh, H5O_MSG_ATTR, 0, 0, exist_attr) < 0)
+ if(H5O__msg_append_real(loc->file, oh, H5O_MSG_ATTR, 0, 0, exist_attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't create message")
- } else {
- if(H5O_msg_append_real(loc->file, dxpl_id, oh, H5O_MSG_ATTR, 0, 0, (atable.attrs[u])) < 0)
+ } /* end if */
+ else
+ if(H5O__msg_append_real(loc->file, oh, H5O_MSG_ATTR, 0, 0, (atable.attrs[u])) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't create message")
- }
} /* end for */
/* Remove the dense storage */
- if(H5A_dense_delete(loc->file, dxpl_id, ainfo) < 0)
+ if(H5A__dense_delete(loc->file, ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete dense attribute storage")
} /* end if */
} /* end if */
+ /* 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)
+ */
+ 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")
+
/* Check if we have deleted all the attributes and the attribute info
* message should be deleted itself.
*/
if(ainfo->nattrs == 0) {
- if(H5O_msg_remove_real(loc->file, oh, H5O_MSG_AINFO, H5O_ALL, NULL, NULL, TRUE, dxpl_id) < 0)
+ if(H5O__msg_remove_real(loc->file, oh, H5O_MSG_AINFO, H5O_ALL, NULL, NULL, TRUE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute info")
} /* end if */
- else {
- if(H5O_msg_write_real(loc->file, dxpl_id, oh, H5O_MSG_AINFO, H5O_MSG_FLAG_DONTSHARE, 0, ainfo) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info message")
- } /* end else */
done:
/* Release resources */
- if(atable.attrs && H5A_attr_release_table(&atable) < 0)
+ if(atable.attrs && H5A__attr_release_table(&atable) < 0)
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
@@ -1515,13 +1474,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);
@@ -1531,7 +1490,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, udata->dxpl_id, 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 */
@@ -1546,15 +1505,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
@@ -1562,35 +1521,35 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
+H5O__attr_remove(const H5O_loc_t *loc, const char *name)
{
H5O_t *oh = NULL; /* Pointer to actual object header */
H5O_ainfo_t ainfo; /* Attribute information for object */
htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, loc->addr, FAIL)
+ FUNC_ENTER_PACKAGE_TAG(loc->addr)
/* Check arguments */
HDassert(loc);
HDassert(name);
/* Pin the object header */
- if(NULL == (oh = H5O_pin(loc, dxpl_id)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
+ if(NULL == (oh = H5O_pin(loc)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
if(oh->version > H5O_VERSION_1) {
/* Check for (& retrieve if available) attribute info */
- if((ainfo_exists = H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo)) < 0)
+ if((ainfo_exists = H5A__get_ainfo(loc->file, oh, &ainfo)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message")
} /* end if */
/* Check for attributes stored densely */
if(H5F_addr_defined(ainfo.fheap_addr)) {
/* Delete attribute from dense storage */
- if(H5A_dense_remove(loc->file, dxpl_id, &ainfo, name) < 0)
+ if(H5A__dense_remove(loc->file, &ainfo, name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute in dense storage")
} /* end if */
else {
@@ -1599,14 +1558,13 @@ H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
/* Set up user data for callback */
udata.f = loc->file;
- udata.dxpl_id = dxpl_id;
udata.name = name;
udata.found = FALSE;
/* Iterate over attributes, to locate correct one to delete */
op.op_type = H5O_MESG_OP_LIB;
- op.u.lib_op = H5O_attr_remove_cb;
- if(H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0)
+ 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")
/* Check that we found the attribute */
@@ -1616,28 +1574,28 @@ H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
/* Update the attribute information after removing an attribute */
if(ainfo_exists)
- if(H5O_attr_remove_update(loc, oh, &ainfo, dxpl_id) < 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 */
- if(H5O_touch_oh(loc->file, dxpl_id, oh, FALSE) < 0)
+ if(H5O_touch_oh(loc->file, oh, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object")
done:
if(oh && H5O_unpin(oh) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
- FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
-} /* end H5O_attr_remove() */
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
+} /* end H5O__attr_remove() */
/*-------------------------------------------------------------------------
- * 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
@@ -1645,8 +1603,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, hid_t dxpl_id)
+H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n)
{
H5O_t *oh = NULL; /* Pointer to actual object header */
H5O_ainfo_t ainfo; /* Attribute information for object */
@@ -1654,27 +1612,27 @@ H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, loc->addr, FAIL)
+ FUNC_ENTER_PACKAGE_TAG(loc->addr)
/* Check arguments */
HDassert(loc);
/* Pin the object header */
- if(NULL == (oh = H5O_pin(loc, dxpl_id)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
+ if(NULL == (oh = H5O_pin(loc)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
if(oh->version > H5O_VERSION_1) {
/* Check for (& retrieve if available) attribute info */
- if((ainfo_exists = H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo)) < 0)
+ if((ainfo_exists = H5A__get_ainfo(loc->file, oh, &ainfo)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message")
} /* end if */
/* Check for attributes stored densely */
if(H5F_addr_defined(ainfo.fheap_addr)) {
/* Delete attribute from dense storage */
- if(H5A_dense_remove_by_idx(loc->file, dxpl_id, &ainfo, idx_type, order, n) < 0)
+ if(H5A__dense_remove_by_idx(loc->file, &ainfo, idx_type, order, n) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute in dense storage")
} /* end if */
else {
@@ -1682,7 +1640,7 @@ H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
H5O_mesg_operator_t op; /* Wrapper for operator */
/* Build table of attributes for compact storage */
- if(H5A_compact_build_table(loc->file, dxpl_id, oh, idx_type, order, &atable) < 0)
+ if(H5A__compact_build_table(loc->file, oh, idx_type, order, &atable) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table")
/* Check for skipping too many attributes */
@@ -1691,14 +1649,13 @@ H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
/* Set up user data for callback, to remove the attribute by name */
udata.f = loc->file;
- udata.dxpl_id = dxpl_id;
udata.name = ((atable.attrs[n])->shared)->name;
udata.found = FALSE;
/* Iterate over attributes, to locate correct one to delete */
op.op_type = H5O_MESG_OP_LIB;
- op.u.lib_op = H5O_attr_remove_cb;
- if(H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0)
+ 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")
/* Check that we found the attribute */
@@ -1708,29 +1665,29 @@ 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, dxpl_id) < 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 */
- if(H5O_touch_oh(loc->file, dxpl_id, oh, FALSE) < 0)
+ if(H5O_touch_oh(loc->file, oh, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object")
done:
if(oh && H5O_unpin(oh) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
- if(atable.attrs && H5A_attr_release_table(&atable) < 0)
+ if(atable.attrs && H5A__attr_release_table(&atable) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table")
- FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
-} /* end H5O_attr_remove_by_idx() */
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
+} /* end H5O__attr_remove_by_idx() */
/*-------------------------------------------------------------------------
- * 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
@@ -1738,11 +1695,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_attr_count_real(H5F_t *f, hid_t dxpl_id, 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(dxpl_id, oh->cache_info.addr, FAIL)
+ FUNC_ENTER_PACKAGE_TAG(oh->cache_info.addr)
/* Check arguments */
HDassert(f);
@@ -1755,7 +1712,7 @@ H5O_attr_count_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hsize_t *nattrs)
H5O_ainfo_t ainfo; /* Attribute information for object */
/* Attempt to get the attribute information from the object header */
- if((ainfo_exists = H5A_get_ainfo(f, dxpl_id, oh, &ainfo)) < 0)
+ if((ainfo_exists = H5A__get_ainfo(f, oh, &ainfo)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message")
else if(ainfo_exists > 0)
*nattrs = ainfo.nattrs;
@@ -1775,17 +1732,17 @@ H5O_attr_count_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hsize_t *nattrs)
} /* end else */
done:
- FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
-} /* end H5O_attr_count_real */
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
+} /* 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
@@ -1794,13 +1751,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);
@@ -1816,15 +1773,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
@@ -1832,34 +1789,34 @@ H5O_attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
*-------------------------------------------------------------------------
*/
htri_t
-H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
+H5O__attr_exists(const H5O_loc_t *loc, const char *name)
{
H5O_t *oh = NULL; /* Pointer to actual object header */
H5O_ainfo_t ainfo; /* Attribute information for object */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, loc->addr, FAIL)
+ FUNC_ENTER_PACKAGE_TAG(loc->addr)
/* Check arguments */
HDassert(loc);
HDassert(name);
/* Protect the object header to iterate over */
- if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
if(oh->version > H5O_VERSION_1) {
/* Check for (& retrieve if available) attribute info */
- if(H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo) < 0)
+ if(H5A__get_ainfo(loc->file, oh, &ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message")
} /* end if */
/* Check for attributes stored densely */
if(H5F_addr_defined(ainfo.fheap_addr)) {
/* Check if attribute exists in dense storage */
- if((ret_value = H5A_dense_exists(loc->file, dxpl_id, &ainfo, name)) < 0)
+ if((ret_value = H5A__dense_exists(loc->file, &ainfo, name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error checking for existence of attribute")
} /* end if */
else {
@@ -1868,14 +1825,13 @@ H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
/* Set up user data for callback */
udata.f = loc->file;
- udata.dxpl_id = dxpl_id;
udata.name = name;
udata.found = FALSE;
/* 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;
- if(H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0)
+ 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")
/* Check that we found the attribute */
@@ -1883,19 +1839,19 @@ H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
} /* end else */
done:
- if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
+ if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
- FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
-} /* end H5O_attr_exists */
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
+} /* end H5O__attr_exists() */
/*-------------------------------------------------------------------------
- * Function: H5O_attr_bh_info
+ * Function: H5O__attr_bh_info
*
* 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
@@ -1903,14 +1859,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
+H5O__attr_bh_info(H5F_t *f, H5O_t *oh, H5_ih_info_t *bh_info)
{
H5HF_t *fheap = NULL; /* Fractal heap handle */
H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
HDassert(f);
HDassert(oh);
@@ -1922,39 +1878,39 @@ H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */
/* Check for (& retrieve if available) attribute info */
- if((ainfo_exists = H5A_get_ainfo(f, dxpl_id, oh, &ainfo)) < 0)
+ if((ainfo_exists = H5A__get_ainfo(f, oh, &ainfo)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message")
else if(ainfo_exists > 0) {
/* Check if name index available */
if(H5F_addr_defined(ainfo.name_bt2_addr)) {
/* Open the name index v2 B-tree */
- if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo.name_bt2_addr, NULL)))
+ if(NULL == (bt2_name = H5B2_open(f, ainfo.name_bt2_addr, NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
/* Get name index B-tree size */
- if(H5B2_size(bt2_name, dxpl_id, &(bh_info->index_size)) < 0)
+ if(H5B2_size(bt2_name, &(bh_info->index_size)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
} /* end if */
/* Check if creation order index available */
if(H5F_addr_defined(ainfo.corder_bt2_addr)) {
/* Open the creation order index v2 B-tree */
- if(NULL == (bt2_corder = H5B2_open(f, dxpl_id, ainfo.corder_bt2_addr, NULL)))
+ if(NULL == (bt2_corder = H5B2_open(f, ainfo.corder_bt2_addr, NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index")
/* Get creation order index B-tree size */
- if(H5B2_size(bt2_corder, dxpl_id, &(bh_info->index_size)) < 0)
+ if(H5B2_size(bt2_corder, &(bh_info->index_size)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
} /* end if */
/* Get storage size of fractal heap, if it's used */
if(H5F_addr_defined(ainfo.fheap_addr)) {
/* Open the fractal heap for attributes */
- if(NULL == (fheap = H5HF_open(f, dxpl_id, ainfo.fheap_addr)))
+ if(NULL == (fheap = H5HF_open(f, ainfo.fheap_addr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Get heap storage size */
- if(H5HF_size(fheap, dxpl_id, &(bh_info->heap_size)) < 0)
+ if(H5HF_size(fheap, &(bh_info->heap_size)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
} /* end if */
} /* end else */
@@ -1962,24 +1918,24 @@ H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
done:
/* Release resources */
- if(fheap && H5HF_close(fheap, dxpl_id) < 0)
+ if(fheap && H5HF_close(fheap) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap")
- if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0)
+ if(bt2_name && H5B2_close(bt2_name) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index")
- if(bt2_corder && H5B2_close(bt2_corder, dxpl_id) < 0)
+ if(bt2_corder && H5B2_close(bt2_corder) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_attr_bh_info() */
+} /* H5O__attr_bh_info() */
#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
@@ -1987,33 +1943,33 @@ done:
*-------------------------------------------------------------------------
*/
int
-H5O_attr_count(const H5O_loc_t *loc, hid_t dxpl_id)
+H5O__attr_count(const H5O_loc_t *loc)
{
H5O_t *oh = NULL; /* Pointer to actual object header */
hsize_t nattrs; /* Number of attributes */
int ret_value = -1; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(loc);
/* Protect the object header to iterate over */
- if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Retrieve # of attributes on object */
- if(H5O_attr_count_real(loc->file, dxpl_id, 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 */
ret_value = (int)nattrs;
done:
- if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
+ if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_count */
+} /* end H5O__attr_count */
#endif /* H5_NO_DEPRECATED_SYMBOLS */