summaryrefslogtreecommitdiffstats
path: root/src/H5Gcompact.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2018-03-15 21:54:30 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2018-03-15 21:54:30 (GMT)
commit4a17aff4085ad6ee265b95730aca3f493056dec8 (patch)
tree8bfb665c6d95a2e3520fa1bb0ff54d95aff3923f /src/H5Gcompact.c
parent853ae26333592faf69cd8c454ef92ffea8549df5 (diff)
downloadhdf5-4a17aff4085ad6ee265b95730aca3f493056dec8.zip
hdf5-4a17aff4085ad6ee265b95730aca3f493056dec8.tar.gz
hdf5-4a17aff4085ad6ee265b95730aca3f493056dec8.tar.bz2
Add API context interface and use it throughout the library.
Diffstat (limited to 'src/H5Gcompact.c')
-rw-r--r--src/H5Gcompact.c63
1 files changed, 29 insertions, 34 deletions
diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c
index d5698a8..aae5496 100644
--- a/src/H5Gcompact.c
+++ b/src/H5Gcompact.c
@@ -42,7 +42,6 @@ typedef struct {
typedef struct {
/* downward */
H5F_t *file; /* File that object header is located within */
- hid_t dxpl_id; /* DXPL during insertion */
H5RS_str_t *grp_full_path_r;/* Full path for group of link */
const char *name; /* Link name to search for */
} H5G_iter_rm_t;
@@ -61,7 +60,7 @@ typedef struct {
/* PRIVATE PROTOTYPES */
static herr_t H5G_compact_build_table_cb(const void *_mesg, unsigned idx, void *_udata);
-static herr_t H5G_compact_build_table(const H5O_loc_t *oloc, hid_t dxpl_id,
+static herr_t H5G__compact_build_table(const H5O_loc_t *oloc,
const H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order,
H5G_link_table_t *ltable);
@@ -107,7 +106,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G_compact_build_table
+ * Function: H5G__compact_build_table
*
* Purpose: Builds a table containing a sorted (alphabetically) list of
* links for a group
@@ -121,12 +120,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_compact_build_table(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
+H5G__compact_build_table(const H5O_loc_t *oloc, const H5O_linfo_t *linfo,
H5_index_t idx_type, H5_iter_order_t order, H5G_link_table_t *ltable)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(oloc);
@@ -153,7 +152,7 @@ H5G_compact_build_table(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t
/* Iterate through the link messages, adding them to the table */
op.op_type = H5O_MESG_OP_APP;
op.u.app_op = H5G_compact_build_table_cb;
- if(H5O_msg_iterate(oloc, H5O_LINK_ID, &op, &udata, dxpl_id) < 0)
+ if(H5O_msg_iterate(oloc, H5O_LINK_ID, &op, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages")
/* Sort link table in correct iteration order */
@@ -165,7 +164,7 @@ H5G_compact_build_table(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_compact_build_table() */
+} /* end H5G__compact_build_table() */
/*-------------------------------------------------------------------------
@@ -184,8 +183,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G__compact_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk,
- hid_t dxpl_id)
+H5G__compact_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -196,7 +194,7 @@ H5G__compact_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk,
HDassert(obj_lnk);
/* Insert link message into group */
- if(H5O_msg_create(grp_oloc, H5O_LINK_ID, 0, H5O_UPDATE_TIME, obj_lnk, dxpl_id) < 0)
+ if(H5O_msg_create(grp_oloc, H5O_LINK_ID, 0, H5O_UPDATE_TIME, obj_lnk) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
done:
@@ -218,9 +216,9 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5G__compact_get_name_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id,
- const H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order,
- hsize_t idx, char* name, size_t size)
+H5G__compact_get_name_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t idx, char* name,
+ size_t size)
{
H5G_link_table_t ltable = {0, NULL}; /* Link table */
ssize_t ret_value = -1; /* Return value */
@@ -231,7 +229,7 @@ H5G__compact_get_name_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id,
HDassert(oloc);
/* Build table of all link messages */
- if(H5G_compact_build_table(oloc, dxpl_id, linfo, idx_type, order, &ltable) < 0)
+ if(H5G__compact_build_table(oloc, linfo, idx_type, order, &ltable) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table")
/* Check for going out of bounds */
@@ -287,7 +285,7 @@ H5G_compact_remove_common_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, voi
/* If we've found the right link, get the object type */
if(HDstrcmp(lnk->name, udata->name) == 0) {
/* Replace path names for link being removed */
- if(H5G__link_name_replace(udata->file, udata->dxpl_id, udata->grp_full_path_r, lnk) < 0)
+ if(H5G__link_name_replace(udata->file, udata->grp_full_path_r, lnk) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get object type")
/* Stop the iteration, we found the correct link */
@@ -312,7 +310,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G__compact_remove(const H5O_loc_t *oloc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r,
+H5G__compact_remove(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r,
const char *name)
{
H5G_iter_rm_t udata; /* Data to pass through OH iteration */
@@ -325,12 +323,11 @@ H5G__compact_remove(const H5O_loc_t *oloc, hid_t dxpl_id, H5RS_str_t *grp_full_p
/* Initialize data to pass through object header iteration */
udata.file = oloc->file;
- udata.dxpl_id = dxpl_id;
udata.grp_full_path_r = grp_full_path_r;
udata.name = name;
/* Iterate over the link messages to delete the right one */
- if(H5O_msg_remove_op(oloc, H5O_LINK_ID, H5O_FIRST, H5G_compact_remove_common_cb, &udata, TRUE, dxpl_id) < 0)
+ if(H5O_msg_remove_op(oloc, H5O_LINK_ID, H5O_FIRST, H5G_compact_remove_common_cb, &udata, TRUE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link message")
done:
@@ -351,9 +348,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G__compact_remove_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id,
- const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_r, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n)
+H5G__compact_remove_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo,
+ H5RS_str_t *grp_full_path_r, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t n)
{
H5G_link_table_t ltable = {0, NULL};/* Link table */
H5G_iter_rm_t udata; /* Data to pass through OH iteration */
@@ -365,7 +362,7 @@ H5G__compact_remove_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id,
HDassert(linfo);
/* Build table of all link messages, sorted according to desired order */
- if(H5G_compact_build_table(oloc, dxpl_id, linfo, idx_type, order, &ltable) < 0)
+ if(H5G__compact_build_table(oloc, linfo, idx_type, order, &ltable) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table")
/* Check for going out of bounds */
@@ -374,12 +371,11 @@ H5G__compact_remove_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id,
/* Initialize data to pass through object header iteration */
udata.file = oloc->file;
- udata.dxpl_id = dxpl_id;
udata.grp_full_path_r = grp_full_path_r;
udata.name = ltable.lnks[n].name;
/* Iterate over the link messages to delete the right one */
- if(H5O_msg_remove_op(oloc, H5O_LINK_ID, H5O_FIRST, H5G_compact_remove_common_cb, &udata, TRUE, dxpl_id) < 0)
+ if(H5O_msg_remove_op(oloc, H5O_LINK_ID, H5O_FIRST, H5G_compact_remove_common_cb, &udata, TRUE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link message")
done:
@@ -404,7 +400,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G__compact_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
+H5G__compact_iterate(const H5O_loc_t *oloc, const H5O_linfo_t *linfo,
H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk,
H5G_lib_iterate_t op, void *op_data)
{
@@ -419,7 +415,7 @@ H5G__compact_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *li
HDassert(op);
/* Build table of all link messages */
- if(H5G_compact_build_table(oloc, dxpl_id, linfo, idx_type, order, &ltable) < 0)
+ if(H5G__compact_build_table(oloc, linfo, idx_type, order, &ltable) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table")
/* Iterate over links in table */
@@ -496,8 +492,7 @@ done:
*-------------------------------------------------------------------------
*/
htri_t
-H5G__compact_lookup(const H5O_loc_t *oloc, const char *name, H5O_link_t *lnk,
- hid_t dxpl_id)
+H5G__compact_lookup(const H5O_loc_t *oloc, const char *name, H5O_link_t *lnk)
{
H5G_iter_lkp_t udata; /* User data for iteration callback */
H5O_mesg_operator_t op; /* Message operator */
@@ -517,7 +512,7 @@ H5G__compact_lookup(const H5O_loc_t *oloc, const char *name, H5O_link_t *lnk,
/* Iterate through the link messages, adding them to the table */
op.op_type = H5O_MESG_OP_APP;
op.u.app_op = H5G_compact_lookup_cb;
- if(H5O_msg_iterate(oloc, H5O_LINK_ID, &op, &udata, dxpl_id) < 0)
+ if(H5O_msg_iterate(oloc, H5O_LINK_ID, &op, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages")
/* Determine if we found the link we were looking for */
@@ -543,7 +538,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G__compact_lookup_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
+H5G__compact_lookup_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_link_t *lnk)
{
H5G_link_table_t ltable = {0, NULL};/* Link table */
@@ -557,7 +552,7 @@ H5G__compact_lookup_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo
HDassert(lnk);
/* Build table of all link messages, sorted according to desired order */
- if(H5G_compact_build_table(oloc, dxpl_id, linfo, idx_type, order, &ltable) < 0)
+ if(H5G__compact_build_table(oloc, linfo, idx_type, order, &ltable) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table")
/* Check for going out of bounds */
@@ -592,7 +587,7 @@ done:
*-------------------------------------------------------------------------
*/
H5G_obj_t
-H5G__compact_get_type_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
+H5G__compact_get_type_by_idx(H5O_loc_t *oloc, const H5O_linfo_t *linfo,
hsize_t idx)
{
H5G_link_table_t ltable = {0, NULL}; /* Link table */
@@ -604,7 +599,7 @@ H5G__compact_get_type_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *
HDassert(oloc);
/* Build table of all link messages */
- if(H5G_compact_build_table(oloc, dxpl_id, linfo, H5_INDEX_NAME, H5_ITER_INC, &ltable) < 0)
+ if(H5G__compact_build_table(oloc, linfo, H5_INDEX_NAME, H5_ITER_INC, &ltable) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5G_UNKNOWN, "can't create link message table")
/* Check for going out of bounds */
@@ -625,7 +620,7 @@ H5G__compact_get_type_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *
tmp_oloc.addr = ltable.lnks[idx].u.hard.addr;
/* Get the type of the object */
- if(H5O_obj_type(&tmp_oloc, &obj_type, dxpl_id) < 0)
+ if(H5O_obj_type(&tmp_oloc, &obj_type) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type")
/* Map to group object type */