From 3d9e0b86acb27b4aeb21371407b145c692dfd606 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 9 Feb 2012 21:16:52 -0500 Subject: [svn-r21923] Description: Add FUNC_ENTER macros for package-private routines and begin process of switching package routines to use them. All H5G routines are currently finished. Tested on: Mac OSX/64 10.7.3 (amazon) w/debug, production & parallel --- src/H5D.c | 2 +- src/H5Ddeprec.c | 2 +- src/H5Dint.c | 8 +- src/H5Dpkg.h | 2 +- src/H5Fdbg.c | 6 +- src/H5Ftest.c | 2 +- src/H5G.c | 1308 +++++------------------------------------------------ src/H5Gcache.c | 8 +- src/H5Gcompact.c | 80 ++-- src/H5Gdense.c | 120 ++--- src/H5Gdeprec.c | 18 +- src/H5Gent.c | 58 +-- src/H5Gint.c | 1110 ++++++++++++++++++++++++++++++++++++++++++--- src/H5Glink.c | 195 ++------ src/H5Gloc.c | 22 +- src/H5Gname.c | 116 ++++- src/H5Gnode.c | 78 ++-- src/H5Gobj.c | 138 +++--- src/H5Goh.c | 4 +- src/H5Gpkg.h | 235 ++++------ src/H5Gprivate.h | 92 +++- src/H5Groot.c | 8 +- src/H5Gstab.c | 156 +++---- src/H5Gtest.c | 96 ++-- src/H5Gtraverse.c | 34 +- src/H5L.c | 137 +++++- src/H5Lpkg.h | 3 + src/H5Olinfo.c | 12 +- src/H5Olink.c | 5 +- src/H5Ostab.c | 6 +- src/H5Tcommit.c | 10 +- src/H5Tdeprec.c | 2 +- src/H5Tpkg.h | 2 +- src/H5private.h | 24 + test/getname.c | 2 +- test/h5test.c | 2 +- test/links.c | 212 ++++----- test/stab.c | 98 ++-- test/unlink.c | 12 +- 39 files changed, 2229 insertions(+), 2196 deletions(-) diff --git a/src/H5D.c b/src/H5D.c index 4912c25..7cb0cc6 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -166,7 +166,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list") /* Create the new dataset & get its ID */ - if(NULL == (dset = H5D_create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id, H5AC_dxpl_id))) + if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id, H5AC_dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset") diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index fa2e096..7e65149 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -165,7 +165,7 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") /* Build and open the new dataset */ - if(NULL == (dset = H5D_create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id))) + if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") /* Register the new dataset to get an ID for it */ diff --git a/src/H5Dint.c b/src/H5Dint.c index 01fb6ba..f105e0a 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -381,7 +381,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_create_named + * Function: H5D__create_named * * Purpose: Internal routine to create a new dataset. * @@ -395,7 +395,7 @@ done: *------------------------------------------------------------------------- */ H5D_t * -H5D_create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, +H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, const H5S_t *space, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id) { @@ -403,7 +403,7 @@ H5D_create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, H5D_obj_create_t dcrt_info; /* Information for dataset creation */ H5D_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -436,7 +436,7 @@ H5D_create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_create_named() */ +} /* end H5D__create_named() */ /*------------------------------------------------------------------------- diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 84e05cf..16de07f 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -529,7 +529,7 @@ H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_BTREE[1]; H5_DLL H5D_t *H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id); -H5_DLL H5D_t *H5D_create_named(const H5G_loc_t *loc, const char *name, +H5_DLL H5D_t *H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, const H5S_t *space, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id); H5_DLL herr_t H5D_get_space_status(H5D_t *dset, H5D_space_status_t *allocation, diff --git a/src/H5Fdbg.c b/src/H5Fdbg.c index 4605f8d..40d24e5 100644 --- a/src/H5Fdbg.c +++ b/src/H5Fdbg.c @@ -123,13 +123,13 @@ H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth) f->shared->root_grp ? "" : "(none)"); if(f->shared->root_grp) { if(f->shared->sblock->root_ent) /* Use real root group symbol table entry */ - H5G_ent_debug(f->shared->sblock->root_ent, stream, indent + 3, MAX(0, fwidth - 3), NULL); + H5G__ent_debug(f->shared->sblock->root_ent, stream, indent + 3, MAX(0, fwidth - 3), NULL); else { H5O_loc_t *root_oloc; /* Root object location */ H5G_entry_t root_ent; /* Constructed root symbol table entry */ /* Reset the root group entry */ - H5G_ent_reset(&root_ent); + H5G__ent_reset(&root_ent); /* Build up a simulated root group symbol table entry */ root_oloc = H5G_oloc(f->shared->root_grp); @@ -138,7 +138,7 @@ H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth) root_ent.header = root_oloc->addr; /* Display root group symbol table entry info */ - H5G_ent_debug(&root_ent, stream, indent + 3, MAX(0, fwidth - 3), NULL); + H5G__ent_debug(&root_ent, stream, indent + 3, MAX(0, fwidth - 3), NULL); } /* end else */ } /* end if */ diff --git a/src/H5Ftest.c b/src/H5Ftest.c index 5b8a49e..73b00a6 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -146,7 +146,7 @@ H5F_check_cached_stab_test(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Verify the cached stab info */ - if(H5G_verify_cached_stab_test(H5G_oloc(file->shared->root_grp), file->shared->sblock->root_ent) < 0) + if(H5G__verify_cached_stab_test(H5G_oloc(file->shared->root_grp), file->shared->sblock->root_ent) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to verify cached symbol table info") done: diff --git a/src/H5G.c b/src/H5G.c index 4ece047..3883ade 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -91,12 +91,8 @@ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ #include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FOprivate.h" /* File objects */ #include "H5Gpkg.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ @@ -111,34 +107,6 @@ /* Local Typedefs */ /******************/ -/* User data for path traversal routine for "insertion file" routine */ -typedef struct { - H5G_loc_t *loc; /* Pointer to the location for insertion */ -} H5G_trav_ins_t; - -/* User data for application-style iteration over links in a group */ -typedef struct { - hid_t gid; /* The group ID for the application callback */ - H5G_link_iterate_t lnk_op; /* Application callback */ - void *op_data; /* Application's op data */ -} H5G_iter_appcall_ud_t; - -/* User data for recursive traversal over links from a group */ -typedef struct { - hid_t gid; /* The group ID for the starting group */ - H5G_loc_t *curr_loc; /* Location of starting group */ - hid_t lapl_id; /* LAPL for walking across links */ - hid_t dxpl_id; /* DXPL for operations */ - H5_index_t idx_type; /* Index to use */ - H5_iter_order_t order; /* Iteration order within index */ - H5SL_t *visited; /* Skip list for tracking visited nodes */ - char *path; /* Path name of the link */ - size_t curr_path_len; /* Current length of the path in the buffer */ - size_t path_buf_size; /* Size of path buffer */ - H5L_iterate_t op; /* Application callback */ - void *op_data; /* Application's op data */ -} H5G_iter_visit_ud_t; - /********************/ /* Package Typedefs */ @@ -149,20 +117,11 @@ typedef struct { /* Local Prototypes */ /********************/ -static herr_t H5G_open_oid(H5G_t *grp, hid_t dxpl_id); - /*********************/ /* Package Variables */ /*********************/ -/* Declare a free list to manage the H5G_t struct */ -H5FL_DEFINE(H5G_t); -H5FL_DEFINE(H5G_shared_t); - -/* Declare the free list to manage H5_obj_t's */ -H5FL_DEFINE(H5_obj_t); - /*****************************/ /* Library Private Variables */ @@ -176,6 +135,106 @@ H5FL_DEFINE(H5_obj_t); /*------------------------------------------------------------------------- + * Function: H5G__init + * + * Purpose: Initialize the interface from some other package. + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Saturday, November 11, 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5G__init(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + /* FUNC_ENTER() does all the work */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G__init() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_init_interface + * + * Purpose: Initializes the H5G interface. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * Monday, January 5, 1998 + * + * Notes: The group creation properties are registered in the property + * list interface initialization routine (H5P_init_interface) + * so that the file creation property class can inherit from it + * correctly. (Which allows the file creation property list to + * control the group creation properties of the root group of + * a file) QAK - 24/10/2005 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5G_init_interface(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Initialize the atom group for the group IDs */ + if(H5I_register_type(H5I_GROUP, (size_t)H5I_GROUPID_HASHSIZE, H5G_RESERVED_ATOMS, (H5I_free_t)H5G_close) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to initialize interface") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_init_interface() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_term_interface + * + * Purpose: Terminates the H5G interface + * + * Return: Success: Positive if anything is done that might + * affect other interfaces; zero otherwise. + * + * Failure: Negative. + * + * Programmer: Robb Matzke + * Monday, January 5, 1998 + * + *------------------------------------------------------------------------- + */ +int +H5G_term_interface(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5_interface_initialize_g) { + if((n = H5I_nmembers(H5I_GROUP))) + H5I_clear_type(H5I_GROUP, FALSE, FALSE); + else { + /* Destroy the group object id group */ + H5I_dec_type_ref(H5I_GROUP); + + /* Mark closed */ + H5_interface_initialize_g = 0; + n = 1; /*H5I*/ + } /* end else */ + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5G_term_interface() */ + + +/*------------------------------------------------------------------------- * Function: H5Gcreate2 * * Purpose: Creates a new group relative to LOC_ID, giving it the @@ -240,7 +299,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") /* Create the new group & get its ID */ - if(NULL == (grp = H5G_create_named(&loc, name, lcpl_id, gcpl_id, gapl_id, H5AC_dxpl_id))) + if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id, gapl_id, H5AC_dxpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") @@ -255,61 +314,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_create_named - * - * Purpose: Internal routine to create a new "named" group. - * - * Return: Success: Non-NULL, pointer to new group object. - * - * Failure: NULL - * - * Programmer: Quincey Koziol - * April 5, 2007 - * - *------------------------------------------------------------------------- - */ -H5G_t * -H5G_create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, - hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id) -{ - H5O_obj_create_t ocrt_info; /* Information for object creation */ - H5G_obj_create_t gcrt_info; /* Information for group creation */ - H5G_t *ret_value; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - HDassert(lcpl_id != H5P_DEFAULT); - HDassert(gcpl_id != H5P_DEFAULT); - HDassert(gapl_id != H5P_DEFAULT); - HDassert(dxpl_id != H5P_DEFAULT); - - /* Set up group creation info */ - gcrt_info.gcpl_id = gcpl_id; - gcrt_info.cache_type = H5G_NOTHING_CACHED; - HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); - - /* Set up object creation information */ - ocrt_info.obj_type = H5O_TYPE_GROUP; - ocrt_info.crt_info = &gcrt_info; - ocrt_info.new_obj = NULL; - - /* Create the new group and link it to its parent group */ - if(H5L_link_object(loc, name, &ocrt_info, lcpl_id, gapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create and link to group") - HDassert(ocrt_info.new_obj); - - /* Set the return value */ - ret_value = (H5G_t *)ocrt_info.new_obj; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_create_named() */ - - -/*------------------------------------------------------------------------- * Function: H5Gcreate_anon * * Purpose: Creates a new group relative to LOC_ID, giving it the @@ -379,7 +383,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); /* Create the new group & get its ID */ - if(NULL == (grp = H5G_create(loc.oloc->file, &gcrt_info, H5AC_dxpl_id))) + if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info, H5AC_dxpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") @@ -448,7 +452,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") /* Open the group */ - if((grp = H5G_open_name(&loc, name, gapl_id, H5AC_dxpl_id)) == NULL) + if((grp = H5G__open_name(&loc, name, gapl_id, H5AC_dxpl_id)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") /* Register an ID for the group */ @@ -529,7 +533,7 @@ H5Gget_create_plist(hid_t group_id) } /* end if */ /* Check for the group having a link info message */ - if((linfo_exists = H5G_obj_get_linfo(&(grp->oloc), &linfo, H5AC_ind_dxpl_id)) < 0) + if((linfo_exists = H5G__obj_get_linfo(&(grp->oloc), &linfo, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(linfo_exists) { /* Set the link info for the property list */ @@ -601,7 +605,7 @@ H5Gget_info(hid_t grp_id, H5G_info_t *grp_info) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Retrieve the group's information */ - if(H5G_obj_info(loc.oloc, grp_info/*out*/, H5AC_ind_dxpl_id) < 0) + if(H5G__obj_info(loc.oloc, grp_info/*out*/, H5AC_ind_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -660,7 +664,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, loc_found = TRUE; /* Retrieve the group's information */ - if(H5G_obj_info(grp_loc.oloc, grp_info/*out*/, H5AC_ind_dxpl_id) < 0) + if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, H5AC_ind_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -728,7 +732,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_found = TRUE; /* Retrieve the group's information */ - if(H5G_obj_info(grp_loc.oloc, grp_info/*out*/, H5AC_ind_dxpl_id) < 0) + if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, H5AC_ind_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -776,1101 +780,3 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Gclose() */ -/* - *------------------------------------------------------------------------- - *------------------------------------------------------------------------- - * N O A P I F U N C T I O N S B E Y O N D T H I S P O I N T - *------------------------------------------------------------------------- - *------------------------------------------------------------------------- - */ - - -/*------------------------------------------------------------------------- - * Function: H5G_init - * - * Purpose: Initialize the interface from some other package. - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Quincey Koziol - * Saturday, November 11, 2006 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G_init(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - /* FUNC_ENTER() does all the work */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_init() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_init_interface - * - * Purpose: Initializes the H5G interface. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Monday, January 5, 1998 - * - * Notes: The group creation properties are registered in the property - * list interface initialization routine (H5P_init_interface) - * so that the file creation property class can inherit from it - * correctly. (Which allows the file creation property list to - * control the group creation properties of the root group of - * a file) QAK - 24/10/2005 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G_init_interface(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Initialize the atom group for the group IDs */ - if(H5I_register_type(H5I_GROUP, (size_t)H5I_GROUPID_HASHSIZE, H5G_RESERVED_ATOMS, (H5I_free_t)H5G_close) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to initialize interface") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_init_interface() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_term_interface - * - * Purpose: Terminates the H5G interface - * - * Return: Success: Positive if anything is done that might - * affect other interfaces; zero otherwise. - * - * Failure: Negative. - * - * Programmer: Robb Matzke - * Monday, January 5, 1998 - * - *------------------------------------------------------------------------- - */ -int -H5G_term_interface(void) -{ - int n = 0; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - if(H5_interface_initialize_g) { - if((n = H5I_nmembers(H5I_GROUP))) - H5I_clear_type(H5I_GROUP, FALSE, FALSE); - else { - /* Destroy the group object id group */ - H5I_dec_type_ref(H5I_GROUP); - - /* Mark closed */ - H5_interface_initialize_g = 0; - n = 1; /*H5I*/ - } /* end else */ - } /* end if */ - - FUNC_LEAVE_NOAPI(n) -} /* end H5G_term_interface() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_create - * - * Purpose: Creates a new empty group with the specified name. The name - * is either an absolute name or is relative to LOC. - * - * Return: Success: A handle for the group. The group is opened - * and should eventually be close by calling - * H5G_close(). - * - * Failure: NULL - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Aug 11 1997 - * - *------------------------------------------------------------------------- - */ -H5G_t * -H5G_create(H5F_t *file, H5G_obj_create_t *gcrt_info, hid_t dxpl_id) -{ - H5G_t *grp = NULL; /*new group */ - unsigned oloc_init = 0; /* Flag to indicate that the group object location was created successfully */ - H5G_t *ret_value; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* check args */ - HDassert(file); - HDassert(gcrt_info->gcpl_id != H5P_DEFAULT); - HDassert(dxpl_id != H5P_DEFAULT); - - /* create an open group */ - if(NULL == (grp = H5FL_CALLOC(H5G_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - if(NULL == (grp->shared = H5FL_CALLOC(H5G_shared_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - - /* Create the group object header */ - if(H5G_obj_create(file, dxpl_id, gcrt_info, &(grp->oloc)/*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group object header") - oloc_init = 1; /* Indicate that the object location information is valid */ - - /* Add group to list of open objects in file */ - if(H5FO_top_incr(grp->oloc.file, grp->oloc.addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINC, NULL, "can't incr object ref. count") - if(H5FO_insert(grp->oloc.file, grp->oloc.addr, grp->shared, TRUE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, NULL, "can't insert group into list of open objects") - - /* Set the count of times the object is opened */ - grp->shared->fo_count = 1; - - /* Set return value */ - ret_value = grp; - -done: - if(ret_value == NULL) { - /* Check if we need to release the file-oriented symbol table info */ - if(oloc_init) { - if(H5O_dec_rc_by_loc(&(grp->oloc), dxpl_id) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object") - if(H5O_close(&(grp->oloc)) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, NULL, "unable to release object header") - if(H5O_delete(file, dxpl_id, grp->oloc.addr) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTDELETE, NULL, "unable to delete object header") - } /* end if */ - if(grp != NULL) { - if(grp->shared != NULL) - grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); - grp = H5FL_FREE(H5G_t, grp); - } /* end if */ - } /* end if */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_open_name - * - * Purpose: Opens an existing group by name. - * - * Return: Success: Ptr to a new group. - * Failure: NULL - * - * Programmer: Quincey Koziol - * Monday, August 27, 2007 - * - *------------------------------------------------------------------------- - */ -H5G_t * -H5G_open_name(const H5G_loc_t *loc, const char *name, hid_t gapl_id, - hid_t dxpl_id) -{ - H5G_t *grp = NULL; /* Group to open */ - H5G_loc_t grp_loc; /* Location used to open group */ - H5G_name_t grp_path; /* Opened object group hier. path */ - H5O_loc_t grp_oloc; /* Opened object object location */ - hbool_t loc_found = FALSE; /* Location at 'name' found */ - H5O_type_t obj_type; /* Type of object at location */ - H5G_t *ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* Check args */ - HDassert(loc); - HDassert(name); - - /* Set up opened group location to fill in */ - grp_loc.oloc = &grp_oloc; - grp_loc.path = &grp_path; - H5G_loc_reset(&grp_loc); - - /* Find the group object using the gapl passed in */ - if(H5G_loc_find(loc, name, &grp_loc/*out*/, gapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "group not found") - loc_found = TRUE; - - /* Check that the object found is the correct type */ - if(H5O_obj_type(&grp_oloc, &obj_type, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "can't get object type") - if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, NULL, "not a group") - - /* Open the group */ - if((grp = H5G_open(&grp_loc, dxpl_id)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group") - - /* Set return value */ - ret_value = grp; - -done: - if(!ret_value) { - if(loc_found && H5G_loc_free(&grp_loc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, NULL, "can't free location") - } /* end if */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_open_name() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_open - * - * Purpose: Opens an existing group. The group should eventually be - * closed by calling H5G_close(). - * - * Return: Success: Ptr to a new group. - * - * Failure: NULL - * - * Programmer: Robb Matzke - * Monday, January 5, 1998 - * - *------------------------------------------------------------------------- - */ -H5G_t * -H5G_open(const H5G_loc_t *loc, hid_t dxpl_id) -{ - H5G_t *grp = NULL; /* Group opened */ - H5G_shared_t *shared_fo; /* Shared group object */ - H5G_t *ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* Check args */ - HDassert(loc); - - /* Allocate the group structure */ - if(NULL == (grp = H5FL_CALLOC(H5G_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for group") - - /* Shallow copy (take ownership) of the group location object */ - if(H5O_loc_copy(&(grp->oloc), loc->oloc, H5_COPY_SHALLOW) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "can't copy object location") - if(H5G_name_copy(&(grp->path), loc->path, H5_COPY_SHALLOW) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "can't copy path") - - /* Check if group was already open */ - if((shared_fo = (H5G_shared_t *)H5FO_opened(grp->oloc.file, grp->oloc.addr)) == NULL) { - - /* Clear any errors from H5FO_opened() */ - H5E_clear_stack(NULL); - - /* Open the group object */ - if(H5G_open_oid(grp, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "not found") - - /* Add group to list of open objects in file */ - if(H5FO_insert(grp->oloc.file, grp->oloc.addr, grp->shared, FALSE) < 0) { - grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, NULL, "can't insert group into list of open objects") - } /* end if */ - - /* Increment object count for the object in the top file */ - if(H5FO_top_incr(grp->oloc.file, grp->oloc.addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINC, NULL, "can't increment object count") - - /* Set open object count */ - grp->shared->fo_count = 1; - } /* end if */ - else { - /* Point to shared group info */ - grp->shared = shared_fo; - - /* Increment shared reference count */ - shared_fo->fo_count++; - - /* Check if the object has been opened through the top file yet */ - if(H5FO_top_count(grp->oloc.file, grp->oloc.addr) == 0) { - /* Open the object through this top file */ - if(H5O_open(&(grp->oloc)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open object header") - } /* end if */ - - /* Increment object count for the object in the top file */ - if(H5FO_top_incr(grp->oloc.file, grp->oloc.addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINC, NULL, "can't increment object count") - } /* end else */ - - /* Set return value */ - ret_value = grp; - -done: - if(!ret_value && grp) { - H5O_loc_free(&(grp->oloc)); - H5G_name_free(&(grp->path)); - grp = H5FL_FREE(H5G_t, grp); - } /* end if */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_open_oid - * - * Purpose: Opens an existing group. The group should eventually be - * closed by calling H5G_close(). - * - * Return: Success: Ptr to a new group. - * - * Failure: NULL - * - * Programmer: Quincey Koziol - * Wednesday, March 17, 1999 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G_open_oid(H5G_t *grp, hid_t dxpl_id) -{ - hbool_t obj_opened = FALSE; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - /* Check args */ - HDassert(grp); - - /* Allocate the shared information for the group */ - if(NULL == (grp->shared = H5FL_CALLOC(H5G_shared_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - - /* Grab the object header */ - if(H5O_open(&(grp->oloc)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") - obj_opened = TRUE; - - /* Check if this object has the right message(s) to be treated as a group */ - if((H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, dxpl_id) <= 0) - && (H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID, dxpl_id) <= 0)) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "not a group") - -done: - if(ret_value < 0) { - if(obj_opened) - H5O_close(&(grp->oloc)); - if(grp->shared) - grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); - } /* end if */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_open_oid() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_close - * - * Purpose: Closes the specified group. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Monday, January 5, 1998 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G_close(H5G_t *grp) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Check args */ - HDassert(grp && grp->shared); - HDassert(grp->shared->fo_count > 0); - - --grp->shared->fo_count; - - if(0 == grp->shared->fo_count) { - HDassert(grp != H5G_rootof(H5G_fileof(grp))); - - /* Remove the group from the list of opened objects in the file */ - if(H5FO_top_decr(grp->oloc.file, grp->oloc.addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't decrement count for object") - if(H5FO_delete(grp->oloc.file, H5AC_dxpl_id, grp->oloc.addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't remove group from list of open objects") - if(H5O_close(&(grp->oloc)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close") - grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); - } else { - /* Decrement the ref. count for this object in the top file */ - if(H5FO_top_decr(grp->oloc.file, grp->oloc.addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't decrement count for object") - - /* Check reference count for this object in the top file */ - if(H5FO_top_count(grp->oloc.file, grp->oloc.addr) == 0) { - if(H5O_close(&(grp->oloc)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close") - } /* end if */ - else - /* Free object location (i.e. "unhold" the file if appropriate) */ - if(H5O_loc_free(&(grp->oloc)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "problem attempting to free location") - - /* If this group is a mount point and the mount point is the last open - * reference to the group, then attempt to close down the file hierarchy - */ - if(grp->shared->mounted && grp->shared->fo_count == 1) { - /* Attempt to close down the file hierarchy */ - if(H5F_try_close(grp->oloc.file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problem attempting file close") - } /* end if */ - } /* end else */ - - if(H5G_name_free(&(grp->path)) < 0) { - grp = H5FL_FREE(H5G_t, grp); - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't free group entry name") - } /* end if */ - - grp = H5FL_FREE(H5G_t, grp); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_oloc - * - * Purpose: Returns a pointer to the object location for a group. - * - * Return: Success: Ptr to group entry - * Failure: NULL - * - * Programmer: Robb Matzke - * Tuesday, March 24, 1998 - * - *------------------------------------------------------------------------- - */ -H5O_loc_t * -H5G_oloc(H5G_t *grp) -{ - /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(grp ? &(grp->oloc) : NULL) -} /* end H5G_oloc() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_nameof - * - * Purpose: Returns a pointer to the hier. name for a group. - * - * Return: Success: Ptr to hier. name - * Failure: NULL - * - * Programmer: Quincey Koziol - * Monday, September 12, 2005 - * - *------------------------------------------------------------------------- - */ -H5G_name_t * -H5G_nameof(H5G_t *grp) -{ - /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(grp ? &(grp->path) : NULL) -} /* end H5G_nameof() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_fileof - * - * Purpose: Returns the file to which the specified group belongs. - * - * Return: Success: File pointer. - * - * Failure: NULL - * - * Programmer: Robb Matzke - * Tuesday, March 24, 1998 - * - *------------------------------------------------------------------------- - */ -H5F_t * -H5G_fileof(H5G_t *grp) -{ - /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(grp); - - FUNC_LEAVE_NOAPI(grp->oloc.file) -} /* end H5G_fileof() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_get_shared_count - * - * Purpose: Queries the group object's "shared count" - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Tuesday, July 5, 2005 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G_get_shared_count(H5G_t *grp) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* Check args */ - HDassert(grp && grp->shared); - - FUNC_LEAVE_NOAPI(grp->shared->fo_count) -} /* end H5G_get_shared_count() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_mount - * - * Purpose: Sets the 'mounted' flag for a group - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Tuesday, July 19, 2005 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G_mount(H5G_t *grp) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* Check args */ - HDassert(grp && grp->shared); - HDassert(grp->shared->mounted == FALSE); - - /* Set the 'mounted' flag */ - grp->shared->mounted = TRUE; - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_mount() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_mounted - * - * Purpose: Retrieves the 'mounted' flag for a group - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Tuesday, July 15, 2008 - * - *------------------------------------------------------------------------- - */ -hbool_t -H5G_mounted(H5G_t *grp) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* Check args */ - HDassert(grp && grp->shared); - - FUNC_LEAVE_NOAPI(grp->shared->mounted) -} /* end H5G_mounted() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_unmount - * - * Purpose: Resets the 'mounted' flag for a group - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Tuesday, July 19, 2005 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G_unmount(H5G_t *grp) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* Check args */ - HDassert(grp && grp->shared); - HDassert(grp->shared->mounted == TRUE); - - /* Reset the 'mounted' flag */ - grp->shared->mounted = FALSE; - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_unmount() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_iterate_cb - * - * Purpose: Callback function for iterating over links in a group - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * Oct 3, 2005 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G_iterate_cb(const H5O_link_t *lnk, void *_udata) -{ - H5G_iter_appcall_ud_t *udata = (H5G_iter_appcall_ud_t *)_udata; /* User data for callback */ - herr_t ret_value = H5_ITER_ERROR; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Sanity check */ - HDassert(lnk); - HDassert(udata); - - switch(udata->lnk_op.op_type) { -#ifndef H5_NO_DEPRECATED_SYMBOLS - case H5G_LINK_OP_OLD: - /* Make the old-type application callback */ - ret_value = (udata->lnk_op.op_func.op_old)(udata->gid, lnk->name, udata->op_data); - break; -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - - case H5G_LINK_OP_NEW: - { - H5L_info_t info; /* Link info */ - - /* Retrieve the info for the link */ - if(H5G_link_to_info(lnk, &info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get info for link") - - /* Make the application callback */ - ret_value = (udata->lnk_op.op_func.op_new)(udata->gid, lnk->name, &info, udata->op_data); - } - break; - - default: - HDassert(0 && "Unknown link op type?!?"); - } /* end switch */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_iterate_cb() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_iterate - * - * Purpose: Private function for iterating over links in a group - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * Oct 3, 2005 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G_iterate(hid_t loc_id, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, - const H5G_link_iterate_t *lnk_op, void *op_data, hid_t lapl_id, hid_t dxpl_id) -{ - H5G_loc_t loc; /* Location of parent for group */ - hid_t gid = -1; /* ID of group to iterate over */ - H5G_t *grp = NULL; /* Pointer to group data structure to iterate over */ - H5G_iter_appcall_ud_t udata; /* User data for callback */ - herr_t ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity check */ - HDassert(group_name); - HDassert(last_lnk); - HDassert(lnk_op && lnk_op->op_func.op_new); - - /* - * Open the group on which to operate. We also create a group ID which - * we can pass to the application-defined operator. - */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(NULL == (grp = H5G_open_name(&loc, group_name, lapl_id, dxpl_id))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((gid = H5I_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") - - /* Set up user data for callback */ - udata.gid = gid; - udata.lnk_op = *lnk_op; - udata.op_data = op_data; - - /* Call the real group iteration routine */ - if((ret_value = H5G_obj_iterate(&(grp->oloc), idx_type, order, skip, last_lnk, H5G_iterate_cb, &udata, dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "error iterating over links") - -done: - /* Release the group opened */ - if(gid > 0) { - if(H5I_dec_app_ref(gid) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") - } /* end if */ - else if(grp && H5G_close(grp) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_iterate() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_free_visit_visited - * - * Purpose: Free the key for an object visited during a group traversal - * - * Return: Non-negative on success, negative on failure - * - * Programmer: Quincey Koziol - * Nov 4, 2007 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G_free_visit_visited(void *item, void UNUSED *key, void UNUSED *operator_data/*in,out*/) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - item = H5FL_FREE(H5_obj_t, item); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_free_visit_visited() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_visit_cb - * - * Purpose: Callback function for recursively visiting links from a group - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * Nov 4, 2007 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G_visit_cb(const H5O_link_t *lnk, void *_udata) -{ - H5G_iter_visit_ud_t *udata = (H5G_iter_visit_ud_t *)_udata; /* User data for callback */ - H5L_info_t info; /* Link info */ - H5G_loc_t obj_loc; /* Location of object */ - H5G_name_t obj_path; /* Object's group hier. path */ - H5O_loc_t obj_oloc; /* Object's object location */ - hbool_t obj_found = FALSE; /* Object at 'name' found */ - size_t old_path_len = udata->curr_path_len; /* Length of path before appending this link's name */ - size_t link_name_len; /* Length of link's name */ - size_t len_needed; /* Length of path string needed */ - herr_t ret_value = H5_ITER_CONT; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Sanity check */ - HDassert(lnk); - HDassert(udata); - - /* Check if we will need more space to store this link's relative path */ - /* ("+2" is for string terminator and possible '/' for group separator later) */ - link_name_len = HDstrlen(lnk->name); - len_needed = udata->curr_path_len + link_name_len + 2; - if(len_needed > udata->path_buf_size) { - void *new_path; /* Pointer to new path buffer */ - - /* Attempt to allocate larger buffer for path */ - if(NULL == (new_path = H5MM_realloc(udata->path, len_needed))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, H5_ITER_ERROR, "can't allocate path string") - udata->path = (char *)new_path; - udata->path_buf_size = len_needed; - } /* end if */ - - /* Build the link's relative path name */ - HDassert(udata->path[old_path_len] == '\0'); - HDstrcpy(&(udata->path[old_path_len]), lnk->name); - udata->curr_path_len += link_name_len; - - /* Construct the link info from the link message */ - if(H5G_link_to_info(lnk, &info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get info for link") - - /* Make the application callback */ - ret_value = (udata->op)(udata->gid, udata->path, &info, udata->op_data); - - /* Check for doing more work */ - if(ret_value == H5_ITER_CONT && lnk->type == H5L_TYPE_HARD) { - H5_obj_t obj_pos; /* Object "position" for this object */ - - /* Set up opened group location to fill in */ - obj_loc.oloc = &obj_oloc; - obj_loc.path = &obj_path; - H5G_loc_reset(&obj_loc); - - /* Find the object using the LAPL passed in */ - /* (Correctly handles mounted files) */ - if(H5G_loc_find(udata->curr_loc, lnk->name, &obj_loc/*out*/, udata->lapl_id, udata->dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5_ITER_ERROR, "object not found") - obj_found = TRUE; - - /* Construct unique "position" for this object */ - H5F_GET_FILENO(obj_oloc.file, obj_pos.fileno); - obj_pos.addr = obj_oloc.addr; - - /* Check if we've seen the object the link references before */ - if(NULL == H5SL_search(udata->visited, &obj_pos)) { - H5O_type_t otype; /* Basic object type (group, dataset, etc.) */ - unsigned rc; /* Reference count of object */ - - /* Get the object's reference count and type */ - if(H5O_get_rc_and_type(&obj_oloc, udata->dxpl_id, &rc, &otype) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get object info") - - /* If its ref count is > 1, we add it to the list of visited objects */ - /* (because it could come up again during traversal) */ - if(rc > 1) { - H5_obj_t *new_node; /* New object node for visited list */ - - /* Allocate new object "position" node */ - if((new_node = H5FL_MALLOC(H5_obj_t)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, H5_ITER_ERROR, "can't allocate object node") - - /* Set node information */ - *new_node = obj_pos; - - /* Add to list of visited objects */ - if(H5SL_insert(udata->visited, new_node, new_node) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5_ITER_ERROR, "can't insert object node into visited list") - } /* end if */ - - /* If it's a group, we recurse into it */ - if(otype == H5O_TYPE_GROUP) { - H5G_loc_t *old_loc = udata->curr_loc; /* Pointer to previous group location info */ - H5_index_t idx_type = udata->idx_type; /* Type of index to use */ - H5O_linfo_t linfo; /* Link info message */ - htri_t linfo_exists; /* Whether the link info message exists */ - - /* Add the path separator to the current path */ - HDassert(udata->path[udata->curr_path_len] == '\0'); - HDstrcpy(&(udata->path[udata->curr_path_len]), "/"); - udata->curr_path_len++; - - /* Attempt to get the link info for this group */ - if((linfo_exists = H5G_obj_get_linfo(&obj_oloc, &linfo, udata->dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "can't check for link info message") - if(linfo_exists) { - /* Check for creation order tracking, if creation order index lookup requested */ - if(idx_type == H5_INDEX_CRT_ORDER) { - /* Check if creation order is tracked */ - if(!linfo.track_corder) - /* Switch to name order for this group */ - idx_type = H5_INDEX_NAME; - } /* end if */ - else - HDassert(idx_type == H5_INDEX_NAME); - } /* end if */ - else { - /* Can only perform name lookups on groups with symbol tables */ - if(idx_type != H5_INDEX_NAME) - /* Switch to name order for this group */ - idx_type = H5_INDEX_NAME; - } /* end if */ - - /* Point to this group's location info */ - udata->curr_loc = &obj_loc; - - /* Iterate over links in group */ - ret_value = H5G_obj_iterate(&obj_oloc, idx_type, udata->order, (hsize_t)0, NULL, H5G_visit_cb, udata, udata->dxpl_id); - - /* Restore location */ - udata->curr_loc = old_loc; - } /* end if */ - } /* end if */ - } /* end if */ - -done: - /* Reset path back to incoming path */ - udata->path[old_path_len] = '\0'; - udata->curr_path_len = old_path_len; - - /* Release resources */ - if(obj_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, H5_ITER_ERROR, "can't free location") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_visit_cb() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_visit - * - * Purpose: Recursively visit all the links in a group and all - * the groups that are linked to from that group. Links within - * each group are visited according to the order within the - * specified index (unless the specified index does not exist for - * a particular group, then the "name" index is used). - * - * NOTE: Each _link_ reachable from the initial group will only be - * visited once. However, because an object may be reached from - * more than one link, the visitation may call the application's - * callback with more than one link that points to a particular - * _object_. - * - * Return: Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. - * - * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. - * - * - * - * Programmer: Quincey Koziol - * November 4 2007 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type, - H5_iter_order_t order, H5L_iterate_t op, void *op_data, hid_t lapl_id, - hid_t dxpl_id) -{ - H5G_iter_visit_ud_t udata; /* User data for callback */ - H5O_linfo_t linfo; /* Link info message */ - htri_t linfo_exists; /* Whether the link info message exists */ - hid_t gid = (-1); /* Group ID */ - H5G_t *grp = NULL; /* Group opened */ - H5G_loc_t loc; /* Location of group passed in */ - H5G_loc_t start_loc; /* Location of starting group */ - unsigned rc; /* Reference count of object */ - herr_t ret_value; /* Return value */ - - /* Portably clear udata struct (before FUNC_ENTER) */ - HDmemset(&udata, 0, sizeof(udata)); - - FUNC_ENTER_NOAPI(FAIL) - - /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - - /* Open the group to begin visiting within */ - if((grp = H5G_open_name(&loc, group_name, lapl_id, dxpl_id)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") - - /* Register an ID for the starting group */ - if((gid = H5I_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") - - /* Get the location of the starting group */ - if(H5G_loc(gid, &start_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - - /* Set up user data */ - udata.gid = gid; - udata.curr_loc = &start_loc; - udata.lapl_id = lapl_id; - udata.dxpl_id = dxpl_id; - udata.idx_type = idx_type; - udata.order = order; - udata.op = op; - udata.op_data = op_data; - - /* Allocate space for the path name */ - if(NULL == (udata.path = H5MM_strdup(""))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate path name buffer") - udata.path_buf_size = 1; - udata.curr_path_len = 0; - - /* Create skip list to store visited object information */ - if((udata.visited = H5SL_create(H5SL_TYPE_OBJ, NULL)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "can't create skip list for visited objects") - - /* Get the group's reference count */ - if(H5O_get_rc_and_type(&grp->oloc, dxpl_id, &rc, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get object info") - - /* If its ref count is > 1, we add it to the list of visited objects */ - /* (because it could come up again during traversal) */ - if(rc > 1) { - H5_obj_t *obj_pos; /* New object node for visited list */ - - /* Allocate new object "position" node */ - if((obj_pos = H5FL_MALLOC(H5_obj_t)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate object node") - - /* Construct unique "position" for this object */ - H5F_GET_FILENO(grp->oloc.file, obj_pos->fileno); - obj_pos->addr = grp->oloc.addr; - - /* Add to list of visited objects */ - if(H5SL_insert(udata.visited, obj_pos, obj_pos) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert object node into visited list") - } /* end if */ - - /* Attempt to get the link info for this group */ - if((linfo_exists = H5G_obj_get_linfo(&(grp->oloc), &linfo, dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message") - if(linfo_exists) { - /* Check for creation order tracking, if creation order index lookup requested */ - if(idx_type == H5_INDEX_CRT_ORDER) { - /* Check if creation order is tracked */ - if(!linfo.track_corder) - /* Switch to name order for this group */ - idx_type = H5_INDEX_NAME; - } /* end if */ - else - HDassert(idx_type == H5_INDEX_NAME); - } /* end if */ - else { - /* Can only perform name lookups on groups with symbol tables */ - if(idx_type != H5_INDEX_NAME) - /* Switch to name order for this group */ - idx_type = H5_INDEX_NAME; - } /* end if */ - - /* Call the link iteration routine */ - if((ret_value = H5G_obj_iterate(&(grp->oloc), idx_type, order, (hsize_t)0, NULL, H5G_visit_cb, &udata, dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't visit links") - -done: - /* Release user data resources */ - H5MM_xfree(udata.path); - if(udata.visited) - H5SL_destroy(udata.visited, H5G_free_visit_visited, NULL); - - /* Release the group opened */ - if(gid > 0) { - if(H5I_dec_app_ref(gid) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") - } /* end if */ - else if(grp && H5G_close(grp) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_visit() */ - diff --git a/src/H5Gcache.c b/src/H5Gcache.c index 08070aa..1d2ad8b 100644 --- a/src/H5Gcache.c +++ b/src/H5Gcache.c @@ -181,7 +181,7 @@ H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) UINT16DECODE(p, sym->nsyms); /* entries */ - if(H5G_ent_decode_vec(f, &p, sym->entry, sym->nsyms) < 0) + if(H5G__ent_decode_vec(f, &p, sym->entry, sym->nsyms) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "unable to decode symbol table entries") /* Set return value */ @@ -192,7 +192,7 @@ done: if(wb && H5WB_unwrap(wb) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, NULL, "can't close wrapped buffer") if(!ret_value) - if(sym && H5G_node_free(sym) < 0) + if(sym && H5G__node_free(sym) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTFREE, NULL, "unable to destroy symbol table node") FUNC_LEAVE_NOAPI(ret_value) @@ -260,7 +260,7 @@ H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_ UINT16ENCODE(p, sym->nsyms); /* entries */ - if(H5G_ent_encode_vec(f, &p, sym->entry, sym->nsyms) < 0) + if(H5G__ent_encode_vec(f, &p, sym->entry, sym->nsyms) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't serialize") HDmemset(p, 0, sym->node_size - (size_t)(p - node)); @@ -330,7 +330,7 @@ H5G_node_dest(H5F_t *f, H5G_node_t *sym) } /* end if */ /* Destroy symbol table node */ - if(H5G_node_free(sym) < 0) + if(H5G__node_free(sym) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to destroy symbol table node") done: diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c index 32956ef..e4de283 100644 --- a/src/H5Gcompact.c +++ b/src/H5Gcompact.c @@ -159,7 +159,7 @@ H5G_compact_build_table(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages") /* Sort link table in correct iteration order */ - if(H5G_link_sort_table(ltable, idx_type, order) < 0) + if(H5G__link_sort_table(ltable, idx_type, order) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSORT, FAIL, "error sorting link messages") } /* end if */ else @@ -171,7 +171,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_compact_insert + * Function: H5G__compact_insert * * Purpose: Insert a new symbol into the table described by GRP_ENT in * file F. The name of the new symbol is NAME and its symbol @@ -186,12 +186,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_compact_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk, +H5G__compact_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk, hid_t dxpl_id) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check arguments */ HDassert(grp_oloc && grp_oloc->file); @@ -203,11 +203,11 @@ H5G_compact_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_compact_insert() */ +} /* end H5G__compact_insert() */ /*------------------------------------------------------------------------- - * Function: H5G_compact_get_name_by_idx + * Function: H5G__compact_get_name_by_idx * * Purpose: Returns the name of objects in the group by giving index. * @@ -220,14 +220,14 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5G_compact_get_name_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, +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_link_table_t ltable = {0, NULL}; /* Link table */ ssize_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(oloc); @@ -252,11 +252,11 @@ H5G_compact_get_name_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, done: /* Release link table */ - if(ltable.lnks && H5G_link_release_table(<able) < 0) + if(ltable.lnks && H5G__link_release_table(<able) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_compact_get_name_by_idx() */ +} /* end H5G__compact_get_name_by_idx() */ /*------------------------------------------------------------------------- @@ -289,7 +289,7 @@ H5G_compact_remove_common_cb(const void *_mesg, unsigned UNUSED idx, void *_udat /* 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->dxpl_id, 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 */ @@ -302,7 +302,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_compact_remove + * Function: H5G__compact_remove * * Purpose: Remove NAME from links. * @@ -314,13 +314,13 @@ 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, hid_t dxpl_id, H5RS_str_t *grp_full_path_r, const char *name) { H5G_iter_rm_t udata; /* Data to pass through OH iteration */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE HDassert(oloc && oloc->file); HDassert(name && *name); @@ -337,11 +337,11 @@ H5G_compact_remove(const H5O_loc_t *oloc, hid_t dxpl_id, H5RS_str_t *grp_full_pa done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_compact_remove() */ +} /* end H5G__compact_remove() */ /*------------------------------------------------------------------------- - * Function: H5G_compact_remove_by_idx + * Function: H5G__compact_remove_by_idx * * Purpose: Remove link from group, according to an index order. * @@ -353,7 +353,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_compact_remove_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id, +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) { @@ -361,7 +361,7 @@ H5G_compact_remove_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id, H5G_iter_rm_t udata; /* Data to pass through OH iteration */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE HDassert(oloc && oloc->file); HDassert(linfo); @@ -386,15 +386,15 @@ H5G_compact_remove_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id, done: /* Release link table */ - if(ltable.lnks && H5G_link_release_table(<able) < 0) + if(ltable.lnks && H5G__link_release_table(<able) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_compact_remove_by_idx() */ +} /* end H5G__compact_remove_by_idx() */ /*------------------------------------------------------------------------- - * Function: H5G_compact_iterate + * Function: H5G__compact_iterate * * Purpose: Iterate over the links in a group * @@ -406,14 +406,14 @@ 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, hid_t dxpl_id, 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) { H5G_link_table_t ltable = {0, NULL}; /* Link table */ herr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(oloc); @@ -425,16 +425,16 @@ H5G_compact_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *lin HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table") /* Iterate over links in table */ - if((ret_value = H5G_link_iterate_table(<able, skip, last_lnk, op, op_data)) < 0) + if((ret_value = H5G__link_iterate_table(<able, skip, last_lnk, op, op_data)) < 0) HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed"); done: /* Release link table */ - if(ltable.lnks && H5G_link_release_table(<able) < 0) + if(ltable.lnks && H5G__link_release_table(<able) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_compact_iterate() */ +} /* end H5G__compact_iterate() */ /*------------------------------------------------------------------------- @@ -485,7 +485,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_compact_lookup + * Function: H5G__compact_lookup * * Purpose: Look up an object relative to a group, using link messages. * @@ -498,14 +498,14 @@ done: *------------------------------------------------------------------------- */ htri_t -H5G_compact_lookup(H5O_loc_t *oloc, const char *name, H5O_link_t *lnk, +H5G__compact_lookup(const H5O_loc_t *oloc, const char *name, H5O_link_t *lnk, hid_t dxpl_id) { H5G_iter_lkp_t udata; /* User data for iteration callback */ H5O_mesg_operator_t op; /* Message operator */ htri_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check arguments */ HDassert(lnk && oloc->file); @@ -527,11 +527,11 @@ H5G_compact_lookup(H5O_loc_t *oloc, const char *name, H5O_link_t *lnk, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_compact_lookup() */ +} /* end H5G__compact_lookup() */ /*------------------------------------------------------------------------- - * Function: H5G_compact_lookup_by_idx + * Function: H5G__compact_lookup_by_idx * * Purpose: Look up an object in a group using link messages, * according to the order of an index @@ -545,13 +545,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_compact_lookup_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo, +H5G__compact_lookup_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 n, H5O_link_t *lnk) { H5G_link_table_t ltable = {0, NULL};/* Link table */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check arguments */ HDassert(oloc && oloc->file); @@ -572,16 +572,16 @@ H5G_compact_lookup_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *lin done: /* Release link table */ - if(ltable.lnks && H5G_link_release_table(<able) < 0) + if(ltable.lnks && H5G__link_release_table(<able) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_compact_lookup_by_idx() */ +} /* end H5G__compact_lookup_by_idx() */ #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- - * Function: H5G_compact_get_type_by_idx + * Function: H5G__compact_get_type_by_idx * * Purpose: Returns the type of objects in the group by giving index. * @@ -594,13 +594,13 @@ 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, hid_t dxpl_id, const H5O_linfo_t *linfo, hsize_t idx) { H5G_link_table_t ltable = {0, NULL}; /* Link table */ H5G_obj_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5G_UNKNOWN) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(oloc); @@ -639,10 +639,10 @@ H5G_compact_get_type_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *l done: /* Release link table */ - if(ltable.lnks && H5G_link_release_table(<able) < 0) + if(ltable.lnks && H5G__link_release_table(<able) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5G_UNKNOWN, "unable to release link table") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_compact_get_type_by_idx() */ +} /* end H5G__compact_get_type_by_idx() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Gdense.c b/src/H5Gdense.c index 4fbb1e2..841b4d3 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -254,7 +254,7 @@ typedef struct { /*------------------------------------------------------------------------- - * Function: H5G_dense_create + * Function: H5G__dense_create * * Purpose: Creates dense link storage structures for a group * @@ -267,7 +267,7 @@ typedef struct { *------------------------------------------------------------------------- */ herr_t -H5G_dense_create(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, +H5G__dense_create(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, const H5O_pline_t *pline) { H5HF_create_t fheap_cparam; /* Fractal heap creation parameters */ @@ -278,7 +278,7 @@ H5G_dense_create(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, size_t fheap_id_len; /* Fractal heap ID length */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -367,11 +367,11 @@ done: HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_create() */ +} /* end H5G__dense_create() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_insert + * Function: H5G__dense_insert * * Purpose: Insert a link into the dense link storage structures for a group * @@ -384,7 +384,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, +H5G__dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, const H5O_link_t *lnk) { H5G_bt2_ud_ins_t udata; /* User data for v2 B-tree insertion */ @@ -397,7 +397,7 @@ H5G_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, void *link_ptr = NULL; /* Pointer to serialized link */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -480,7 +480,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_insert() */ +} /* end H5G__dense_insert() */ /*------------------------------------------------------------------------- @@ -521,7 +521,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_lookup + * Function: H5G__dense_lookup * * Purpose: Look up a link within a group that uses dense link storage * @@ -534,7 +534,7 @@ done: *------------------------------------------------------------------------- */ htri_t -H5G_dense_lookup(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, +H5G__dense_lookup(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, const char *name, H5O_link_t *lnk) { H5G_bt2_ud_common_t udata; /* User data for v2 B-tree link lookup */ @@ -542,7 +542,7 @@ H5G_dense_lookup(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ htri_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -581,7 +581,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_lookup() */ +} /* end H5G__dense_lookup() */ /*------------------------------------------------------------------------- @@ -664,7 +664,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_lookup_by_idx + * Function: H5G__dense_lookup_by_idx * * Purpose: Look up a link within a group that uses dense link storage, * according to the order of an index @@ -678,7 +678,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_dense_lookup_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, +H5G__dense_lookup_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_link_t *lnk) { H5HF_t *fheap = NULL; /* Fractal heap handle */ @@ -687,7 +687,7 @@ H5G_dense_lookup_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, haddr_t bt2_addr; /* Address of v2 B-tree to use for lookup */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -748,7 +748,7 @@ H5G_dense_lookup_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, } /* end if */ else { /* Otherwise, we need to build a table of the links and sort it */ /* Build the table of links for this group */ - if(H5G_dense_build_table(f, dxpl_id, linfo, idx_type, order, <able) < 0) + if(H5G__dense_build_table(f, dxpl_id, linfo, idx_type, order, <able) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "error building table of links") /* Check for going out of bounds */ @@ -766,11 +766,11 @@ done: HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap") if(bt2 && H5B2_close(bt2, dxpl_id) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index") - if(ltable.lnks && H5G_link_release_table(<able) < 0) + if(ltable.lnks && H5G__link_release_table(<able) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_lookup_by_idx() */ +} /* end H5G__dense_lookup_by_idx() */ /*------------------------------------------------------------------------- @@ -814,7 +814,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_build_table + * Function: H5G__dense_build_table * * Purpose: Builds a table containing a sorted list of links for a group * @@ -830,12 +830,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, +H5G__dense_build_table(H5F_t *f, hid_t dxpl_id, 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_PACKAGE /* Sanity check */ HDassert(f); @@ -859,11 +859,11 @@ H5G_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, udata.curr_lnk = 0; /* Iterate over the links in the group, building a table of the link messages */ - if(H5G_dense_iterate(f, dxpl_id, linfo, H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)0, NULL, H5G_dense_build_table_cb, &udata) < 0) + if(H5G__dense_iterate(f, dxpl_id, linfo, H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)0, NULL, H5G_dense_build_table_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links") /* Sort link table in correct iteration order */ - if(H5G_link_sort_table(ltable, idx_type, order) < 0) + if(H5G__link_sort_table(ltable, idx_type, order) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSORT, FAIL, "error sorting link messages") } /* end if */ else @@ -871,7 +871,7 @@ H5G_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_build_table() */ +} /* end H5G__dense_build_table() */ /*------------------------------------------------------------------------- @@ -970,7 +970,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_iterate + * Function: H5G__dense_iterate * * Purpose: Iterate over the objects in a group using dense link storage * @@ -983,7 +983,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_dense_iterate(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, +H5G__dense_iterate(H5F_t *f, hid_t dxpl_id, 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) { @@ -993,7 +993,7 @@ H5G_dense_iterate(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, haddr_t bt2_addr; /* Address of v2 B-tree to use for lookup */ herr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1065,11 +1065,11 @@ H5G_dense_iterate(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, } /* end if */ else { /* Build the table of links for this group */ - if(H5G_dense_build_table(f, dxpl_id, linfo, idx_type, order, <able) < 0) + if(H5G__dense_build_table(f, dxpl_id, linfo, idx_type, order, <able) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "error building table of links") /* Iterate over links in table */ - if((ret_value = H5G_link_iterate_table(<able, skip, last_lnk, op, op_data)) < 0) + if((ret_value = H5G__link_iterate_table(<able, skip, last_lnk, op, op_data)) < 0) HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed"); } /* end else */ @@ -1079,11 +1079,11 @@ done: HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap") if(bt2 && H5B2_close(bt2, dxpl_id) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index") - if(ltable.lnks && H5G_link_release_table(<able) < 0) + if(ltable.lnks && H5G__link_release_table(<able) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_iterate() */ +} /* end H5G__dense_iterate() */ /*------------------------------------------------------------------------- @@ -1175,7 +1175,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_get_name_by_idx + * Function: H5G__dense_get_name_by_idx * * Purpose: Returns the name of objects in the group by giving index. * @@ -1189,7 +1189,7 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5G_dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, +H5G__dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name, size_t size) { @@ -1199,7 +1199,7 @@ H5G_dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, haddr_t bt2_addr; /* Address of v2 B-tree to use for lookup */ ssize_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1263,7 +1263,7 @@ H5G_dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, } /* end if */ else { /* Otherwise, we need to build a table of the links and sort it */ /* Build the table of links for this group */ - if(H5G_dense_build_table(f, dxpl_id, linfo, idx_type, order, <able) < 0) + if(H5G__dense_build_table(f, dxpl_id, linfo, idx_type, order, <able) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "error building table of links") /* Check for going out of bounds */ @@ -1287,11 +1287,11 @@ done: HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap") if(bt2 && H5B2_close(bt2, dxpl_id) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index") - if(ltable.lnks && H5G_link_release_table(<able) < 0) + if(ltable.lnks && H5G__link_release_table(<able) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_get_name_by_idx() */ +} /* end H5G__dense_get_name_by_idx() */ /*------------------------------------------------------------------------- @@ -1340,7 +1340,7 @@ H5G_dense_remove_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata) /* Replace open objects' names, if requested */ if(udata->replace_names) - if(H5G_link_name_replace(udata->f, udata->dxpl_id, udata->grp_full_path_r, lnk) < 0) + if(H5G__link_name_replace(udata->f, udata->dxpl_id, udata->grp_full_path_r, lnk) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTRENAME, FAIL, "unable to rename open objects") /* Perform the deletion action on the link, if requested */ @@ -1405,7 +1405,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_remove + * Function: H5G__dense_remove * * Purpose: Remove a link from the dense storage of a group * @@ -1418,7 +1418,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, +H5G__dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_r, const char *name) { H5HF_t *fheap = NULL; /* Fractal heap handle */ @@ -1426,7 +1426,7 @@ H5G_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1468,7 +1468,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_remove() */ +} /* end H5G__dense_remove() */ /*------------------------------------------------------------------------- @@ -1588,7 +1588,7 @@ H5G_dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) } /* end if */ /* Replace open objects' names */ - if(H5G_link_name_replace(bt2_udata->f, bt2_udata->dxpl_id, bt2_udata->grp_full_path_r, fh_udata.lnk) < 0) + if(H5G__link_name_replace(bt2_udata->f, bt2_udata->dxpl_id, bt2_udata->grp_full_path_r, fh_udata.lnk) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTRENAME, FAIL, "unable to rename open objects") /* Perform the deletion action on the link */ @@ -1613,7 +1613,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_remove_by_idx + * Function: H5G__dense_remove_by_idx * * Purpose: Remove a link from the dense storage of a group, according to * to the offset in an indexed order @@ -1627,7 +1627,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, +H5G__dense_remove_by_idx(H5F_t *f, 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) { @@ -1637,7 +1637,7 @@ H5G_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, haddr_t bt2_addr; /* Address of v2 B-tree to use for lookup */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1699,7 +1699,7 @@ H5G_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, } /* end if */ else { /* Otherwise, we need to build a table of the links and sort it */ /* Build the table of links for this group */ - if(H5G_dense_build_table(f, dxpl_id, linfo, idx_type, order, <able) < 0) + if(H5G__dense_build_table(f, dxpl_id, linfo, idx_type, order, <able) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "error building table of links") /* Check for going out of bounds */ @@ -1707,7 +1707,7 @@ H5G_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound") /* Remove the appropriate link from the dense storage */ - if(H5G_dense_remove(f, dxpl_id, linfo, grp_full_path_r, ltable.lnks[n].name) < 0) + if(H5G__dense_remove(f, dxpl_id, linfo, grp_full_path_r, ltable.lnks[n].name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from dense storage") } /* end else */ @@ -1717,15 +1717,15 @@ done: HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap") if(bt2 && H5B2_close(bt2, dxpl_id) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index") - if(ltable.lnks && H5G_link_release_table(<able) < 0) + if(ltable.lnks && H5G__link_release_table(<able) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_remove_by_idx() */ +} /* end H5G__dense_remove_by_idx() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_delete + * Function: H5G__dense_delete * * Purpose: Delete the dense storage for a group * @@ -1738,11 +1738,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, hbool_t adj_link) +H5G__dense_delete(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, hbool_t adj_link) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1808,12 +1808,12 @@ H5G_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, hbool_t adj_link) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_delete() */ +} /* end H5G__dense_delete() */ #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- - * Function: H5G_dense_get_type_by_idx + * Function: H5G__dense_get_type_by_idx * * Purpose: Returns the type of objects in the group by giving index. * @@ -1833,13 +1833,13 @@ done: *------------------------------------------------------------------------- */ H5G_obj_t -H5G_dense_get_type_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, +H5G__dense_get_type_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, hsize_t idx) { H5G_link_table_t ltable = {0, NULL}; /* Table of links */ H5G_obj_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5G_UNKNOWN) + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1848,7 +1848,7 @@ H5G_dense_get_type_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, HDassert(linfo); /* Build the table of links for this group */ - if(H5G_dense_build_table(f, dxpl_id, linfo, H5_INDEX_NAME, H5_ITER_INC, <able) < 0) + if(H5G__dense_build_table(f, dxpl_id, linfo, H5_INDEX_NAME, H5_ITER_INC, <able) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "error building table of links") /* Check for going out of bounds */ @@ -1881,10 +1881,10 @@ H5G_dense_get_type_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, done: /* Release link table */ - if(ltable.lnks && H5G_link_release_table(<able) < 0) + if(ltable.lnks && H5G__link_release_table(<able) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5G_UNKNOWN, "unable to release link table") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_get_type_by_idx() */ +} /* end H5G__dense_get_type_by_idx() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 6df31bb..9473011 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -116,7 +116,7 @@ RETURNS Non-negative on success/Negative on failure DESCRIPTION Initializes any interface-specific data or routines. (Just calls - H5G_init() currently). + H5G__init() currently). --------------------------------------------------------------------------*/ static herr_t @@ -124,7 +124,7 @@ H5G_init_deprec_interface(void) { FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(H5G_init()) + FUNC_LEAVE_NOAPI(H5G__init()) } /* H5G_init_deprec_interface() */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -245,7 +245,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) tmp_gcpl = H5P_GROUP_CREATE_DEFAULT; /* Create the new group & get its ID */ - if(NULL == (grp = H5G_create_named(&loc, name, H5P_LINK_CREATE_DEFAULT, + if(NULL == (grp = H5G__create_named(&loc, name, H5P_LINK_CREATE_DEFAULT, tmp_gcpl, H5P_GROUP_ACCESS_DEFAULT, H5AC_dxpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) @@ -298,7 +298,7 @@ H5Gopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Open the group */ - if((grp = H5G_open_name(&loc, name, H5P_DEFAULT, H5AC_dxpl_id)) == NULL) + if((grp = H5G__open_name(&loc, name, H5P_DEFAULT, H5AC_dxpl_id)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") /* Register an atom for the group */ @@ -826,7 +826,7 @@ H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad pointer to # of objects") /* Retrieve information about the group */ - if(H5G_obj_info(loc.oloc, &grp_info, H5AC_ind_dxpl_id) < 0) + if(H5G__obj_info(loc.oloc, &grp_info, H5AC_ind_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine") /* Set the number of objects [sic: links] in the group */ @@ -1148,23 +1148,23 @@ H5G_obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id) HDassert(oloc); /* Attempt to get the link info for this group */ - if((linfo_exists = H5G_obj_get_linfo(oloc, &linfo, dxpl_id)) < 0) + if((linfo_exists = H5G__obj_get_linfo(oloc, &linfo, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't check for link info message") if(linfo_exists) { if(H5F_addr_defined(linfo.fheap_addr)) { /* Get the object's name from the dense link storage */ - if((ret_value = H5G_dense_get_type_by_idx(oloc->file, dxpl_id, &linfo, idx)) < 0) + if((ret_value = H5G__dense_get_type_by_idx(oloc->file, dxpl_id, &linfo, idx)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type") } /* end if */ else { /* Get the object's type from the link messages */ - if((ret_value = H5G_compact_get_type_by_idx(oloc, dxpl_id, &linfo, idx)) < 0) + if((ret_value = H5G__compact_get_type_by_idx(oloc, dxpl_id, &linfo, idx)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type") } /* end else */ } /* end if */ else { /* Get the object's type from the symbol table */ - if((ret_value = H5G_stab_get_type_by_idx(oloc, idx, dxpl_id)) < 0) + if((ret_value = H5G__stab_get_type_by_idx(oloc, idx, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type") } /* end else */ diff --git a/src/H5Gent.c b/src/H5Gent.c index 3304e05..3e3b995 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -76,7 +76,7 @@ H5FL_BLK_EXTERN(str_buf); /*------------------------------------------------------------------------- - * Function: H5G_ent_decode_vec + * Function: H5G__ent_decode_vec * * Purpose: Same as H5G_ent_decode() except it does it for an array of * symbol table entries. @@ -93,12 +93,12 @@ H5FL_BLK_EXTERN(str_buf); *------------------------------------------------------------------------- */ herr_t -H5G_ent_decode_vec(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, unsigned n) +H5G__ent_decode_vec(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, unsigned n) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check arguments */ HDassert(f); @@ -112,7 +112,7 @@ H5G_ent_decode_vec(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, unsigne done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_ent_decode_vec() */ +} /* end H5G__ent_decode_vec() */ /*------------------------------------------------------------------------- @@ -181,7 +181,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_ent_encode_vec + * Function: H5G__ent_encode_vec * * Purpose: Same as H5G_ent_encode() except it does it for an array of * symbol table entries. @@ -198,12 +198,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_ent_encode_vec(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsigned n) +H5G__ent_encode_vec(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsigned n) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check arguments */ HDassert(f); @@ -217,7 +217,7 @@ H5G_ent_encode_vec(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsigne done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5G_ent_encode_vec() */ +} /* H5G__ent_encode_vec() */ /*------------------------------------------------------------------------- @@ -296,7 +296,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_ent_copy + * Function: H5G__ent_copy * * Purpose: Do a deep copy of symbol table entries * @@ -319,10 +319,10 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5G_ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, H5_copy_depth_t depth) +void +H5G__ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, H5_copy_depth_t depth) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ HDassert(src); @@ -338,15 +338,15 @@ H5G_ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, H5_copy_depth_t depth) ; } else if(depth == H5_COPY_SHALLOW) { /* Discarding 'const' qualifier OK - QAK */ - H5G_ent_reset((H5G_entry_t *)src); + H5G__ent_reset((H5G_entry_t *)src); } /* end if */ - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_ent_copy() */ + FUNC_LEAVE_NOAPI_VOID +} /* end H5G__ent_copy() */ /*------------------------------------------------------------------------- - * Function: H5G_ent_reset + * Function: H5G__ent_reset * * Purpose: Reset a symbol table entry to an empty state * @@ -358,10 +358,10 @@ H5G_ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, H5_copy_depth_t depth) * *------------------------------------------------------------------------- */ -herr_t -H5G_ent_reset(H5G_entry_t *ent) +void +H5G__ent_reset(H5G_entry_t *ent) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(ent); @@ -371,11 +371,11 @@ H5G_ent_reset(H5G_entry_t *ent) ent->header = HADDR_UNDEF; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_ent_reset() */ +} /* end H5G__ent_reset() */ /*------------------------------------------------------------------------- - * Function: H5G_ent_convert + * Function: H5G__ent_convert * * Purpose: Convert a link to a symbol table entry * @@ -389,14 +389,14 @@ H5G_ent_reset(H5G_entry_t *ent) *------------------------------------------------------------------------- */ herr_t -H5G_ent_convert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, const char *name, +H5G__ent_convert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, const char *name, const H5O_link_t *lnk, H5O_type_t obj_type, const void *crt_info, H5G_entry_t *ent) { size_t name_offset; /* Offset of name in heap */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check arguments */ HDassert(f); @@ -405,7 +405,7 @@ H5G_ent_convert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, const char *name, HDassert(lnk); /* Reset the new entry */ - H5G_ent_reset(ent); + H5G__ent_reset(ent); /* * Add the new name to the heap. @@ -523,11 +523,11 @@ H5G_ent_convert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, const char *name, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_ent_convert() */ +} /* end H5G__ent_convert() */ /*------------------------------------------------------------------------- - * Function: H5G_ent_debug + * Function: H5G__ent_debug * * Purpose: Prints debugging information about a symbol table entry. * @@ -540,13 +540,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_ent_debug(const H5G_entry_t *ent, FILE *stream, int indent, int fwidth, +H5G__ent_debug(const H5G_entry_t *ent, FILE *stream, int indent, int fwidth, const H5HL_t *heap) { const char *lval = NULL; int nested_indent, nested_fwidth; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Calculate the indent & field width values for nested information */ nested_indent = indent + 3; @@ -603,5 +603,5 @@ H5G_ent_debug(const H5G_entry_t *ent, FILE *stream, int indent, int fwidth, } /* end switch */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_ent_debug() */ +} /* end H5G__ent_debug() */ diff --git a/src/H5Gint.c b/src/H5Gint.c index 2271432..ad2e57e 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -39,7 +39,10 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ +#include "H5FOprivate.h" /* File objects */ #include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ @@ -52,6 +55,34 @@ /* Local Typedefs */ /******************/ +/* User data for path traversal routine for "insertion file" routine */ +typedef struct { + H5G_loc_t *loc; /* Pointer to the location for insertion */ +} H5G_trav_ins_t; + +/* User data for application-style iteration over links in a group */ +typedef struct { + hid_t gid; /* The group ID for the application callback */ + H5G_link_iterate_t lnk_op; /* Application callback */ + void *op_data; /* Application's op data */ +} H5G_iter_appcall_ud_t; + +/* User data for recursive traversal over links from a group */ +typedef struct { + hid_t gid; /* The group ID for the starting group */ + H5G_loc_t *curr_loc; /* Location of starting group */ + hid_t lapl_id; /* LAPL for walking across links */ + hid_t dxpl_id; /* DXPL for operations */ + H5_index_t idx_type; /* Index to use */ + H5_iter_order_t order; /* Iteration order within index */ + H5SL_t *visited; /* Skip list for tracking visited nodes */ + char *path; /* Path name of the link */ + size_t curr_path_len; /* Current length of the path in the buffer */ + size_t path_buf_size; /* Size of path buffer */ + H5L_iterate_t op; /* Application callback */ + void *op_data; /* Application's op data */ +} H5G_iter_visit_ud_t; + /********************/ /* Package Typedefs */ @@ -62,11 +93,20 @@ /* Local Prototypes */ /********************/ +static herr_t H5G_open_oid(H5G_t *grp, hid_t dxpl_id); + /*********************/ /* Package Variables */ /*********************/ +/* Declare a free list to manage the H5G_t struct */ +H5FL_DEFINE(H5G_t); +H5FL_DEFINE(H5G_shared_t); + +/* Declare the free list to manage H5_obj_t's */ +H5FL_DEFINE(H5_obj_t); + /*****************************/ /* Library Private Variables */ @@ -88,7 +128,7 @@ RETURNS Non-negative on success/Negative on failure DESCRIPTION Initializes any interface-specific data or routines. (Just calls - H5G_init() currently). + H5G__init() currently). --------------------------------------------------------------------------*/ static herr_t @@ -98,8 +138,8 @@ H5G_init_int_interface(void) FUNC_ENTER_NOAPI_NOINIT - /* Funnel all work to H5G_init() */ - if(H5G_init() < 0) + /* Funnel all work to H5G__init() */ + if(H5G__init() < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "interface initialization failed") done: @@ -108,16 +148,71 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_component + * Function: H5G__create_named + * + * Purpose: Internal routine to create a new "named" group. + * + * Return: Success: Non-NULL, pointer to new group object. + * + * Failure: NULL + * + * Programmer: Quincey Koziol + * April 5, 2007 + * + *------------------------------------------------------------------------- + */ +H5G_t * +H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, + hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id) +{ + H5O_obj_create_t ocrt_info; /* Information for object creation */ + H5G_obj_create_t gcrt_info; /* Information for group creation */ + H5G_t *ret_value; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check arguments */ + HDassert(loc); + HDassert(name && *name); + HDassert(lcpl_id != H5P_DEFAULT); + HDassert(gcpl_id != H5P_DEFAULT); + HDassert(gapl_id != H5P_DEFAULT); + HDassert(dxpl_id != H5P_DEFAULT); + + /* Set up group creation info */ + gcrt_info.gcpl_id = gcpl_id; + gcrt_info.cache_type = H5G_NOTHING_CACHED; + HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); + + /* Set up object creation information */ + ocrt_info.obj_type = H5O_TYPE_GROUP; + ocrt_info.crt_info = &gcrt_info; + ocrt_info.new_obj = NULL; + + /* Create the new group and link it to its parent group */ + if(H5L_link_object(loc, name, &ocrt_info, lcpl_id, gapl_id, dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create and link to group") + HDassert(ocrt_info.new_obj); + + /* Set the return value */ + ret_value = (H5G_t *)ocrt_info.new_obj; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G__create_named() */ + + +/*------------------------------------------------------------------------- + * Function: H5G__create * - * Purpose: Returns the pointer to the first component of the - * specified name by skipping leading slashes. Returns - * the size in characters of the component through SIZE_P not - * counting leading slashes or the null terminator. + * Purpose: Creates a new empty group with the specified name. The name + * is either an absolute name or is relative to LOC. * - * Return: Success: Ptr into NAME. + * Return: Success: A handle for the group. The group is opened + * and should eventually be close by calling + * H5G_close(). * - * Failure: Ptr to the null terminator of NAME. + * Failure: NULL * * Programmer: Robb Matzke * matzke@llnl.gov @@ -125,83 +220,974 @@ done: * *------------------------------------------------------------------------- */ -const char * -H5G_component(const char *name, size_t *size_p) +H5G_t * +H5G__create(H5F_t *file, H5G_obj_create_t *gcrt_info, hid_t dxpl_id) +{ + H5G_t *grp = NULL; /*new group */ + unsigned oloc_init = 0; /* Flag to indicate that the group object location was created successfully */ + H5G_t *ret_value; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* check args */ + HDassert(file); + HDassert(gcrt_info->gcpl_id != H5P_DEFAULT); + HDassert(dxpl_id != H5P_DEFAULT); + + /* create an open group */ + if(NULL == (grp = H5FL_CALLOC(H5G_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + if(NULL == (grp->shared = H5FL_CALLOC(H5G_shared_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + + /* Create the group object header */ + if(H5G__obj_create(file, dxpl_id, gcrt_info, &(grp->oloc)/*out*/) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group object header") + oloc_init = 1; /* Indicate that the object location information is valid */ + + /* Add group to list of open objects in file */ + if(H5FO_top_incr(grp->oloc.file, grp->oloc.addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINC, NULL, "can't incr object ref. count") + if(H5FO_insert(grp->oloc.file, grp->oloc.addr, grp->shared, TRUE) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, NULL, "can't insert group into list of open objects") + + /* Set the count of times the object is opened */ + grp->shared->fo_count = 1; + + /* Set return value */ + ret_value = grp; + +done: + if(ret_value == NULL) { + /* Check if we need to release the file-oriented symbol table info */ + if(oloc_init) { + if(H5O_dec_rc_by_loc(&(grp->oloc), dxpl_id) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object") + if(H5O_close(&(grp->oloc)) < 0) + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, NULL, "unable to release object header") + if(H5O_delete(file, dxpl_id, grp->oloc.addr) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTDELETE, NULL, "unable to delete object header") + } /* end if */ + if(grp != NULL) { + if(grp->shared != NULL) + grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); + grp = H5FL_FREE(H5G_t, grp); + } /* end if */ + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G__create() */ + + +/*------------------------------------------------------------------------- + * Function: H5G__open_name + * + * Purpose: Opens an existing group by name. + * + * Return: Success: Ptr to a new group. + * Failure: NULL + * + * Programmer: Quincey Koziol + * Monday, August 27, 2007 + * + *------------------------------------------------------------------------- + */ +H5G_t * +H5G__open_name(const H5G_loc_t *loc, const char *name, hid_t gapl_id, + hid_t dxpl_id) +{ + H5G_t *grp = NULL; /* Group to open */ + H5G_loc_t grp_loc; /* Location used to open group */ + H5G_name_t grp_path; /* Opened object group hier. path */ + H5O_loc_t grp_oloc; /* Opened object object location */ + hbool_t loc_found = FALSE; /* Location at 'name' found */ + H5O_type_t obj_type; /* Type of object at location */ + H5G_t *ret_value; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check args */ + HDassert(loc); + HDassert(name); + + /* Set up opened group location to fill in */ + grp_loc.oloc = &grp_oloc; + grp_loc.path = &grp_path; + H5G_loc_reset(&grp_loc); + + /* Find the group object using the gapl passed in */ + if(H5G_loc_find(loc, name, &grp_loc/*out*/, gapl_id, dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "group not found") + loc_found = TRUE; + + /* Check that the object found is the correct type */ + if(H5O_obj_type(&grp_oloc, &obj_type, dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "can't get object type") + if(obj_type != H5O_TYPE_GROUP) + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, NULL, "not a group") + + /* Open the group */ + if((grp = H5G_open(&grp_loc, dxpl_id)) == NULL) + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group") + + /* Set return value */ + ret_value = grp; + +done: + if(!ret_value) { + if(loc_found && H5G_loc_free(&grp_loc) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, NULL, "can't free location") + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G__open_name() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_open + * + * Purpose: Opens an existing group. The group should eventually be + * closed by calling H5G_close(). + * + * Return: Success: Ptr to a new group. + * + * Failure: NULL + * + * Programmer: Robb Matzke + * Monday, January 5, 1998 + * + *------------------------------------------------------------------------- + */ +H5G_t * +H5G_open(const H5G_loc_t *loc, hid_t dxpl_id) +{ + H5G_t *grp = NULL; /* Group opened */ + H5G_shared_t *shared_fo; /* Shared group object */ + H5G_t *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Check args */ + HDassert(loc); + + /* Allocate the group structure */ + if(NULL == (grp = H5FL_CALLOC(H5G_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for group") + + /* Shallow copy (take ownership) of the group location object */ + if(H5O_loc_copy(&(grp->oloc), loc->oloc, H5_COPY_SHALLOW) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "can't copy object location") + if(H5G_name_copy(&(grp->path), loc->path, H5_COPY_SHALLOW) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "can't copy path") + + /* Check if group was already open */ + if((shared_fo = (H5G_shared_t *)H5FO_opened(grp->oloc.file, grp->oloc.addr)) == NULL) { + + /* Clear any errors from H5FO_opened() */ + H5E_clear_stack(NULL); + + /* Open the group object */ + if(H5G_open_oid(grp, dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "not found") + + /* Add group to list of open objects in file */ + if(H5FO_insert(grp->oloc.file, grp->oloc.addr, grp->shared, FALSE) < 0) { + grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, NULL, "can't insert group into list of open objects") + } /* end if */ + + /* Increment object count for the object in the top file */ + if(H5FO_top_incr(grp->oloc.file, grp->oloc.addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINC, NULL, "can't increment object count") + + /* Set open object count */ + grp->shared->fo_count = 1; + } /* end if */ + else { + /* Point to shared group info */ + grp->shared = shared_fo; + + /* Increment shared reference count */ + shared_fo->fo_count++; + + /* Check if the object has been opened through the top file yet */ + if(H5FO_top_count(grp->oloc.file, grp->oloc.addr) == 0) { + /* Open the object through this top file */ + if(H5O_open(&(grp->oloc)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open object header") + } /* end if */ + + /* Increment object count for the object in the top file */ + if(H5FO_top_incr(grp->oloc.file, grp->oloc.addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINC, NULL, "can't increment object count") + } /* end else */ + + /* Set return value */ + ret_value = grp; + +done: + if(!ret_value && grp) { + H5O_loc_free(&(grp->oloc)); + H5G_name_free(&(grp->path)); + grp = H5FL_FREE(H5G_t, grp); + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_open_oid + * + * Purpose: Opens an existing group. The group should eventually be + * closed by calling H5G_close(). + * + * Return: Success: Ptr to a new group. + * + * Failure: NULL + * + * Programmer: Quincey Koziol + * Wednesday, March 17, 1999 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5G_open_oid(H5G_t *grp, hid_t dxpl_id) +{ + hbool_t obj_opened = FALSE; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + /* Check args */ + HDassert(grp); + + /* Allocate the shared information for the group */ + if(NULL == (grp->shared = H5FL_CALLOC(H5G_shared_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + + /* Grab the object header */ + if(H5O_open(&(grp->oloc)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") + obj_opened = TRUE; + + /* Check if this object has the right message(s) to be treated as a group */ + if((H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, dxpl_id) <= 0) + && (H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID, dxpl_id) <= 0)) + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "not a group") + +done: + if(ret_value < 0) { + if(obj_opened) + H5O_close(&(grp->oloc)); + if(grp->shared) + grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_open_oid() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_close + * + * Purpose: Closes the specified group. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * Monday, January 5, 1998 + * + *------------------------------------------------------------------------- + */ +herr_t +H5G_close(H5G_t *grp) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check args */ + HDassert(grp && grp->shared); + HDassert(grp->shared->fo_count > 0); + + --grp->shared->fo_count; + + if(0 == grp->shared->fo_count) { + HDassert(grp != H5G_rootof(H5G_fileof(grp))); + + /* Remove the group from the list of opened objects in the file */ + if(H5FO_top_decr(grp->oloc.file, grp->oloc.addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't decrement count for object") + if(H5FO_delete(grp->oloc.file, H5AC_dxpl_id, grp->oloc.addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't remove group from list of open objects") + if(H5O_close(&(grp->oloc)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close") + grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); + } else { + /* Decrement the ref. count for this object in the top file */ + if(H5FO_top_decr(grp->oloc.file, grp->oloc.addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't decrement count for object") + + /* Check reference count for this object in the top file */ + if(H5FO_top_count(grp->oloc.file, grp->oloc.addr) == 0) { + if(H5O_close(&(grp->oloc)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close") + } /* end if */ + else + /* Free object location (i.e. "unhold" the file if appropriate) */ + if(H5O_loc_free(&(grp->oloc)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "problem attempting to free location") + + /* If this group is a mount point and the mount point is the last open + * reference to the group, then attempt to close down the file hierarchy + */ + if(grp->shared->mounted && grp->shared->fo_count == 1) { + /* Attempt to close down the file hierarchy */ + if(H5F_try_close(grp->oloc.file) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problem attempting file close") + } /* end if */ + } /* end else */ + + if(H5G_name_free(&(grp->path)) < 0) { + grp = H5FL_FREE(H5G_t, grp); + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't free group entry name") + } /* end if */ + + grp = H5FL_FREE(H5G_t, grp); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_oloc + * + * Purpose: Returns a pointer to the object location for a group. + * + * Return: Success: Ptr to group entry + * Failure: NULL + * + * Programmer: Robb Matzke + * Tuesday, March 24, 1998 + * + *------------------------------------------------------------------------- + */ +H5O_loc_t * +H5G_oloc(H5G_t *grp) { /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - assert(name); + FUNC_LEAVE_NOAPI(grp ? &(grp->oloc) : NULL) +} /* end H5G_oloc() */ - while ('/' == *name) - name++; - if (size_p) - *size_p = HDstrcspn(name, "/"); + +/*------------------------------------------------------------------------- + * Function: H5G_nameof + * + * Purpose: Returns a pointer to the hier. name for a group. + * + * Return: Success: Ptr to hier. name + * Failure: NULL + * + * Programmer: Quincey Koziol + * Monday, September 12, 2005 + * + *------------------------------------------------------------------------- + */ +H5G_name_t * +H5G_nameof(H5G_t *grp) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(name) -} /* end H5G_component() */ + FUNC_LEAVE_NOAPI(grp ? &(grp->path) : NULL) +} /* end H5G_nameof() */ /*------------------------------------------------------------------------- - * Function: H5G_normalize + * Function: H5G_fileof + * + * Purpose: Returns the file to which the specified group belongs. * - * Purpose: Returns a pointer to a new string which has duplicate and - * trailing slashes removed from it. + * Return: Success: File pointer. * - * Return: Success: Ptr to normalized name. * Failure: NULL * + * Programmer: Robb Matzke + * Tuesday, March 24, 1998 + * + *------------------------------------------------------------------------- + */ +H5F_t * +H5G_fileof(H5G_t *grp) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(grp); + + FUNC_LEAVE_NOAPI(grp->oloc.file) +} /* end H5G_fileof() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_get_shared_count + * + * Purpose: Queries the group object's "shared count" + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Tuesday, July 5, 2005 + * + *------------------------------------------------------------------------- + */ +herr_t +H5G_get_shared_count(H5G_t *grp) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Check args */ + HDassert(grp && grp->shared); + + FUNC_LEAVE_NOAPI(grp->shared->fo_count) +} /* end H5G_get_shared_count() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_mount + * + * Purpose: Sets the 'mounted' flag for a group + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Tuesday, July 19, 2005 + * + *------------------------------------------------------------------------- + */ +herr_t +H5G_mount(H5G_t *grp) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Check args */ + HDassert(grp && grp->shared); + HDassert(grp->shared->mounted == FALSE); + + /* Set the 'mounted' flag */ + grp->shared->mounted = TRUE; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5G_mount() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_mounted + * + * Purpose: Retrieves the 'mounted' flag for a group + * + * Return: Non-negative on success/Negative on failure + * * Programmer: Quincey Koziol - * Saturday, August 16, 2003 + * Tuesday, July 15, 2008 * *------------------------------------------------------------------------- */ -char * -H5G_normalize(const char *name) +hbool_t +H5G_mounted(H5G_t *grp) { - char *norm; /* Pointer to the normalized string */ - size_t s,d; /* Positions within the strings */ - unsigned last_slash; /* Flag to indicate last character was a slash */ - char *ret_value; /* Return value */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Check args */ + HDassert(grp && grp->shared); + + FUNC_LEAVE_NOAPI(grp->shared->mounted) +} /* end H5G_mounted() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_unmount + * + * Purpose: Resets the 'mounted' flag for a group + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Tuesday, July 19, 2005 + * + *------------------------------------------------------------------------- + */ +herr_t +H5G_unmount(H5G_t *grp) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Check args */ + HDassert(grp && grp->shared); + HDassert(grp->shared->mounted == TRUE); + + /* Reset the 'mounted' flag */ + grp->shared->mounted = FALSE; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5G_unmount() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_iterate_cb + * + * Purpose: Callback function for iterating over links in a group + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Oct 3, 2005 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5G_iterate_cb(const H5O_link_t *lnk, void *_udata) +{ + H5G_iter_appcall_ud_t *udata = (H5G_iter_appcall_ud_t *)_udata; /* User data for callback */ + herr_t ret_value = H5_ITER_ERROR; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Sanity check */ - HDassert(name); + HDassert(lnk); + HDassert(udata); - /* Duplicate the name, to return */ - if(NULL == (norm = H5MM_strdup(name))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for normalized string") - - /* Walk through the characters, omitting duplicated '/'s */ - s = d = 0; - last_slash = 0; - while(name[s] != '\0') { - if(name[s] == '/') - if(last_slash) - ; - else { - norm[d++] = name[s]; - last_slash = 1; - } /* end else */ - else { - norm[d++] = name[s]; - last_slash = 0; - } /* end else */ - s++; - } /* end while */ - - /* Terminate normalized string */ - norm[d] = '\0'; - - /* Check for final '/' on normalized name & eliminate it */ - if(d > 1 && last_slash) - norm[d - 1] = '\0'; + switch(udata->lnk_op.op_type) { +#ifndef H5_NO_DEPRECATED_SYMBOLS + case H5G_LINK_OP_OLD: + /* Make the old-type application callback */ + ret_value = (udata->lnk_op.op_func.op_old)(udata->gid, lnk->name, udata->op_data); + break; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Set return value */ - ret_value = norm; + case H5G_LINK_OP_NEW: + { + H5L_info_t info; /* Link info */ + + /* Retrieve the info for the link */ + if(H5G_link_to_info(lnk, &info) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get info for link") + + /* Make the application callback */ + ret_value = (udata->lnk_op.op_func.op_new)(udata->gid, lnk->name, &info, udata->op_data); + } + break; + + default: + HDassert(0 && "Unknown link op type?!?"); + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_normalize() */ +} /* end H5G_iterate_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_iterate + * + * Purpose: Private function for iterating over links in a group + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Oct 3, 2005 + * + *------------------------------------------------------------------------- + */ +herr_t +H5G_iterate(hid_t loc_id, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, + const H5G_link_iterate_t *lnk_op, void *op_data, hid_t lapl_id, hid_t dxpl_id) +{ + H5G_loc_t loc; /* Location of parent for group */ + hid_t gid = -1; /* ID of group to iterate over */ + H5G_t *grp = NULL; /* Pointer to group data structure to iterate over */ + H5G_iter_appcall_ud_t udata; /* User data for callback */ + herr_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(group_name); + HDassert(last_lnk); + HDassert(lnk_op && lnk_op->op_func.op_new); + + /* + * Open the group on which to operate. We also create a group ID which + * we can pass to the application-defined operator. + */ + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(NULL == (grp = H5G__open_name(&loc, group_name, lapl_id, dxpl_id))) + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") + if((gid = H5I_register(H5I_GROUP, grp, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") + + /* Set up user data for callback */ + udata.gid = gid; + udata.lnk_op = *lnk_op; + udata.op_data = op_data; + + /* Call the real group iteration routine */ + if((ret_value = H5G__obj_iterate(&(grp->oloc), idx_type, order, skip, last_lnk, H5G_iterate_cb, &udata, dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "error iterating over links") + +done: + /* Release the group opened */ + if(gid > 0) { + if(H5I_dec_app_ref(gid) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") + } /* end if */ + else if(grp && H5G_close(grp) < 0) + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_iterate() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_free_visit_visited + * + * Purpose: Free the key for an object visited during a group traversal + * + * Return: Non-negative on success, negative on failure + * + * Programmer: Quincey Koziol + * Nov 4, 2007 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5G_free_visit_visited(void *item, void UNUSED *key, void UNUSED *operator_data/*in,out*/) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + item = H5FL_FREE(H5_obj_t, item); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5G_free_visit_visited() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_visit_cb + * + * Purpose: Callback function for recursively visiting links from a group + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Nov 4, 2007 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5G_visit_cb(const H5O_link_t *lnk, void *_udata) +{ + H5G_iter_visit_ud_t *udata = (H5G_iter_visit_ud_t *)_udata; /* User data for callback */ + H5L_info_t info; /* Link info */ + H5G_loc_t obj_loc; /* Location of object */ + H5G_name_t obj_path; /* Object's group hier. path */ + H5O_loc_t obj_oloc; /* Object's object location */ + hbool_t obj_found = FALSE; /* Object at 'name' found */ + size_t old_path_len = udata->curr_path_len; /* Length of path before appending this link's name */ + size_t link_name_len; /* Length of link's name */ + size_t len_needed; /* Length of path string needed */ + herr_t ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Sanity check */ + HDassert(lnk); + HDassert(udata); + + /* Check if we will need more space to store this link's relative path */ + /* ("+2" is for string terminator and possible '/' for group separator later) */ + link_name_len = HDstrlen(lnk->name); + len_needed = udata->curr_path_len + link_name_len + 2; + if(len_needed > udata->path_buf_size) { + void *new_path; /* Pointer to new path buffer */ + + /* Attempt to allocate larger buffer for path */ + if(NULL == (new_path = H5MM_realloc(udata->path, len_needed))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, H5_ITER_ERROR, "can't allocate path string") + udata->path = (char *)new_path; + udata->path_buf_size = len_needed; + } /* end if */ + + /* Build the link's relative path name */ + HDassert(udata->path[old_path_len] == '\0'); + HDstrcpy(&(udata->path[old_path_len]), lnk->name); + udata->curr_path_len += link_name_len; + + /* Construct the link info from the link message */ + if(H5G_link_to_info(lnk, &info) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get info for link") + + /* Make the application callback */ + ret_value = (udata->op)(udata->gid, udata->path, &info, udata->op_data); + + /* Check for doing more work */ + if(ret_value == H5_ITER_CONT && lnk->type == H5L_TYPE_HARD) { + H5_obj_t obj_pos; /* Object "position" for this object */ + + /* Set up opened group location to fill in */ + obj_loc.oloc = &obj_oloc; + obj_loc.path = &obj_path; + H5G_loc_reset(&obj_loc); + + /* Find the object using the LAPL passed in */ + /* (Correctly handles mounted files) */ + if(H5G_loc_find(udata->curr_loc, lnk->name, &obj_loc/*out*/, udata->lapl_id, udata->dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5_ITER_ERROR, "object not found") + obj_found = TRUE; + + /* Construct unique "position" for this object */ + H5F_GET_FILENO(obj_oloc.file, obj_pos.fileno); + obj_pos.addr = obj_oloc.addr; + + /* Check if we've seen the object the link references before */ + if(NULL == H5SL_search(udata->visited, &obj_pos)) { + H5O_type_t otype; /* Basic object type (group, dataset, etc.) */ + unsigned rc; /* Reference count of object */ + + /* Get the object's reference count and type */ + if(H5O_get_rc_and_type(&obj_oloc, udata->dxpl_id, &rc, &otype) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get object info") + + /* If its ref count is > 1, we add it to the list of visited objects */ + /* (because it could come up again during traversal) */ + if(rc > 1) { + H5_obj_t *new_node; /* New object node for visited list */ + + /* Allocate new object "position" node */ + if((new_node = H5FL_MALLOC(H5_obj_t)) == NULL) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, H5_ITER_ERROR, "can't allocate object node") + + /* Set node information */ + *new_node = obj_pos; + + /* Add to list of visited objects */ + if(H5SL_insert(udata->visited, new_node, new_node) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5_ITER_ERROR, "can't insert object node into visited list") + } /* end if */ + + /* If it's a group, we recurse into it */ + if(otype == H5O_TYPE_GROUP) { + H5G_loc_t *old_loc = udata->curr_loc; /* Pointer to previous group location info */ + H5_index_t idx_type = udata->idx_type; /* Type of index to use */ + H5O_linfo_t linfo; /* Link info message */ + htri_t linfo_exists; /* Whether the link info message exists */ + + /* Add the path separator to the current path */ + HDassert(udata->path[udata->curr_path_len] == '\0'); + HDstrcpy(&(udata->path[udata->curr_path_len]), "/"); + udata->curr_path_len++; + + /* Attempt to get the link info for this group */ + if((linfo_exists = H5G__obj_get_linfo(&obj_oloc, &linfo, udata->dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "can't check for link info message") + if(linfo_exists) { + /* Check for creation order tracking, if creation order index lookup requested */ + if(idx_type == H5_INDEX_CRT_ORDER) { + /* Check if creation order is tracked */ + if(!linfo.track_corder) + /* Switch to name order for this group */ + idx_type = H5_INDEX_NAME; + } /* end if */ + else + HDassert(idx_type == H5_INDEX_NAME); + } /* end if */ + else { + /* Can only perform name lookups on groups with symbol tables */ + if(idx_type != H5_INDEX_NAME) + /* Switch to name order for this group */ + idx_type = H5_INDEX_NAME; + } /* end if */ + + /* Point to this group's location info */ + udata->curr_loc = &obj_loc; + + /* Iterate over links in group */ + ret_value = H5G__obj_iterate(&obj_oloc, idx_type, udata->order, (hsize_t)0, NULL, H5G_visit_cb, udata, udata->dxpl_id); + + /* Restore location */ + udata->curr_loc = old_loc; + } /* end if */ + } /* end if */ + } /* end if */ + +done: + /* Reset path back to incoming path */ + udata->path[old_path_len] = '\0'; + udata->curr_path_len = old_path_len; + + /* Release resources */ + if(obj_found && H5G_loc_free(&obj_loc) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, H5_ITER_ERROR, "can't free location") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_visit_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_visit + * + * Purpose: Recursively visit all the links in a group and all + * the groups that are linked to from that group. Links within + * each group are visited according to the order within the + * specified index (unless the specified index does not exist for + * a particular group, then the "name" index is used). + * + * NOTE: Each _link_ reachable from the initial group will only be + * visited once. However, because an object may be reached from + * more than one link, the visitation may call the application's + * callback with more than one link that points to a particular + * _object_. + * + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. + * + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. + * + * + * + * Programmer: Quincey Koziol + * November 4 2007 + * + *------------------------------------------------------------------------- + */ +herr_t +H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type, + H5_iter_order_t order, H5L_iterate_t op, void *op_data, hid_t lapl_id, + hid_t dxpl_id) +{ + H5G_iter_visit_ud_t udata; /* User data for callback */ + H5O_linfo_t linfo; /* Link info message */ + htri_t linfo_exists; /* Whether the link info message exists */ + hid_t gid = (-1); /* Group ID */ + H5G_t *grp = NULL; /* Group opened */ + H5G_loc_t loc; /* Location of group passed in */ + H5G_loc_t start_loc; /* Location of starting group */ + unsigned rc; /* Reference count of object */ + herr_t ret_value; /* Return value */ + + /* Portably clear udata struct (before FUNC_ENTER) */ + HDmemset(&udata, 0, sizeof(udata)); + + FUNC_ENTER_NOAPI(FAIL) + + /* Check args */ + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + + /* Open the group to begin visiting within */ + if((grp = H5G__open_name(&loc, group_name, lapl_id, dxpl_id)) == NULL) + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") + + /* Register an ID for the starting group */ + if((gid = H5I_register(H5I_GROUP, grp, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") + + /* Get the location of the starting group */ + if(H5G_loc(gid, &start_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + + /* Set up user data */ + udata.gid = gid; + udata.curr_loc = &start_loc; + udata.lapl_id = lapl_id; + udata.dxpl_id = dxpl_id; + udata.idx_type = idx_type; + udata.order = order; + udata.op = op; + udata.op_data = op_data; + + /* Allocate space for the path name */ + if(NULL == (udata.path = H5MM_strdup(""))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate path name buffer") + udata.path_buf_size = 1; + udata.curr_path_len = 0; + + /* Create skip list to store visited object information */ + if((udata.visited = H5SL_create(H5SL_TYPE_OBJ, NULL)) == NULL) + HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "can't create skip list for visited objects") + + /* Get the group's reference count */ + if(H5O_get_rc_and_type(&grp->oloc, dxpl_id, &rc, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get object info") + + /* If its ref count is > 1, we add it to the list of visited objects */ + /* (because it could come up again during traversal) */ + if(rc > 1) { + H5_obj_t *obj_pos; /* New object node for visited list */ + + /* Allocate new object "position" node */ + if((obj_pos = H5FL_MALLOC(H5_obj_t)) == NULL) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate object node") + + /* Construct unique "position" for this object */ + H5F_GET_FILENO(grp->oloc.file, obj_pos->fileno); + obj_pos->addr = grp->oloc.addr; + + /* Add to list of visited objects */ + if(H5SL_insert(udata.visited, obj_pos, obj_pos) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert object node into visited list") + } /* end if */ + + /* Attempt to get the link info for this group */ + if((linfo_exists = H5G__obj_get_linfo(&(grp->oloc), &linfo, dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message") + if(linfo_exists) { + /* Check for creation order tracking, if creation order index lookup requested */ + if(idx_type == H5_INDEX_CRT_ORDER) { + /* Check if creation order is tracked */ + if(!linfo.track_corder) + /* Switch to name order for this group */ + idx_type = H5_INDEX_NAME; + } /* end if */ + else + HDassert(idx_type == H5_INDEX_NAME); + } /* end if */ + else { + /* Can only perform name lookups on groups with symbol tables */ + if(idx_type != H5_INDEX_NAME) + /* Switch to name order for this group */ + idx_type = H5_INDEX_NAME; + } /* end if */ + + /* Call the link iteration routine */ + if((ret_value = H5G__obj_iterate(&(grp->oloc), idx_type, order, (hsize_t)0, NULL, H5G_visit_cb, &udata, dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't visit links") + +done: + /* Release user data resources */ + H5MM_xfree(udata.path); + if(udata.visited) + H5SL_destroy(udata.visited, H5G_free_visit_visited, NULL); + + /* Release the group opened */ + if(gid > 0) { + if(H5I_dec_app_ref(gid) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") + } /* end if */ + else if(grp && H5G_close(grp) < 0) + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_visit() */ diff --git a/src/H5Glink.c b/src/H5Glink.c index c2334cc..f934052 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -63,6 +63,11 @@ /* Local Prototypes */ /********************/ +static int H5G_link_cmp_name_inc(const void *lnk1, const void *lnk2); +static int H5G_link_cmp_name_dec(const void *lnk1, const void *lnk2); +static int H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2); +static int H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2); + /*********************/ /* Package Variables */ @@ -98,7 +103,7 @@ * *------------------------------------------------------------------------- */ -int +static int H5G_link_cmp_name_inc(const void *lnk1, const void *lnk2) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -125,7 +130,7 @@ H5G_link_cmp_name_inc(const void *lnk1, const void *lnk2) * *------------------------------------------------------------------------- */ -int +static int H5G_link_cmp_name_dec(const void *lnk1, const void *lnk2) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -151,7 +156,7 @@ H5G_link_cmp_name_dec(const void *lnk1, const void *lnk2) * *------------------------------------------------------------------------- */ -int +static int H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2) { int ret_value; /* Return value */ @@ -186,7 +191,7 @@ H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2) * *------------------------------------------------------------------------- */ -int +static int H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2) { int ret_value; /* Return value */ @@ -205,7 +210,7 @@ H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2) /*------------------------------------------------------------------------- - * Function: H5G_ent_to_link + * Function: H5G__ent_to_link * * Purpose: Convert a symbol table entry to a link * @@ -218,10 +223,10 @@ H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2) *------------------------------------------------------------------------- */ herr_t -H5G_ent_to_link(H5O_link_t *lnk, const H5HL_t *heap, +H5G__ent_to_link(H5O_link_t *lnk, const H5HL_t *heap, const H5G_entry_t *ent, const char *name) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* check arguments */ HDassert(lnk); @@ -258,7 +263,7 @@ H5G_ent_to_link(H5O_link_t *lnk, const H5HL_t *heap, } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_ent_to_link() */ +} /* end H5G__ent_to_link() */ /*------------------------------------------------------------------------- @@ -338,7 +343,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_link_to_loc + * Function: H5G__link_to_loc * * Purpose: Build group location from group and link object * @@ -350,12 +355,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_link_to_loc(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, +H5G__link_to_loc(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, H5G_loc_t *obj_loc) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(grp_loc); @@ -382,145 +387,11 @@ H5G_link_to_loc(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_link_to_loc() */ +} /* end H5G__link_to_loc() */ /*------------------------------------------------------------------------- - * Function: H5G_link_copy_file - * - * Purpose: Copy a link and the object it points to from one file to - * another. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Sep 29 2006 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G_link_copy_file(H5F_t *dst_file, hid_t dxpl_id, const H5O_link_t *_src_lnk, - const H5O_loc_t *src_oloc, H5O_link_t *dst_lnk, H5O_copy_t *cpy_info) -{ - H5O_link_t tmp_src_lnk; /* Temporary copy of src link, when needed */ - const H5O_link_t *src_lnk = _src_lnk; /* Source link */ - hbool_t dst_lnk_init = FALSE; /* Whether the destination link is initialized */ - hbool_t expanded_link_open = FALSE; /* Whether the target location has been opened */ - H5G_loc_t tmp_src_loc; /* Group location holding target object */ - H5G_name_t tmp_src_path; /* Path for target object */ - H5O_loc_t tmp_src_oloc; /* Object location for target object */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* check arguments */ - HDassert(dst_file); - HDassert(src_lnk); - HDassert(dst_lnk); - HDassert(cpy_info); - - /* Expand soft or external link, if requested */ - if((H5L_TYPE_SOFT == src_lnk->type && cpy_info->expand_soft_link) - || (H5L_TYPE_EXTERNAL == src_lnk->type - && cpy_info->expand_ext_link)) { - H5G_loc_t lnk_grp_loc; /* Group location holding link */ - H5G_name_t lnk_grp_path; /* Path for link */ - htri_t tar_exists; /* Whether the target object exists */ - - /* Set up group location for link */ - H5G_name_reset(&lnk_grp_path); - lnk_grp_loc.path = &lnk_grp_path; - lnk_grp_loc.oloc = (H5O_loc_t *)src_oloc; /* Casting away const OK -QAK */ - - /* Check if the target object exists */ - if((tar_exists = H5G_loc_exists(&lnk_grp_loc, src_lnk->name, H5P_DEFAULT, - dxpl_id)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to check if target object exists") - - if(tar_exists) { - /* Make a temporary copy of the link, so that it will not change the - * info in the cache when we change it to a hard link */ - if(NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, &tmp_src_lnk)) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy message") - - /* Set up group location for target object. Let H5G_traverse expand - * the link. */ - tmp_src_loc.path = &tmp_src_path; - tmp_src_loc.oloc = &tmp_src_oloc; - if(H5G_loc_reset(&tmp_src_loc) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to reset location") - - /* Find the target object */ - if(H5G_loc_find(&lnk_grp_loc, src_lnk->name, &tmp_src_loc, - H5P_DEFAULT, dxpl_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to find target object") - expanded_link_open = TRUE; - - /* Convert symbolic link to hard link */ - if(tmp_src_lnk.type == H5L_TYPE_SOFT) - tmp_src_lnk.u.soft.name = - (char *)H5MM_xfree(tmp_src_lnk.u.soft.name); - else if(tmp_src_lnk.u.ud.size > 0) - tmp_src_lnk.u.ud.udata = H5MM_xfree(tmp_src_lnk.u.ud.udata); - tmp_src_lnk.type = H5L_TYPE_HARD; - tmp_src_lnk.u.hard.addr = tmp_src_oloc.addr; - src_lnk = &tmp_src_lnk; - } /* end if */ - } /* end if */ - - /* Copy src link information to dst link information */ - if(NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, dst_lnk)) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy message") - dst_lnk_init = TRUE; - - /* Check if object in source group is a hard link & copy it */ - if(H5L_TYPE_HARD == src_lnk->type) { - H5O_loc_t new_dst_oloc; /* Copied object location in destination */ - - /* Set up copied object location to fill in */ - H5O_loc_reset(&new_dst_oloc); - new_dst_oloc.file = dst_file; - - if(!expanded_link_open) { - /* Build temporary object location for source */ - H5O_loc_reset(&tmp_src_oloc); - tmp_src_oloc.file = src_oloc->file; - tmp_src_oloc.addr = src_lnk->u.hard.addr; - } /* end if */ - HDassert(H5F_addr_defined(tmp_src_oloc.addr)); - - /* Copy the shared object from source to destination */ - /* Don't care about obj_type or udata because those are only important - * for old style groups */ - if(H5O_copy_header_map(&tmp_src_oloc, &new_dst_oloc, dxpl_id, cpy_info, - TRUE, NULL, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") - - /* Copy new destination object's information for eventual insertion */ - dst_lnk->u.hard.addr = new_dst_oloc.addr; - } /* end if */ - -done: - /* Check if we used a temporary src link */ - if(src_lnk != _src_lnk) { - HDassert(src_lnk == &tmp_src_lnk); - H5O_msg_reset(H5O_LINK_ID, &tmp_src_lnk); - } /* end if */ - if(ret_value < 0) - if(dst_lnk_init) - H5O_msg_reset(H5O_LINK_ID, dst_lnk); - /* Check if we need to free the temp source oloc */ - if(expanded_link_open) - if(H5G_loc_free(&tmp_src_loc) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free object") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_link_copy_file() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_link_sort_table + * Function: H5G__link_sort_table * * Purpose: Sort table containing a list of links for a group * @@ -533,10 +404,10 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type, +H5G__link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type, H5_iter_order_t order) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(ltable); @@ -561,11 +432,11 @@ H5G_link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type, } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_link_sort_table() */ +} /* end H5G__link_sort_table() */ /*------------------------------------------------------------------------- - * Function: H5G_link_iterate_table + * Function: H5G__link_iterate_table * * Purpose: Iterate over table containing a list of links for a group, * making appropriate callbacks @@ -579,13 +450,13 @@ H5G_link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type, *------------------------------------------------------------------------- */ herr_t -H5G_link_iterate_table(const H5G_link_table_t *ltable, hsize_t skip, +H5G__link_iterate_table(const H5G_link_table_t *ltable, hsize_t skip, hsize_t *last_lnk, const H5G_lib_iterate_t op, void *op_data) { size_t u; /* Local index variable */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(ltable); @@ -611,11 +482,11 @@ H5G_link_iterate_table(const H5G_link_table_t *ltable, hsize_t skip, HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed"); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_link_iterate_table() */ +} /* end H5G__link_iterate_table() */ /*------------------------------------------------------------------------- - * Function: H5G_link_release_table + * Function: H5G__link_release_table * * Purpose: Release table containing a list of links for a group * @@ -628,12 +499,12 @@ H5G_link_iterate_table(const H5G_link_table_t *ltable, hsize_t skip, *------------------------------------------------------------------------- */ herr_t -H5G_link_release_table(H5G_link_table_t *ltable) +H5G__link_release_table(H5G_link_table_t *ltable) { size_t u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(ltable); @@ -653,11 +524,11 @@ H5G_link_release_table(H5G_link_table_t *ltable) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_link_release_table() */ +} /* end H5G__link_release_table() */ /*------------------------------------------------------------------------- - * Function: H5G_link_name_replace + * Function: H5G__link_name_replace * * Purpose: Determine the type of object referred to (for hard links) or * the link type (for soft links and user-defined links). @@ -671,13 +542,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_link_name_replace(H5F_t *file, hid_t dxpl_id, H5RS_str_t *grp_full_path_r, +H5G__link_name_replace(H5F_t *file, hid_t dxpl_id, H5RS_str_t *grp_full_path_r, const H5O_link_t *lnk) { H5RS_str_t *obj_path_r = NULL; /* Full path for link being removed */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check arguments */ HDassert(file); @@ -694,5 +565,5 @@ done: H5RS_decr(obj_path_r); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_link_name_replace() */ +} /* end H5G__link_name_replace() */ diff --git a/src/H5Gloc.c b/src/H5Gloc.c index ed17c6f..9f0095a 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -259,7 +259,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_loc_copy + * Function: H5G__loc_copy * * Purpose: Copy over information for a location * @@ -271,11 +271,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth) +H5G__loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Check args. */ HDassert(dst); @@ -289,7 +289,7 @@ H5G_loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_loc_copy() */ +} /* end H5G__loc_copy() */ /*------------------------------------------------------------------------- @@ -388,7 +388,7 @@ H5G_loc_find_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char *name, /* (Group traversal callbacks are responsible for either taking ownership * of the group location for the object, or freeing it. - QAK) */ - H5G_loc_copy(udata->loc, obj_loc, H5_COPY_SHALLOW); + H5G__loc_copy(udata->loc, obj_loc, H5_COPY_SHALLOW); *own_loc = H5G_OWN_OBJ_LOC; done: @@ -473,14 +473,14 @@ H5G_loc_find_by_idx_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, lnk_copied = TRUE; /* Build the initial object location for the link */ - if(H5G_link_to_loc(obj_loc, &fnd_lnk, udata->loc) < 0) + if(H5G__link_to_loc(obj_loc, &fnd_lnk, udata->loc) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot initialize object location") obj_loc_valid = TRUE; /* Perform any special traversals that the link needs */ /* (soft links, user-defined links, file mounting, etc.) */ /* (may modify the object location) */ - if(H5G_traverse_special(obj_loc, &fnd_lnk, H5G_TARGET_NORMAL, &links_left, TRUE, udata->loc, &obj_exists, udata->lapl_id, udata->dxpl_id) < 0) + if(H5G__traverse_special(obj_loc, &fnd_lnk, H5G_TARGET_NORMAL, &links_left, TRUE, udata->loc, &obj_exists, udata->lapl_id, udata->dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_TRAVERSE, FAIL, "special link traversal failed") done: @@ -546,7 +546,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_loc_insert + * Function: H5G__loc_insert * * Purpose: Insert an object at a location * @@ -558,13 +558,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc, +H5G__loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc, H5O_type_t obj_type, const void *crt_info, hid_t dxpl_id) { H5O_link_t lnk; /* Link for object to insert */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Check args. */ HDassert(grp_loc); @@ -591,7 +591,7 @@ H5G_loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_loc_insert() */ +} /* end H5G__loc_insert() */ /*------------------------------------------------------------------------- diff --git a/src/H5Gname.c b/src/H5Gname.c index 9f135f8..62875dc 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -113,6 +113,104 @@ H5FL_BLK_EXTERN(str_buf); /*------------------------------------------------------------------------- + * Function: H5G__component + * + * Purpose: Returns the pointer to the first component of the + * specified name by skipping leading slashes. Returns + * the size in characters of the component through SIZE_P not + * counting leading slashes or the null terminator. + * + * Return: Success: Ptr into NAME. + * + * Failure: Ptr to the null terminator of NAME. + * + * Programmer: Robb Matzke + * matzke@llnl.gov + * Aug 11 1997 + * + *------------------------------------------------------------------------- + */ +const char * +H5G__component(const char *name, size_t *size_p) +{ + FUNC_ENTER_PACKAGE_NOERR + + assert(name); + + while ('/' == *name) + name++; + if (size_p) + *size_p = HDstrcspn(name, "/"); + + FUNC_LEAVE_NOAPI(name) +} /* end H5G__component() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_normalize + * + * Purpose: Returns a pointer to a new string which has duplicate and + * trailing slashes removed from it. + * + * Return: Success: Ptr to normalized name. + * Failure: NULL + * + * Programmer: Quincey Koziol + * Saturday, August 16, 2003 + * + *------------------------------------------------------------------------- + */ +char * +H5G_normalize(const char *name) +{ + char *norm; /* Pointer to the normalized string */ + size_t s,d; /* Positions within the strings */ + unsigned last_slash; /* Flag to indicate last character was a slash */ + char *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Sanity check */ + HDassert(name); + + /* Duplicate the name, to return */ + if(NULL == (norm = H5MM_strdup(name))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for normalized string") + + /* Walk through the characters, omitting duplicated '/'s */ + s = d = 0; + last_slash = 0; + while(name[s] != '\0') { + if(name[s] == '/') + if(last_slash) + ; + else { + norm[d++] = name[s]; + last_slash = 1; + } /* end else */ + else { + norm[d++] = name[s]; + last_slash = 0; + } /* end else */ + s++; + } /* end while */ + + /* Terminate normalized string */ + norm[d] = '\0'; + + /* Check for final '/' on normalized name & eliminate it */ + if(d > 1 && last_slash) + norm[d - 1] = '\0'; + + /* Set return value */ + ret_value = norm; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_normalize() */ + + +/*------------------------------------------------------------------------- * Function: H5G_common_path * * Purpose: Determine if one path is a valid prefix of another path @@ -139,11 +237,11 @@ H5G_common_path(const H5RS_str_t *fullpath_r, const H5RS_str_t *prefix_r) /* Get component of each name */ fullpath=H5RS_get_str(fullpath_r); assert(fullpath); - fullpath=H5G_component(fullpath,&nchars1); + fullpath=H5G__component(fullpath,&nchars1); assert(fullpath); prefix=H5RS_get_str(prefix_r); assert(prefix); - prefix=H5G_component(prefix,&nchars2); + prefix=H5G__component(prefix,&nchars2); assert(prefix); /* Check if we have a real string for each component */ @@ -157,9 +255,9 @@ H5G_common_path(const H5RS_str_t *fullpath_r, const H5RS_str_t *prefix_r) prefix+=nchars2; /* Get next component of each name */ - fullpath=H5G_component(fullpath,&nchars1); + fullpath=H5G__component(fullpath,&nchars1); assert(fullpath); - prefix=H5G_component(prefix,&nchars2); + prefix=H5G__component(prefix,&nchars2); assert(prefix); } /* end if */ else @@ -310,7 +408,7 @@ H5G_build_fullpath_refstr_refstr(const H5RS_str_t *prefix_r, const H5RS_str_t *n /*------------------------------------------------------------------------- - * Function: H5G_name_init + * Function: H5G__name_init * * Purpose: Set the initial path for a group hierarchy name * @@ -323,9 +421,9 @@ H5G_build_fullpath_refstr_refstr(const H5RS_str_t *prefix_r, const H5RS_str_t *n *------------------------------------------------------------------------- */ herr_t -H5G_name_init(H5G_name_t *name, const char *path) +H5G__name_init(H5G_name_t *name, const char *path) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(name); @@ -338,7 +436,7 @@ H5G_name_init(H5G_name_t *name, const char *path) name->obj_hidden = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_name_init() */ +} /* end H5G__name_init() */ /*------------------------------------------------------------------------- @@ -355,7 +453,7 @@ H5G_name_init(H5G_name_t *name, const char *path) *------------------------------------------------------------------------- */ herr_t -H5G_name_set(H5G_name_t *loc, H5G_name_t *obj, const char *name) +H5G_name_set(const H5G_name_t *loc, H5G_name_t *obj, const char *name) { herr_t ret_value = SUCCEED; diff --git a/src/H5Gnode.c b/src/H5Gnode.c index f799454..4d2e045 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -270,7 +270,7 @@ H5G_node_debug_key(FILE *stream, int indent, int fwidth, const void *_key, /*------------------------------------------------------------------------- - * Function: H5G_node_free + * Function: H5G__node_free * * Purpose: Destroy a symbol table node in memory. * @@ -283,9 +283,9 @@ H5G_node_debug_key(FILE *stream, int indent, int fwidth, const void *_key, *------------------------------------------------------------------------- */ herr_t -H5G_node_free(H5G_node_t *sym) +H5G__node_free(H5G_node_t *sym) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -300,7 +300,7 @@ H5G_node_free(H5G_node_t *sym) sym = H5FL_FREE(H5G_node_t, sym); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_node_free() */ +} /* end H5G__node_free() */ /*------------------------------------------------------------------------- @@ -674,7 +674,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, idx += cmp > 0 ? 1 : 0; /* Convert link information & name to symbol table entry */ - if(H5G_ent_convert(f, dxpl_id, udata->common.heap, udata->common.name, + if(H5G__ent_convert(f, dxpl_id, udata->common.heap, udata->common.name, udata->lnk, udata->obj_type, udata->crt_info, &ent) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, H5B_INS_ERROR, "unable to convert link") @@ -740,7 +740,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, (insert_into->nsyms - (unsigned)idx) * sizeof(H5G_entry_t)); /* Copy new entry into table */ - H5G_ent_copy(&(insert_into->entry[idx]), &ent, H5_COPY_SHALLOW); + H5G__ent_copy(&(insert_into->entry[idx]), &ent, H5_COPY_SHALLOW); /* Increment # of symbols in table */ insert_into->nsyms += 1; @@ -857,7 +857,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, } /* end else */ /* Replace any object names */ - if(H5G_link_name_replace(f, dxpl_id, udata->grp_full_path_r, &lnk) < 0) + if(H5G__link_name_replace(f, dxpl_id, udata->grp_full_path_r, &lnk) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get object type") /* Decrement the ref. count for hard links */ @@ -969,7 +969,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_node_iterate + * Function: H5G__node_iterate * * Purpose: This function gets called during a group iterate operation. * @@ -982,7 +982,7 @@ done: *------------------------------------------------------------------------- */ int -H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, +H5G__node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, const void UNUSED *_rt_key, void *_udata) { H5G_bt_it_it_t *udata = (H5G_bt_it_it_t *)_udata; @@ -991,7 +991,7 @@ H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t ad unsigned u; /* Local index variable */ int ret_value = H5_ITER_CONT; - FUNC_ENTER_NOAPI(H5_ITER_ERROR) + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1019,7 +1019,7 @@ H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t ad HDassert(name); /* Convert the entry to a link */ - if(H5G_ent_to_link(&lnk, udata->heap, &ents[u], name) < 0) + if(H5G__ent_to_link(&lnk, udata->heap, &ents[u], name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, H5_ITER_ERROR, "unable to convert symbol table entry to link") /* Make the callback */ @@ -1044,11 +1044,11 @@ done: HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_node_iterate() */ +} /* end H5G__node_iterate() */ /*------------------------------------------------------------------------- - * Function: H5G_node_sumup + * Function: H5G__node_sumup * * Purpose: This function gets called during a group iterate operation * to return total number of members in the group. @@ -1061,14 +1061,14 @@ done: *------------------------------------------------------------------------- */ int -H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, +H5G__node_sumup(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, const void UNUSED *_rt_key, void *_udata) { hsize_t *num_objs = (hsize_t *)_udata; H5G_node_t *sn = NULL; int ret_value = H5_ITER_CONT; - FUNC_ENTER_NOAPI(H5_ITER_ERROR) + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1088,11 +1088,11 @@ done: HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_node_sumup() */ +} /* end H5G__node_sumup() */ /*------------------------------------------------------------------------- - * Function: H5G_node_name + * Function: H5G__node_by_idx * * Purpose: This function gets called during a group iterate operation * to return object name by giving idx. @@ -1106,14 +1106,14 @@ done: *------------------------------------------------------------------------- */ int -H5G_node_by_idx(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, +H5G__node_by_idx(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, const void UNUSED *_rt_key, void *_udata) { H5G_bt_it_idx_common_t *udata = (H5G_bt_it_idx_common_t *)_udata; H5G_node_t *sn = NULL; int ret_value = H5_ITER_CONT; - FUNC_ENTER_NOAPI(H5_ITER_ERROR) + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1149,11 +1149,11 @@ done: HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_node_by_idx() */ +} /* end H5G__node_by_idx() */ /*------------------------------------------------------------------------- - * Function: H5G_node_init + * Function: H5G__node_init * * Purpose: This function gets called during a file opening to initialize * global information about group B-tree nodes for file. @@ -1167,13 +1167,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_node_init(H5F_t *f) +H5G__node_init(H5F_t *f) { H5B_shared_t *shared; /* Shared B-tree node info */ size_t sizeof_rkey; /* Size of raw (disk) key */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(f); @@ -1194,7 +1194,7 @@ H5G_node_init(H5F_t *f) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_node_init() */ +} /* end H5G__node_init() */ /*------------------------------------------------------------------------- @@ -1229,7 +1229,7 @@ H5G_node_close(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5G_node_copy + * Function: H5G__node_copy * * Purpose: This function gets called during a group iterate operation * to copy objects of this node into a new location. @@ -1242,7 +1242,7 @@ H5G_node_close(const H5F_t *f) *------------------------------------------------------------------------- */ int -H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, +H5G__node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, const void UNUSED *_rt_key, void *_udata) { H5G_bt_it_cpy_t *udata = (H5G_bt_it_cpy_t *)_udata; @@ -1253,7 +1253,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, unsigned int i; /* Local index variable */ int ret_value = H5_ITER_CONT; - FUNC_ENTER_NOAPI(H5_ITER_ERROR) + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(f); @@ -1364,7 +1364,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, /* Insert the new object in the destination file's group */ /* (Don't increment the link count - that's already done above for hard links) */ - if(H5G_stab_insert_real(udata->dst_file, udata->dst_stab, name, &lnk, + if(H5G__stab_insert_real(udata->dst_file, udata->dst_stab, name, &lnk, obj_type, (obj_type == H5O_TYPE_GROUP ? &gcrt_info : NULL), dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "unable to insert the name") @@ -1382,11 +1382,11 @@ done: HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_node_copy() */ +} /* end H5G__node_copy() */ /*------------------------------------------------------------------------- - * Function: H5G_node_build_table + * Function: H5G__node_build_table * * Purpose: B-link tree callback for building table of links * @@ -1399,7 +1399,7 @@ done: *------------------------------------------------------------------------- */ int -H5G_node_build_table(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, +H5G__node_build_table(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, const void UNUSED *_rt_key, void *_udata) { H5G_bt_it_bt_t *udata = (H5G_bt_it_bt_t *)_udata; @@ -1407,7 +1407,7 @@ H5G_node_build_table(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_ unsigned u; /* Local index variable */ int ret_value = H5_ITER_CONT; - FUNC_ENTER_NOAPI(H5_ITER_ERROR) + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1447,7 +1447,7 @@ H5G_node_build_table(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_ linkno = udata->ltable->nlinks++; /* Convert the entry to a link */ - if(H5G_ent_to_link(&udata->ltable->lnks[linkno], udata->heap, &sn->entry[u], name) < 0) + if(H5G__ent_to_link(&udata->ltable->lnks[linkno], udata->heap, &sn->entry[u], name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, H5_ITER_ERROR, "unable to convert symbol table entry to link") } /* end for */ @@ -1457,11 +1457,11 @@ done: HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_node_build_table() */ +} /* end H5G__node_build_table() */ /*------------------------------------------------------------------------- - * Function: H5G_node_iterate_size + * Function: H5G__node_iterate_size * * Purpose: This function gets called by H5B_iterate_helper() * to gather storage info for SNODs. @@ -1474,12 +1474,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_node_iterate_size(H5F_t *f, hid_t UNUSED dxpl_id, const void UNUSED *_lt_key, haddr_t UNUSED addr, +H5G__node_iterate_size(H5F_t *f, hid_t UNUSED dxpl_id, const void UNUSED *_lt_key, haddr_t UNUSED addr, const void UNUSED *_rt_key, void *_udata) { hsize_t *stab_size = (hsize_t *)_udata; /* User data */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ HDassert(f); @@ -1488,7 +1488,7 @@ H5G_node_iterate_size(H5F_t *f, hid_t UNUSED dxpl_id, const void UNUSED *_lt_key *stab_size += H5G_NODE_SIZE(f); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_node_iterate_size() */ +} /* end H5G__node_iterate_size() */ /*------------------------------------------------------------------------- @@ -1567,7 +1567,7 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, else fprintf(stream, "%*s%-*s\n", indent, "", fwidth, "Warning: Invalid heap address given, name not displayed!"); - H5G_ent_debug(sn->entry + u, stream, indent, fwidth, heap); + H5G__ent_debug(sn->entry + u, stream, indent, fwidth, heap); } /* end for */ } /* end if */ diff --git a/src/H5Gobj.c b/src/H5Gobj.c index 03f8c98..021f4e1 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -92,7 +92,7 @@ typedef struct { /********************/ static herr_t H5G_obj_compact_to_dense_cb(const void *_mesg, unsigned idx, void *_udata); -static herr_t H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo, +static herr_t H5G_obj_remove_update_linfo(const H5O_loc_t *oloc, H5O_linfo_t *linfo, hid_t dxpl_id); @@ -113,7 +113,7 @@ static herr_t H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo, /*------------------------------------------------------------------------- - * Function: H5G_obj_create + * Function: H5G__obj_create * * Purpose: Create an object header for a group and update object location info * @@ -126,7 +126,7 @@ static herr_t H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo, *------------------------------------------------------------------------- */ herr_t -H5G_obj_create(H5F_t *f, hid_t dxpl_id, H5G_obj_create_t *gcrt_info, +H5G__obj_create(H5F_t *f, hid_t dxpl_id, H5G_obj_create_t *gcrt_info, H5O_loc_t *oloc/*out*/) { H5P_genplist_t *gc_plist; /* Group creation property list */ @@ -135,7 +135,7 @@ H5G_obj_create(H5F_t *f, hid_t dxpl_id, H5G_obj_create_t *gcrt_info, H5O_pline_t pline; /* Pipeline */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -160,16 +160,16 @@ H5G_obj_create(H5F_t *f, hid_t dxpl_id, H5G_obj_create_t *gcrt_info, HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get group info") /* Call the "real" group creation routine now */ - if(H5G_obj_create_real(f, dxpl_id, &ginfo, &linfo, &pline, gcrt_info, oloc) < 0) + if(H5G__obj_create_real(f, dxpl_id, &ginfo, &linfo, &pline, gcrt_info, oloc) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "unable to create group") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_obj_create() */ +} /* end H5G__obj_create() */ /*------------------------------------------------------------------------- - * Function: H5G_obj_create_real + * Function: H5G__obj_create_real * * Purpose: Create an object header for a group and update object location info * @@ -182,7 +182,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo, +H5G__obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo, const H5O_linfo_t *linfo, const H5O_pline_t *pline, H5G_obj_create_t *gcrt_info, H5O_loc_t *oloc/*out*/) { @@ -191,7 +191,7 @@ H5G_obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo, hid_t gcpl_id = gcrt_info->gcpl_id; /* Group creation property list ID */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -288,7 +288,7 @@ H5G_obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo, H5O_stab_t stab; /* Symbol table message */ /* The group doesn't currently have a 'stab' message, go create one */ - if(H5G_stab_create(oloc, dxpl_id, ginfo, &stab) < 0) + if(H5G__stab_create(oloc, dxpl_id, ginfo, &stab) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create symbol table") /* Cache the symbol table information */ @@ -299,11 +299,11 @@ H5G_obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_obj_create_real() */ +} /* end H5G__obj_create_real() */ /*------------------------------------------------------------------------- - * Function: H5G_obj_get_linfo + * Function: H5G__obj_get_linfo * * Purpose: Retrieves the "link info" message for an object. Also * sets the number of links correctly, if it isn't set up yet. @@ -318,12 +318,12 @@ done: *------------------------------------------------------------------------- */ htri_t -H5G_obj_get_linfo(const H5O_loc_t *grp_oloc, H5O_linfo_t *linfo, hid_t dxpl_id) +H5G__obj_get_linfo(const H5O_loc_t *grp_oloc, H5O_linfo_t *linfo, hid_t dxpl_id) { H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ htri_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI_TAG(dxpl_id, grp_oloc->addr, FAIL) + FUNC_ENTER_PACKAGE_TAG(dxpl_id, grp_oloc->addr, FAIL) /* check arguments */ HDassert(grp_oloc); @@ -364,7 +364,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) -} /* end H5G_obj_get_linfo() */ +} /* end H5G__obj_get_linfo() */ /*------------------------------------------------------------------------- @@ -395,7 +395,7 @@ H5G_obj_compact_to_dense_cb(const void *_mesg, unsigned UNUSED idx, void *_udata HDassert(udata); /* Insert link into dense link storage */ - if(H5G_dense_insert(udata->f, udata->dxpl_id, udata->linfo, lnk) < 0) + if(H5G__dense_insert(udata->f, udata->dxpl_id, udata->linfo, lnk) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into dense storage") done: @@ -478,7 +478,7 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, /* Check if we have information about the number of objects in this group */ /* (by attempting to get the link info message for this group) */ - if((linfo_exists = H5G_obj_get_linfo(grp_oloc, &linfo, dxpl_id)) < 0) + if((linfo_exists = H5G__obj_get_linfo(grp_oloc, &linfo, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message") if(linfo_exists) { H5O_ginfo_t ginfo; /* Group info message */ @@ -528,7 +528,7 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, } /* end if */ /* The group doesn't currently have "dense" storage for links */ - if(H5G_dense_create(grp_oloc->file, dxpl_id, &linfo, pline) < 0) + if(H5G__dense_create(grp_oloc->file, dxpl_id, &linfo, pline) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create 'dense' form of new format group") /* Set up user data for object header message iteration */ @@ -572,7 +572,7 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, udata.dxpl_id = dxpl_id; /* Iterate through all links in "old format" group and insert them into new format */ - if(H5G_stab_iterate(grp_oloc, dxpl_id, H5_ITER_NATIVE, (hsize_t)0, NULL, H5G_obj_stab_to_new_cb, &udata) < 0) + if(H5G__stab_iterate(grp_oloc, dxpl_id, H5_ITER_NATIVE, (hsize_t)0, NULL, H5G_obj_stab_to_new_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over old format links") /* Remove the symbol table message from the group */ @@ -597,19 +597,19 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, /* Insert into symbol table or "dense" storage */ if(use_old_format) { /* Insert into symbol table */ - if(H5G_stab_insert(grp_oloc, name, obj_lnk, obj_type, crt_info, dxpl_id) + if(H5G__stab_insert(grp_oloc, name, obj_lnk, obj_type, crt_info, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry into symbol table") } /* end if */ else { if(use_new_dense) { /* Insert into dense link storage */ - if(H5G_dense_insert(grp_oloc->file, dxpl_id, &linfo, obj_lnk) < 0) + if(H5G__dense_insert(grp_oloc->file, dxpl_id, &linfo, obj_lnk) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into dense storage") } /* end if */ else { /* Insert with link message */ - if(H5G_compact_insert(grp_oloc, obj_lnk, dxpl_id) < 0) + if(H5G__compact_insert(grp_oloc, obj_lnk, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link as link message") } /* end else */ } /* end else */ @@ -645,7 +645,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_obj_iterate + * Function: H5G__obj_iterate * * Purpose: Private function for H5Giterate. * Iterates over objects in a group @@ -660,7 +660,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_obj_iterate(const H5O_loc_t *grp_oloc, +H5G__obj_iterate(const H5O_loc_t *grp_oloc, 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, hid_t dxpl_id) { @@ -668,14 +668,14 @@ H5G_obj_iterate(const H5O_loc_t *grp_oloc, htri_t linfo_exists; /* Whether the link info message exists */ herr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI_TAG(dxpl_id, grp_oloc->addr, FAIL) + FUNC_ENTER_PACKAGE_TAG(dxpl_id, grp_oloc->addr, FAIL) /* Sanity check */ HDassert(grp_oloc); HDassert(op); /* Attempt to get the link info for this group */ - if((linfo_exists = H5G_obj_get_linfo(grp_oloc, &linfo, dxpl_id)) < 0) + if((linfo_exists = H5G__obj_get_linfo(grp_oloc, &linfo, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message") if(linfo_exists) { /* Check for going out of bounds */ @@ -691,12 +691,12 @@ H5G_obj_iterate(const H5O_loc_t *grp_oloc, if(H5F_addr_defined(linfo.fheap_addr)) { /* Iterate over the links in the group, building a table of the link messages */ - if((ret_value = H5G_dense_iterate(grp_oloc->file, dxpl_id, &linfo, idx_type, order, skip, last_lnk, op, op_data)) < 0) + if((ret_value = H5G__dense_iterate(grp_oloc->file, dxpl_id, &linfo, idx_type, order, skip, last_lnk, op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over dense links") } /* end if */ else { /* Get the object's name from the link messages */ - if((ret_value = H5G_compact_iterate(grp_oloc, dxpl_id, &linfo, idx_type, order, skip, last_lnk, op, op_data)) < 0) + if((ret_value = H5G__compact_iterate(grp_oloc, dxpl_id, &linfo, idx_type, order, skip, last_lnk, op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over compact links") } /* end else */ } /* end if */ @@ -706,17 +706,17 @@ H5G_obj_iterate(const H5O_loc_t *grp_oloc, HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no creation order index to query") /* Iterate over symbol table */ - if((ret_value = H5G_stab_iterate(grp_oloc, dxpl_id, order, skip, last_lnk, op, op_data)) < 0) + if((ret_value = H5G__stab_iterate(grp_oloc, dxpl_id, order, skip, last_lnk, op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over symbol table") } /* end else */ done: FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) -} /* end H5G_obj_iterate() */ +} /* end H5G__obj_iterate() */ /*------------------------------------------------------------------------- - * Function: H5G_obj_info + * Function: H5G__obj_info * * Purpose: Retrieve information about a group * @@ -729,7 +729,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_obj_info(H5O_loc_t *oloc, H5G_info_t *grp_info, hid_t dxpl_id) +H5G__obj_info(H5O_loc_t *oloc, H5G_info_t *grp_info, hid_t dxpl_id) { H5G_t *grp = NULL; /* Group to query */ H5G_loc_t grp_loc; /* Entry of group to be queried */ @@ -739,7 +739,7 @@ H5G_obj_info(H5O_loc_t *oloc, H5G_info_t *grp_info, hid_t dxpl_id) htri_t linfo_exists; /* Whether the link info message exists */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(oloc); @@ -762,7 +762,7 @@ H5G_obj_info(H5O_loc_t *oloc, H5G_info_t *grp_info, hid_t dxpl_id) grp_info->mounted = H5G_MOUNTED(grp); /* Attempt to get the link info for this group */ - if((linfo_exists = H5G_obj_get_linfo(oloc, &linfo, dxpl_id)) < 0) + if((linfo_exists = H5G__obj_get_linfo(oloc, &linfo, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message") if(linfo_exists) { /* Retrieve the information about the links */ @@ -777,7 +777,7 @@ H5G_obj_info(H5O_loc_t *oloc, H5G_info_t *grp_info, hid_t dxpl_id) } /* end if */ else { /* Get the number of objects in this group by iterating over symbol table */ - if(H5G_stab_count(oloc, &grp_info->nlinks, dxpl_id) < 0) + if(H5G__stab_count(oloc, &grp_info->nlinks, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't count objects") /* Set the other information about the group */ @@ -791,7 +791,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "unable to close queried group") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_obj_info() */ +} /* end H5G__obj_info() */ /*------------------------------------------------------------------------- @@ -808,7 +808,7 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5G_obj_get_name_by_idx(H5O_loc_t *oloc, H5_index_t idx_type, +H5G_obj_get_name_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char* name, size_t size, hid_t dxpl_id) { H5O_linfo_t linfo; /* Link info message */ @@ -821,7 +821,7 @@ H5G_obj_get_name_by_idx(H5O_loc_t *oloc, H5_index_t idx_type, HDassert(oloc && oloc->file); /* Attempt to get the link info for this group */ - if((linfo_exists = H5G_obj_get_linfo(oloc, &linfo, dxpl_id)) < 0) + if((linfo_exists = H5G__obj_get_linfo(oloc, &linfo, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message") if(linfo_exists) { /* Check for creation order tracking, if creation order index lookup requested */ @@ -834,12 +834,12 @@ H5G_obj_get_name_by_idx(H5O_loc_t *oloc, H5_index_t idx_type, /* Check for dense link storage */ if(H5F_addr_defined(linfo.fheap_addr)) { /* Get the object's name from the dense link storage */ - if((ret_value = H5G_dense_get_name_by_idx(oloc->file, dxpl_id, &linfo, idx_type, order, n, name, size)) < 0) + if((ret_value = H5G__dense_get_name_by_idx(oloc->file, dxpl_id, &linfo, idx_type, order, n, name, size)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name") } /* end if */ else { /* Get the object's name from the link messages */ - if((ret_value = H5G_compact_get_name_by_idx(oloc, dxpl_id, &linfo, idx_type, order, n, name, size)) < 0) + if((ret_value = H5G__compact_get_name_by_idx(oloc, dxpl_id, &linfo, idx_type, order, n, name, size)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name") } /* end else */ } /* end if */ @@ -849,7 +849,7 @@ H5G_obj_get_name_by_idx(H5O_loc_t *oloc, H5_index_t idx_type, HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no creation order index to query") /* Get the object's name from the symbol table */ - if((ret_value = H5G_stab_get_name_by_idx(oloc, order, n, name, size, dxpl_id)) < 0) + if((ret_value = H5G__stab_get_name_by_idx(oloc, order, n, name, size, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name") } /* end else */ @@ -872,7 +872,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo, hid_t dxpl_id) +H5G_obj_remove_update_linfo(const H5O_loc_t *oloc, H5O_linfo_t *linfo, hid_t dxpl_id) { herr_t ret_value = SUCCEED; /* Return value */ @@ -894,7 +894,7 @@ H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo, hid_t dxpl_id) /* Check if there's no more links */ if(linfo->nlinks == 0) { /* Delete the dense storage */ - if(H5G_dense_delete(oloc->file, dxpl_id, linfo, FALSE) < 0) + if(H5G__dense_delete(oloc->file, dxpl_id, linfo, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete dense link storage") } /* end if */ /* Check for switching back to compact storage */ @@ -913,7 +913,7 @@ H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo, hid_t dxpl_id) size_t u; /* Local index */ /* Build the table of links for this group */ - if(H5G_dense_build_table(oloc->file, dxpl_id, linfo, H5_INDEX_NAME, H5_ITER_NATIVE, <able) < 0) + if(H5G__dense_build_table(oloc->file, dxpl_id, linfo, H5_INDEX_NAME, H5_ITER_NATIVE, <able) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links") /* Pin the object header */ @@ -943,7 +943,7 @@ H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo, hid_t dxpl_id) } /* end if */ /* Remove the dense storage */ - if(H5G_dense_delete(oloc->file, dxpl_id, linfo, FALSE) < 0) + if(H5G__dense_delete(oloc->file, dxpl_id, linfo, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete dense link storage") } /* end if */ @@ -952,7 +952,7 @@ H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo, hid_t dxpl_id) HGOTO_ERROR(H5E_SYM, H5E_CANTUNPIN, FAIL, "unable to unpin group object header") /* Free link table information */ - if(H5G_link_release_table(<able) < 0) + if(H5G__link_release_table(<able) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") } /* end if */ } /* end else */ @@ -981,7 +981,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_obj_remove(H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name, hid_t dxpl_id) +H5G_obj_remove(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name, hid_t dxpl_id) { H5O_linfo_t linfo; /* Link info message */ htri_t linfo_exists; /* Whether the link info message exists */ @@ -995,7 +995,7 @@ H5G_obj_remove(H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name, h HDassert(name && *name); /* Attempt to get the link info for this group */ - if((linfo_exists = H5G_obj_get_linfo(oloc, &linfo, dxpl_id)) < 0) + if((linfo_exists = H5G__obj_get_linfo(oloc, &linfo, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message") if(linfo_exists) { /* Using the new format for groups */ @@ -1004,12 +1004,12 @@ H5G_obj_remove(H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name, h /* Check for dense or compact storage */ if(H5F_addr_defined(linfo.fheap_addr)) { /* Remove object from the dense link storage */ - if(H5G_dense_remove(oloc->file, dxpl_id, &linfo, grp_full_path_r, name) < 0) + if(H5G__dense_remove(oloc->file, dxpl_id, &linfo, grp_full_path_r, name) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object") } /* end if */ else { /* Remove object from the link messages */ - if(H5G_compact_remove(oloc, dxpl_id, grp_full_path_r, name) < 0) + if(H5G__compact_remove(oloc, dxpl_id, grp_full_path_r, name) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object") } /* end else */ } /* end if */ @@ -1018,7 +1018,7 @@ H5G_obj_remove(H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name, h use_old_format = TRUE; /* Remove object from the symbol table */ - if(H5G_stab_remove(oloc, dxpl_id, grp_full_path_r, name) < 0) + if(H5G__stab_remove(oloc, dxpl_id, grp_full_path_r, name) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object") } /* end else */ @@ -1046,7 +1046,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_obj_remove_by_idx(H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r, +H5G_obj_remove_by_idx(const H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t dxpl_id) { H5O_linfo_t linfo; /* Link info message */ @@ -1060,7 +1060,7 @@ H5G_obj_remove_by_idx(H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r, HDassert(grp_oloc && grp_oloc->file); /* Attempt to get the link info for this group */ - if((linfo_exists = H5G_obj_get_linfo(grp_oloc, &linfo, dxpl_id)) < 0) + if((linfo_exists = H5G__obj_get_linfo(grp_oloc, &linfo, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message") if(linfo_exists) { /* Check for creation order tracking, if creation order index lookup requested */ @@ -1076,12 +1076,12 @@ H5G_obj_remove_by_idx(H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r, /* Check for dense or compact storage */ if(H5F_addr_defined(linfo.fheap_addr)) { /* Remove object from the dense link storage */ - if(H5G_dense_remove_by_idx(grp_oloc->file, dxpl_id, &linfo, grp_full_path_r, idx_type, order, n) < 0) + if(H5G__dense_remove_by_idx(grp_oloc->file, dxpl_id, &linfo, grp_full_path_r, idx_type, order, n) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object") } /* end if */ else { /* Remove object from compact link storage */ - if(H5G_compact_remove_by_idx(grp_oloc, dxpl_id, &linfo, grp_full_path_r, idx_type, order, n) < 0) + if(H5G__compact_remove_by_idx(grp_oloc, dxpl_id, &linfo, grp_full_path_r, idx_type, order, n) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object") } /* end else */ } /* end if */ @@ -1094,7 +1094,7 @@ H5G_obj_remove_by_idx(H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r, use_old_format = TRUE; /* Remove object from the symbol table */ - if(H5G_stab_remove_by_idx(grp_oloc, dxpl_id, grp_full_path_r, order, n) < 0) + if(H5G__stab_remove_by_idx(grp_oloc, dxpl_id, grp_full_path_r, order, n) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object") } /* end else */ @@ -1110,7 +1110,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_obj_lookup + * Function: H5G__obj_lookup * * Purpose: Look up a link in a group, using the name as the key. * @@ -1123,44 +1123,44 @@ done: *------------------------------------------------------------------------- */ htri_t -H5G_obj_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, +H5G__obj_lookup(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, hid_t dxpl_id) { H5O_linfo_t linfo; /* Link info message */ htri_t linfo_exists; /* Whether the link info message exists */ htri_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_NOAPI_TAG(dxpl_id, grp_oloc->addr, FAIL) + FUNC_ENTER_PACKAGE_TAG(dxpl_id, grp_oloc->addr, FAIL) /* check arguments */ HDassert(grp_oloc && grp_oloc->file); HDassert(name && *name); /* Attempt to get the link info message for this group */ - if((linfo_exists = H5G_obj_get_linfo(grp_oloc, &linfo, dxpl_id)) < 0) + if((linfo_exists = H5G__obj_get_linfo(grp_oloc, &linfo, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message") if(linfo_exists) { /* Check for dense link storage */ if(H5F_addr_defined(linfo.fheap_addr)) { /* Get the object's info from the dense link storage */ - if((ret_value = H5G_dense_lookup(grp_oloc->file, dxpl_id, &linfo, name, lnk)) < 0) + if((ret_value = H5G__dense_lookup(grp_oloc->file, dxpl_id, &linfo, name, lnk)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object") } /* end if */ else { /* Get the object's info from the link messages */ - if((ret_value = H5G_compact_lookup(grp_oloc, name, lnk, dxpl_id)) < 0) + if((ret_value = H5G__compact_lookup(grp_oloc, name, lnk, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object") } /* end else */ } /* end if */ else { /* Get the object's info from the symbol table */ - if((ret_value = H5G_stab_lookup(grp_oloc, name, lnk, dxpl_id)) < 0) + if((ret_value = H5G__stab_lookup(grp_oloc, name, lnk, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object") } /* end else */ done: FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) -} /* end H5G_obj_lookup() */ +} /* end H5G__obj_lookup() */ /*------------------------------------------------------------------------- @@ -1178,7 +1178,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_obj_lookup_by_idx(H5O_loc_t *grp_oloc, H5_index_t idx_type, +H5G_obj_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_link_t *lnk, hid_t dxpl_id) { H5O_linfo_t linfo; /* Link info message */ @@ -1191,7 +1191,7 @@ H5G_obj_lookup_by_idx(H5O_loc_t *grp_oloc, H5_index_t idx_type, HDassert(grp_oloc && grp_oloc->file); /* Attempt to get the link info message for this group */ - if((linfo_exists = H5G_obj_get_linfo(grp_oloc, &linfo, dxpl_id)) < 0) + if((linfo_exists = H5G__obj_get_linfo(grp_oloc, &linfo, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message") if(linfo_exists) { /* Check for creation order tracking, if creation order index lookup requested */ @@ -1204,12 +1204,12 @@ H5G_obj_lookup_by_idx(H5O_loc_t *grp_oloc, H5_index_t idx_type, /* Check for dense link storage */ if(H5F_addr_defined(linfo.fheap_addr)) { /* Get the link from the dense storage */ - if(H5G_dense_lookup_by_idx(grp_oloc->file, dxpl_id, &linfo, idx_type, order, n, lnk) < 0) + if(H5G__dense_lookup_by_idx(grp_oloc->file, dxpl_id, &linfo, idx_type, order, n, lnk) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object") } /* end if */ else { /* Get the link from the link messages */ - if(H5G_compact_lookup_by_idx(grp_oloc, dxpl_id, &linfo, idx_type, order, n, lnk) < 0) + if(H5G__compact_lookup_by_idx(grp_oloc, dxpl_id, &linfo, idx_type, order, n, lnk) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object") } /* end else */ } /* end if */ @@ -1219,7 +1219,7 @@ H5G_obj_lookup_by_idx(H5O_loc_t *grp_oloc, H5_index_t idx_type, HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no creation order index to query") /* Get the object's info from the symbol table */ - if(H5G_stab_lookup_by_idx(grp_oloc, order, n, lnk, dxpl_id) < 0) + if(H5G__stab_lookup_by_idx(grp_oloc, order, n, lnk, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object") } /* end else */ diff --git a/src/H5Goh.c b/src/H5Goh.c index d306836..194e3ec 100644 --- a/src/H5Goh.c +++ b/src/H5Goh.c @@ -263,7 +263,7 @@ H5O_group_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc, hid_t dxpl_id) HDassert(obj_loc); /* Create the the group */ - if(NULL == (grp = H5G_create(f, crt_info, dxpl_id))) + if(NULL == (grp = H5G__create(f, crt_info, dxpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group") /* Set up the new group's location */ @@ -398,7 +398,7 @@ H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't find LINFO nor STAB messages") /* Get symbol table size info */ - if(H5G_stab_bh_size(f, dxpl_id, &stab, bh_info) < 0) + if(H5G__stab_bh_size(f, dxpl_id, &stab, bh_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve symbol table size info") } /* end else */ diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index b8f5f42..e2180c0 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -46,18 +46,6 @@ /* Standard length of fractal heap ID for link */ #define H5G_DENSE_FHEAP_ID_LEN 7 -/* - * During name lookups (see H5G_traverse()) we sometimes want information about - * a symbolic link or a mount point. The normal operation is to follow the - * symbolic link or mount point and return information about its target. - */ -#define H5G_TARGET_NORMAL 0x0000 -#define H5G_TARGET_SLINK 0x0001 -#define H5G_TARGET_MOUNT 0x0002 -#define H5G_TARGET_UDLINK 0x0004 -#define H5G_TARGET_EXISTS 0x0008 -#define H5G_CRT_INTMD_GROUP 0x0010 - /* Size of a symbol table node on disk */ #define H5G_NODE_SIZE(f) ( \ /* General metadata fields */ \ @@ -95,7 +83,7 @@ typedef enum H5G_cache_type_t { * messages... The values are entered into the symbol table when an object * header is created (by hand) and are extracted from the symbol table with a * callback function registered in H5O_init_interface(). Be sure to update - * H5G_ent_decode(), H5G_ent_encode(), and H5G_ent_debug() as well. + * H5G_ent_decode(), H5G_ent_encode(), and H5G__ent_debug() as well. */ typedef union H5G_cache_t { struct { @@ -156,24 +144,6 @@ struct H5G_t { /* Link iteration operator for internal library callbacks */ typedef herr_t (*H5G_lib_iterate_t)(const H5O_link_t *lnk, void *op_data); -/* Describe kind of callback to make for each link */ -typedef enum H5G_link_iterate_op_type_t { -#ifndef H5_NO_DEPRECATED_SYMBOLS - H5G_LINK_OP_OLD, /* "Old" application callback */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - H5G_LINK_OP_NEW /* "New" application callback */ -} H5G_link_iterate_op_type_t; - -typedef struct { - H5G_link_iterate_op_type_t op_type; - union { -#ifndef H5_NO_DEPRECATED_SYMBOLS - H5G_iterate_t op_old; /* "Old" application callback for each link */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - H5L_iterate_t op_new; /* "New" application callback for each link */ - } op_func; -} H5G_link_iterate_t; - /* Data structure to hold table of links for a group */ typedef struct { size_t nlinks; /* # of links in table */ @@ -318,20 +288,6 @@ typedef struct H5G_bt2_ud_ins_t { uint8_t id[H5G_DENSE_FHEAP_ID_LEN]; /* Heap ID of link to insert */ } H5G_bt2_ud_ins_t; -/* Typedef for path traversal operations */ -/* grp_loc is the location of the group in which the targeted object is located. - * name is the last component of the object's name - * lnk is the link between the group and the object - * obj_loc is the target of the traversal (or NULL if the object doesn't exist) - * operator_data is whatever udata was supplied when H5G_traverse was called - * own_loc should be set to H5G_OWN_OBJ_LOC if this callback takes ownership of obj_loc, - * H5G_OWN_GRP_LOC if it takes ownership of grp_loc, and H5G_OWN_NONE if obj_loc and - * grp_loc need to be deleted. - */ -typedef herr_t (*H5G_traverse_t)(H5G_loc_t *grp_loc/*in*/, const char *name, - const H5O_link_t *lnk/*in*/, H5G_loc_t *obj_loc/*out*/, void *operator_data/*in,out*/, - H5G_own_loc_t *own_loc/*out*/); - /* Typedef for group creation operation */ typedef struct H5G_obj_create_t{ hid_t gcpl_id; /* Group creation property list */ @@ -378,69 +334,62 @@ H5FL_EXTERN(H5G_shared_t); /* * General group routines */ -H5_DLL H5G_t *H5G_create(H5F_t *file, H5G_obj_create_t *gcrt_info, +H5_DLL H5G_t *H5G__create(H5F_t *file, H5G_obj_create_t *gcrt_info, hid_t dxpl_id); -H5_DLL H5G_t *H5G_create_named(const H5G_loc_t *loc, const char *name, +H5_DLL H5G_t *H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id); -H5_DLL H5G_t *H5G_open_name(const H5G_loc_t *loc, const char *name, +H5_DLL H5G_t *H5G__open_name(const H5G_loc_t *loc, const char *name, hid_t gapl_id, hid_t dxpl_id); -H5_DLL herr_t H5G_iterate(hid_t loc_id, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, - const H5G_link_iterate_t *lnk_op, void *op_data, hid_t lapl_id, hid_t dxpl_id); /* * Group hierarchy traversal routines */ -H5_DLL herr_t H5G_traverse_special(const H5G_loc_t *grp_loc, +H5_DLL herr_t H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, unsigned target, size_t *nlinks, hbool_t last_comp, H5G_loc_t *obj_loc, hbool_t *obj_exists, hid_t lapl_id, hid_t dxpl_id); -H5_DLL herr_t H5G_traverse(const H5G_loc_t *loc, const char *name, - unsigned target, H5G_traverse_t op, void *op_data, hid_t lapl_id, - hid_t dxpl_id); /* * Utility functions */ -H5_DLL herr_t H5G_init(void); -H5_DLL char *H5G_normalize(const char *name); -H5_DLL const char *H5G_component(const char *name, size_t *size_p); +H5_DLL herr_t H5G__init(void); +H5_DLL const char *H5G__component(const char *name, size_t *size_p); /* * Functions that understand symbol tables but not names. The * functions that understand names are exported to the rest of * the library and appear in H5Gprivate.h. */ -H5_DLL herr_t H5G_stab_create(H5O_loc_t *grp_oloc, hid_t dxpl_id, +H5_DLL herr_t H5G__stab_create(H5O_loc_t *grp_oloc, hid_t dxpl_id, const H5O_ginfo_t *ginfo, H5O_stab_t *stab); -H5_DLL herr_t H5G_stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t dxpl_id); -H5_DLL herr_t H5G_stab_insert(const H5O_loc_t *grp_oloc, const char *name, +H5_DLL herr_t H5G__stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t dxpl_id); +H5_DLL herr_t H5G__stab_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, H5O_type_t obj_type, const void *crt_info, hid_t dxpl_id); -H5_DLL herr_t H5G_stab_insert_real(H5F_t *f, const H5O_stab_t *stab, +H5_DLL herr_t H5G__stab_insert_real(H5F_t *f, const H5O_stab_t *stab, const char *name, H5O_link_t *obj_lnk, H5O_type_t obj_type, const void *crt_info, hid_t dxpl_id); -H5_DLL herr_t H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab); -H5_DLL herr_t H5G_stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, +H5_DLL herr_t H5G__stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab); +H5_DLL herr_t H5G__stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, void *op_data); -H5_DLL herr_t H5G_stab_count(struct H5O_loc_t *oloc, hsize_t *num_objs, hid_t dxpl_id); -H5_DLL herr_t H5G_stab_bh_size(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab, +H5_DLL herr_t H5G__stab_count(struct H5O_loc_t *oloc, hsize_t *num_objs, hid_t dxpl_id); +H5_DLL herr_t H5G__stab_bh_size(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab, H5_ih_info_t *bh_info); -H5_DLL ssize_t H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, +H5_DLL ssize_t H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, char* name, size_t size, hid_t dxpl_id); -H5_DLL herr_t H5G_stab_remove(H5O_loc_t *oloc, hid_t dxpl_id, +H5_DLL herr_t H5G__stab_remove(const H5O_loc_t *oloc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r, const char *name); -H5_DLL herr_t H5G_stab_remove_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, +H5_DLL herr_t H5G__stab_remove_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r, H5_iter_order_t order, hsize_t n); -H5_DLL herr_t H5G_stab_lookup(H5O_loc_t *grp_oloc, const char *name, +H5_DLL herr_t H5G__stab_lookup(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, hid_t dxpl_id); -H5_DLL herr_t H5G_stab_lookup_by_idx(H5O_loc_t *grp_oloc, H5_iter_order_t order, +H5_DLL herr_t H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n, H5O_link_t *lnk, hid_t dxpl_id); #ifndef H5_STRICT_FORMAT_CHECKS -H5_DLL herr_t H5G_stab_valid(H5O_loc_t *grp_oloc, hid_t dxpl_id, +H5_DLL herr_t H5G__stab_valid(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5O_stab_t *alt_stab); #endif /* H5_STRICT_FORMAT_CHECKS */ #ifndef H5_NO_DEPRECATED_SYMBOLS -H5_DLL H5G_obj_t H5G_stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, +H5_DLL H5G_obj_t H5G__stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id); #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -448,167 +397,141 @@ H5_DLL H5G_obj_t H5G_stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, /* * Functions that understand symbol table entries. */ -H5_DLL herr_t H5G_ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, +H5_DLL void H5G__ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, H5_copy_depth_t depth); -H5_DLL herr_t H5G_ent_reset(H5G_entry_t *ent); -H5_DLL herr_t H5G_ent_decode_vec(const H5F_t *f, const uint8_t **pp, +H5_DLL void H5G__ent_reset(H5G_entry_t *ent); +H5_DLL herr_t H5G__ent_decode_vec(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, unsigned n); -H5_DLL herr_t H5G_ent_encode_vec(const H5F_t *f, uint8_t **pp, +H5_DLL herr_t H5G__ent_encode_vec(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsigned n); -H5_DLL herr_t H5G_ent_convert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, +H5_DLL herr_t H5G__ent_convert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, const char *name, const H5O_link_t *lnk, H5O_type_t obj_type, const void *crt_info, H5G_entry_t *ent); -H5_DLL herr_t H5G_ent_debug(const H5G_entry_t *ent, FILE * stream, int indent, +H5_DLL herr_t H5G__ent_debug(const H5G_entry_t *ent, FILE * stream, int indent, int fwidth, const H5HL_t *heap); /* Functions that understand symbol table nodes */ -H5_DLL herr_t H5G_node_init(H5F_t *f); -H5_DLL int H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr, +H5_DLL herr_t H5G__node_init(H5F_t *f); +H5_DLL int H5G__node_iterate(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr, const void *_rt_key, void *_udata); -H5_DLL int H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr, +H5_DLL int H5G__node_sumup(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr, const void *_rt_key, void *_udata); -H5_DLL int H5G_node_by_idx(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr, +H5_DLL int H5G__node_by_idx(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr, const void *_rt_key, void *_udata); -H5_DLL int H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr, +H5_DLL int H5G__node_copy(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr, const void *_rt_key, void *_udata); -H5_DLL int H5G_node_build_table(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr, +H5_DLL int H5G__node_build_table(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr, const void *_rt_key, void *_udata); -H5_DLL herr_t H5G_node_iterate_size(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr, +H5_DLL herr_t H5G__node_iterate_size(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr, const void *_rt_key, void *_udata); -H5_DLL herr_t H5G_node_free(H5G_node_t *sym); +H5_DLL herr_t H5G__node_free(H5G_node_t *sym); /* Functions that understand links in groups */ -H5_DLL int H5G_link_cmp_name_inc(const void *lnk1, const void *lnk2); -H5_DLL int H5G_link_cmp_name_dec(const void *lnk1, const void *lnk2); -H5_DLL int H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2); -H5_DLL int H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2); -H5_DLL herr_t H5G_ent_to_link(H5O_link_t *lnk, const H5HL_t *heap, +H5_DLL herr_t H5G__ent_to_link(H5O_link_t *lnk, const H5HL_t *heap, const H5G_entry_t *ent, const char *name); -H5_DLL herr_t H5G_link_to_info(const H5O_link_t *lnk, H5L_info_t *linfo); -H5_DLL herr_t H5G_link_to_loc(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, +H5_DLL herr_t H5G__link_to_loc(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, H5G_loc_t *obj_loc); -H5_DLL herr_t H5G_link_copy_file(H5F_t *dst_file, hid_t dxpl_id, - const H5O_link_t *_src_lnk, const H5O_loc_t *src_oloc, H5O_link_t *dst_lnk, - H5O_copy_t *cpy_info); -H5_DLL herr_t H5G_link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type, +H5_DLL herr_t H5G__link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type, H5_iter_order_t order); -H5_DLL herr_t H5G_link_iterate_table(const H5G_link_table_t *ltable, +H5_DLL herr_t H5G__link_iterate_table(const H5G_link_table_t *ltable, hsize_t skip, hsize_t *last_lnk, const H5G_lib_iterate_t op, void *op_data); -H5_DLL herr_t H5G_link_release_table(H5G_link_table_t *ltable); -H5_DLL herr_t H5G_link_name_replace(H5F_t *file, hid_t dxpl_id, +H5_DLL herr_t H5G__link_release_table(H5G_link_table_t *ltable); +H5_DLL herr_t H5G__link_name_replace(H5F_t *file, hid_t dxpl_id, H5RS_str_t *grp_full_path_r, const H5O_link_t *lnk); /* Functions that understand "compact" link storage */ -H5_DLL herr_t H5G_compact_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk, +H5_DLL herr_t H5G__compact_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk, hid_t dxpl_id); -H5_DLL ssize_t H5G_compact_get_name_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, +H5_DLL 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); -H5_DLL herr_t H5G_compact_remove(const H5O_loc_t *oloc, hid_t dxpl_id, +H5_DLL herr_t H5G__compact_remove(const H5O_loc_t *oloc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r, const char *name); -H5_DLL herr_t H5G_compact_remove_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id, +H5_DLL 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); -H5_DLL herr_t H5G_compact_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, +H5_DLL herr_t H5G__compact_iterate(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 skip, hsize_t *last_lnk, H5G_lib_iterate_t op, void *op_data); -H5_DLL htri_t H5G_compact_lookup(H5O_loc_t *grp_oloc, const char *name, +H5_DLL htri_t H5G__compact_lookup(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, hid_t dxpl_id); -H5_DLL herr_t H5G_compact_lookup_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, +H5_DLL herr_t H5G__compact_lookup_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 n, H5O_link_t *lnk); #ifndef H5_NO_DEPRECATED_SYMBOLS -H5_DLL H5G_obj_t H5G_compact_get_type_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, +H5_DLL H5G_obj_t H5G__compact_get_type_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo, hsize_t idx); #endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Functions that understand "dense" link storage */ -H5_DLL herr_t H5G_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, +H5_DLL herr_t H5G__dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order, H5G_link_table_t *ltable); -H5_DLL herr_t H5G_dense_create(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, +H5_DLL herr_t H5G__dense_create(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, const H5O_pline_t *pline); -H5_DLL herr_t H5G_dense_insert(H5F_t *f, hid_t dxpl_id, +H5_DLL herr_t H5G__dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, const H5O_link_t *lnk); -H5_DLL htri_t H5G_dense_lookup(H5F_t *f, hid_t dxpl_id, +H5_DLL htri_t H5G__dense_lookup(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, const char *name, H5O_link_t *lnk); -H5_DLL herr_t H5G_dense_lookup_by_idx(H5F_t *f, hid_t dxpl_id, +H5_DLL herr_t H5G__dense_lookup_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_link_t *lnk); -H5_DLL herr_t H5G_dense_iterate(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, +H5_DLL herr_t H5G__dense_iterate(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, void *op_data); -H5_DLL ssize_t H5G_dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id, +H5_DLL ssize_t H5G__dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name, size_t size); -H5_DLL herr_t H5G_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, +H5_DLL herr_t H5G__dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_r, const char *name); -H5_DLL herr_t H5G_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, +H5_DLL herr_t H5G__dense_remove_by_idx(H5F_t *f, 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); -H5_DLL herr_t H5G_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, +H5_DLL herr_t H5G__dense_delete(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, hbool_t adj_link); #ifndef H5_NO_DEPRECATED_SYMBOLS -H5_DLL H5G_obj_t H5G_dense_get_type_by_idx(H5F_t *f, hid_t dxpl_id, +H5_DLL H5G_obj_t H5G__dense_get_type_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, hsize_t idx); #endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Functions that understand group objects */ -H5_DLL herr_t H5G_obj_create(H5F_t *f, hid_t dxpl_id, +H5_DLL herr_t H5G__obj_create(H5F_t *f, hid_t dxpl_id, H5G_obj_create_t *gcrt_info, H5O_loc_t *oloc/*out*/); -H5_DLL herr_t H5G_obj_create_real(H5F_t *f, hid_t dxpl_id, +H5_DLL herr_t H5G__obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo, const H5O_linfo_t *linfo, const H5O_pline_t *pline, H5G_obj_create_t *gcrt_info, H5O_loc_t *oloc/*out*/); -H5_DLL htri_t H5G_obj_get_linfo(const H5O_loc_t *grp_oloc, H5O_linfo_t *linfo, +H5_DLL htri_t H5G__obj_get_linfo(const H5O_loc_t *grp_oloc, H5O_linfo_t *linfo, hid_t dxpl_id); -H5_DLL herr_t H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, - H5O_link_t *obj_lnk, hbool_t adj_link, H5O_type_t obj_type, - const void *crt_info, hid_t dxpl_id); -H5_DLL herr_t H5G_obj_iterate(const H5O_loc_t *grp_oloc, +H5_DLL herr_t H5G__obj_iterate(const H5O_loc_t *grp_oloc, 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, hid_t dxpl_id); -H5_DLL herr_t H5G_obj_info(H5O_loc_t *oloc, H5G_info_t *grp_info, hid_t dxpl_id); -H5_DLL ssize_t H5G_obj_get_name_by_idx(H5O_loc_t *oloc, H5_index_t idx_type, - H5_iter_order_t order, hsize_t n, char* name, size_t size, hid_t dxpl_id); -H5_DLL herr_t H5G_obj_remove(H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, - const char *name, hid_t dxpl_id); -H5_DLL herr_t H5G_obj_remove_by_idx(H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t dxpl_id); -H5_DLL htri_t H5G_obj_lookup(H5O_loc_t *grp_oloc, const char *name, +H5_DLL herr_t H5G__obj_info(H5O_loc_t *oloc, H5G_info_t *grp_info, hid_t dxpl_id); +H5_DLL htri_t H5G__obj_lookup(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, hid_t dxpl_id); -H5_DLL herr_t H5G_obj_lookup_by_idx(H5O_loc_t *grp_oloc, H5_index_t idx_type, - H5_iter_order_t order, hsize_t n, H5O_link_t *lnk, hid_t dxpl_id); /* * These functions operate on group hierarchy names. */ -H5_DLL herr_t H5G_name_init(H5G_name_t *name, const char *path); -H5_DLL herr_t H5G_name_set(H5G_name_t *loc, H5G_name_t *obj, const char *name); -H5_DLL H5RS_str_t *H5G_build_fullpath_refstr_str(H5RS_str_t *path_r, const char *name); +H5_DLL herr_t H5G__name_init(H5G_name_t *name, const char *path); /* * These functions operate on group "locations" */ -H5_DLL herr_t H5G_loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth); -H5_DLL herr_t H5G_loc_insert(H5G_loc_t *grp_loc, const char *name, +H5_DLL herr_t H5G__loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth); +H5_DLL herr_t H5G__loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc, H5O_type_t obj_type, const void *crt_info, hid_t dxpl_id); -/* - * These functions operate on the root group - */ -H5_DLL herr_t H5G_root_loc(H5F_t *f, H5G_loc_t *loc); - /* Testing functions */ #ifdef H5G_TESTING -H5_DLL htri_t H5G_is_empty_test(hid_t gid); -H5_DLL htri_t H5G_has_links_test(hid_t gid, unsigned *nmsgs); -H5_DLL htri_t H5G_has_stab_test(hid_t gid); -H5_DLL htri_t H5G_is_new_dense_test(hid_t gid); -H5_DLL herr_t H5G_new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count); -H5_DLL herr_t H5G_lheap_size_test(hid_t gid, size_t *lheap_size); -H5_DLL herr_t H5G_user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsigned *user_path_hidden); -H5_DLL herr_t H5G_verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent); -H5_DLL herr_t H5G_verify_cached_stabs_test(hid_t gid); +H5_DLL htri_t H5G__is_empty_test(hid_t gid); +H5_DLL htri_t H5G__has_links_test(hid_t gid, unsigned *nmsgs); +H5_DLL htri_t H5G__has_stab_test(hid_t gid); +H5_DLL htri_t H5G__is_new_dense_test(hid_t gid); +H5_DLL herr_t H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count); +H5_DLL herr_t H5G__lheap_size_test(hid_t gid, size_t *lheap_size); +H5_DLL herr_t H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsigned *user_path_hidden); +H5_DLL herr_t H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent); +H5_DLL herr_t H5G__verify_cached_stabs_test(hid_t gid); #endif /* H5G_TESTING */ #endif /* _H5Gpkg_H */ diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 140e22f..f765b52 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -105,6 +105,18 @@ #define H5G_MOUNTED(G) (H5G_mounted(G)) #endif /* H5G_PACKAGE */ +/* + * During name lookups (see H5G_traverse()) we sometimes want information about + * a symbolic link or a mount point. The normal operation is to follow the + * symbolic link or mount point and return information about its target. + */ +#define H5G_TARGET_NORMAL 0x0000 +#define H5G_TARGET_SLINK 0x0001 +#define H5G_TARGET_MOUNT 0x0002 +#define H5G_TARGET_UDLINK 0x0004 +#define H5G_TARGET_EXISTS 0x0008 +#define H5G_CRT_INTMD_GROUP 0x0010 + /* Type of operation being performed for call to H5G_name_replace() */ typedef enum { H5G_NAME_MOVE = 0, /* H5*move call */ @@ -141,6 +153,38 @@ typedef struct { H5G_name_t *path; /* Group hierarchy path */ } H5G_loc_t; +/* Typedef for path traversal operations */ +/* grp_loc is the location of the group in which the targeted object is located. + * name is the last component of the object's name + * lnk is the link between the group and the object + * obj_loc is the target of the traversal (or NULL if the object doesn't exist) + * operator_data is whatever udata was supplied when H5G_traverse was called + * own_loc should be set to H5G_OWN_OBJ_LOC if this callback takes ownership of obj_loc, + * H5G_OWN_GRP_LOC if it takes ownership of grp_loc, and H5G_OWN_NONE if obj_loc and + * grp_loc need to be deleted. + */ +typedef herr_t (*H5G_traverse_t)(H5G_loc_t *grp_loc/*in*/, const char *name, + const struct H5O_link_t *lnk/*in*/, H5G_loc_t *obj_loc/*out*/, void *operator_data/*in,out*/, + H5G_own_loc_t *own_loc/*out*/); + +/* Describe kind of callback to make for each link */ +typedef enum H5G_link_iterate_op_type_t { +#ifndef H5_NO_DEPRECATED_SYMBOLS + H5G_LINK_OP_OLD, /* "Old" application callback */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + H5G_LINK_OP_NEW /* "New" application callback */ +} H5G_link_iterate_op_type_t; + +typedef struct { + H5G_link_iterate_op_type_t op_type; + union { +#ifndef H5_NO_DEPRECATED_SYMBOLS + H5G_iterate_t op_old; /* "Old" application callback for each link */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + H5L_iterate_t op_new; /* "New" application callback for each link */ + } op_func; +} H5G_link_iterate_t; + typedef struct H5G_t H5G_t; typedef struct H5G_shared_t H5G_shared_t; typedef struct H5G_entry_t H5G_entry_t; @@ -150,9 +194,6 @@ typedef struct H5G_entry_t H5G_entry_t; * call. */ H5_DLL struct H5O_loc_t *H5G_oloc(H5G_t *grp); -H5_DLL herr_t H5G_mkroot(H5F_t *f, hid_t dxpl_id, hbool_t create_root); -H5_DLL herr_t H5G_root_free(H5G_t *grp); -H5_DLL H5G_t *H5G_rootof(H5F_t *f); H5_DLL H5G_name_t * H5G_nameof(H5G_t *grp); H5_DLL H5F_t *H5G_fileof(H5G_t *grp); H5_DLL H5G_t *H5G_open(const H5G_loc_t *loc, hid_t dxpl_id); @@ -164,10 +205,45 @@ H5_DLL herr_t H5G_unmount(H5G_t *grp); #ifndef H5_NO_DEPRECATED_SYMBOLS H5_DLL H5G_obj_t H5G_map_obj_type(H5O_type_t obj_type); #endif /* H5_NO_DEPRECATED_SYMBOLS */ + +/* + * Utility functions + */ +H5_DLL char *H5G_normalize(const char *name); + +/* + * Group hierarchy traversal routines + */ +H5_DLL herr_t H5G_traverse(const H5G_loc_t *loc, const char *name, + unsigned target, H5G_traverse_t op, void *op_data, hid_t lapl_id, + hid_t dxpl_id); +H5_DLL herr_t H5G_iterate(hid_t loc_id, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, + const H5G_link_iterate_t *lnk_op, void *op_data, hid_t lapl_id, hid_t dxpl_id); H5_DLL herr_t H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data, hid_t lapl_id, hid_t dxpl_id); +/* + * Functions that understand links in groups + */ +H5_DLL herr_t H5G_link_to_info(const struct H5O_link_t *lnk, H5L_info_t *linfo); + +/* + * Functions that understand group objects + */ +H5_DLL herr_t H5G_obj_insert(const struct H5O_loc_t *grp_oloc, const char *name, + struct H5O_link_t *obj_lnk, hbool_t adj_link, H5O_type_t obj_type, + const void *crt_info, hid_t dxpl_id); +H5_DLL ssize_t H5G_obj_get_name_by_idx(const struct H5O_loc_t *oloc, H5_index_t idx_type, + H5_iter_order_t order, hsize_t n, char* name, size_t size, hid_t dxpl_id); +H5_DLL herr_t H5G_obj_remove(const struct H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, + const char *name, hid_t dxpl_id); +H5_DLL herr_t H5G_obj_remove_by_idx(const struct H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t dxpl_id); +H5_DLL herr_t H5G_obj_lookup_by_idx(const struct H5O_loc_t *grp_oloc, H5_index_t idx_type, + H5_iter_order_t order, hsize_t n, struct H5O_link_t *lnk, hid_t dxpl_id); + /* * These functions operate on symbol table nodes. */ @@ -184,6 +260,7 @@ H5_DLL herr_t H5G_ent_decode(const H5F_t *f, const uint8_t **pp, H5G_entry_t *en /* * These functions operate on group hierarchy names. */ +H5_DLL herr_t H5G_name_set(const H5G_name_t *loc, H5G_name_t *obj, const char *name); H5_DLL herr_t H5G_name_replace(const struct H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file, H5RS_str_t *src_full_path_r, H5F_t *dst_file, H5RS_str_t *dst_full_path_r, hid_t dxpl_id); @@ -194,6 +271,7 @@ H5_DLL ssize_t H5G_get_name(const H5G_loc_t *loc, char *name/*out*/, size_t size hbool_t *cached, hid_t lapl_id, hid_t dxpl_id); H5_DLL ssize_t H5G_get_name_by_addr(hid_t fid, hid_t lapl_id, hid_t dxpl_id, const struct H5O_loc_t *loc, char* name, size_t size); +H5_DLL H5RS_str_t *H5G_build_fullpath_refstr_str(H5RS_str_t *path_r, const char *name); /* * These functions operate on group "locations" @@ -216,5 +294,13 @@ H5_DLL ssize_t H5G_loc_get_comment(H5G_loc_t *loc, const char *name, H5_DLL herr_t H5G_loc_reset(H5G_loc_t *loc); H5_DLL herr_t H5G_loc_free(H5G_loc_t *loc); +/* + * These functions operate on the root group + */ +H5_DLL herr_t H5G_mkroot(H5F_t *f, hid_t dxpl_id, hbool_t create_root); +H5_DLL herr_t H5G_root_loc(H5F_t *f, H5G_loc_t *loc); +H5_DLL herr_t H5G_root_free(H5G_t *grp); +H5_DLL H5G_t *H5G_rootof(H5F_t *f); + #endif /* _H5Gprivate_H */ diff --git a/src/H5Groot.c b/src/H5Groot.c index 73c6501..5ec9d3a 100644 --- a/src/H5Groot.c +++ b/src/H5Groot.c @@ -166,7 +166,7 @@ H5G_mkroot(H5F_t *f, hid_t dxpl_id, hbool_t create_root) HGOTO_DONE(SUCCEED) /* Create information needed for group nodes */ - if(H5G_node_init(f) < 0) + if(H5G__node_init(f) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group node info") /* @@ -194,7 +194,7 @@ H5G_mkroot(H5F_t *f, hid_t dxpl_id, hbool_t create_root) /* (Pass the FCPL which is a sub-class of the group creation property class) */ gcrt_info.gcpl_id = f->shared->fcpl_id; gcrt_info.cache_type = H5G_NOTHING_CACHED; - if(H5G_obj_create(f, dxpl_id, &gcrt_info, root_loc.oloc/*out*/) < 0) + if(H5G__obj_create(f, dxpl_id, &gcrt_info, root_loc.oloc/*out*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry") if(1 != H5O_link(root_loc.oloc, 1, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_LINKCOUNT, FAIL, "internal error (wrong link count)") @@ -255,7 +255,7 @@ H5G_mkroot(H5F_t *f, hid_t dxpl_id, hbool_t create_root) /* Check if the symbol table message is valid, and replace with the * cached symbol table if necessary */ - if(H5G_stab_valid(root_loc.oloc, dxpl_id, &cached_stab) < 0) + if(H5G__stab_valid(root_loc.oloc, dxpl_id, &cached_stab) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to verify symbol table") } /* end if */ #endif /* H5_STRICT_FORMAT_CHECKS */ @@ -293,7 +293,7 @@ H5G_mkroot(H5F_t *f, hid_t dxpl_id, hbool_t create_root) } /* end if */ /* Create the path names for the root group's entry */ - H5G_name_init(root_loc.path, "/"); + H5G__name_init(root_loc.path, "/"); path_init = TRUE; f->shared->root_grp->shared->fo_count = 1; diff --git a/src/H5Gstab.c b/src/H5Gstab.c index be692fc..4c338c9 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -117,7 +117,7 @@ typedef struct H5G_bt_it_lbi_t { /*------------------------------------------------------------------------- - * Function: H5G_stab_create_components + * Function: H5G__stab_create_components * * Purpose: Creates the components for a new, empty, symbol table (name heap * and B-tree). The caller can specify an initial size for the @@ -136,13 +136,13 @@ typedef struct H5G_bt_it_lbi_t { *------------------------------------------------------------------------- */ herr_t -H5G_stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t dxpl_id) +H5G__stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t dxpl_id) { H5HL_t *heap = NULL; /* Pointer to local heap */ size_t name_offset; /* Offset of "" name */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -179,11 +179,11 @@ done: HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_stab_create_components() */ +} /* end H5G__stab_create_components() */ /*------------------------------------------------------------------------- - * Function: H5G_stab_create + * Function: H5G__stab_create * * Purpose: Creates a new empty symbol table (object header, name heap, * and B-tree). The caller can specify an initial size for the @@ -203,14 +203,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_stab_create(H5O_loc_t *grp_oloc, hid_t dxpl_id, const H5O_ginfo_t *ginfo, +H5G__stab_create(H5O_loc_t *grp_oloc, hid_t dxpl_id, const H5O_ginfo_t *ginfo, H5O_stab_t *stab) { size_t heap_hint; /* Local heap size hint */ size_t size_hint; /* Local heap size hint */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_TAG(dxpl_id, grp_oloc->addr, FAIL) + FUNC_ENTER_PACKAGE_TAG(dxpl_id, grp_oloc->addr, FAIL) /* * Check arguments. @@ -228,7 +228,7 @@ H5G_stab_create(H5O_loc_t *grp_oloc, hid_t dxpl_id, const H5O_ginfo_t *ginfo, size_hint = MAX(heap_hint, H5HL_SIZEOF_FREE(grp_oloc->file) + 2); /* Go create the B-tree & local heap */ - if(H5G_stab_create_components(grp_oloc->file, stab, size_hint, dxpl_id) < 0) + if(H5G__stab_create_components(grp_oloc->file, stab, size_hint, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create symbol table components") /* @@ -240,11 +240,11 @@ H5G_stab_create(H5O_loc_t *grp_oloc, hid_t dxpl_id, const H5O_ginfo_t *ginfo, done: FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) -} /* end H5G_stab_create() */ +} /* end H5G__stab_create() */ /*------------------------------------------------------------------------- - * Function: H5G_stab_insert_real + * Function: H5G__stab_insert_real * * Purpose: Insert a new symbol into a table. * The name of the new symbol is NAME and its symbol @@ -259,7 +259,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_stab_insert_real(H5F_t *f, const H5O_stab_t *stab, const char *name, +H5G__stab_insert_real(H5F_t *f, const H5O_stab_t *stab, const char *name, H5O_link_t *obj_lnk, H5O_type_t obj_type, const void *crt_info, hid_t dxpl_id) { @@ -267,7 +267,7 @@ H5G_stab_insert_real(H5F_t *f, const H5O_stab_t *stab, const char *name, H5G_bt_ins_t udata; /* Data to pass through B-tree */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check arguments */ HDassert(f); @@ -296,11 +296,11 @@ done: HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_stab_insert_real() */ +} /* end H5G__stab_insert_real() */ /*------------------------------------------------------------------------- - * Function: H5G_stab_insert + * Function: H5G__stab_insert * * Purpose: Insert a new symbol into the table described by GRP_ENT in * file F. The name of the new symbol is NAME and its symbol @@ -315,14 +315,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_stab_insert(const H5O_loc_t *grp_oloc, const char *name, +H5G__stab_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, H5O_type_t obj_type, const void *crt_info, hid_t dxpl_id) { H5O_stab_t stab; /* Symbol table message */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_TAG(dxpl_id, grp_oloc->addr, FAIL) + FUNC_ENTER_PACKAGE_TAG(dxpl_id, grp_oloc->addr, FAIL) /* check arguments */ HDassert(grp_oloc && grp_oloc->file); @@ -333,17 +333,17 @@ H5G_stab_insert(const H5O_loc_t *grp_oloc, const char *name, if(NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table") - if(H5G_stab_insert_real(grp_oloc->file, &stab, name, obj_lnk, obj_type, + if(H5G__stab_insert_real(grp_oloc->file, &stab, name, obj_lnk, obj_type, crt_info, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "unable to insert the name") done: FUNC_LEAVE_NOAPI_TAG(ret_value, H5_ITER_ERROR) -} /* end H5G_stab_insert() */ +} /* end H5G__stab_insert() */ /*------------------------------------------------------------------------- - * Function: H5G_stab_remove + * Function: H5G__stab_remove * * Purpose: Remove NAME from a symbol table. * @@ -355,7 +355,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_stab_remove(H5O_loc_t *loc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r, +H5G__stab_remove(const H5O_loc_t *loc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r, const char *name) { H5HL_t *heap = NULL; /* Pointer to local heap */ @@ -363,7 +363,7 @@ H5G_stab_remove(H5O_loc_t *loc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r, H5G_bt_rm_t udata; /*data to pass through B-tree */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE HDassert(loc && loc->file); HDassert(name && *name); @@ -391,11 +391,11 @@ done: HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_stab_remove() */ +} /* end H5G__stab_remove() */ /*------------------------------------------------------------------------- - * Function: H5G_stab_remove_by_idx + * Function: H5G__stab_remove_by_idx * * Purpose: Remove NAME from a symbol table, according to the name index. * @@ -407,7 +407,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_stab_remove_by_idx(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r, +H5G__stab_remove_by_idx(const H5O_loc_t *grp_oloc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r, H5_iter_order_t order, hsize_t n) { H5HL_t *heap = NULL; /* Pointer to local heap */ @@ -417,12 +417,12 @@ H5G_stab_remove_by_idx(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5RS_str_t *grp_full_ hbool_t lnk_copied = FALSE; /* Whether the link was copied */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE HDassert(grp_oloc && grp_oloc->file); /* Look up name of link to remove, by index */ - if(H5G_stab_lookup_by_idx(grp_oloc, order, n, &obj_lnk, dxpl_id) < 0) + if(H5G__stab_lookup_by_idx(grp_oloc, order, n, &obj_lnk, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get link information") lnk_copied = TRUE; @@ -453,11 +453,11 @@ done: H5O_msg_reset(H5O_LINK_ID, &obj_lnk); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_stab_remove_by_idx() */ +} /* end H5G__stab_remove_by_idx() */ /*------------------------------------------------------------------------- - * Function: H5G_stab_delete + * Function: H5G__stab_delete * * Purpose: Delete entire symbol table information from file * @@ -471,13 +471,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab) +H5G__stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab) { H5HL_t *heap = NULL; /* Pointer to local heap */ H5G_bt_rm_t udata; /*data to pass through B-tree */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE HDassert(f); HDassert(stab); @@ -511,11 +511,11 @@ done: HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_stab_delete() */ +} /* end H5G__stab_delete() */ /*------------------------------------------------------------------------- - * Function: H5G_stab_iterate + * Function: H5G__stab_iterate * * Purpose: Iterate over the objects in a group * @@ -527,7 +527,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, +H5G__stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, void *op_data) { H5HL_t *heap = NULL; /* Local heap for group */ @@ -535,7 +535,7 @@ H5G_stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, H5G_link_table_t ltable = {0, NULL}; /* Link table */ herr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI_TAG(dxpl_id, oloc->addr, FAIL) + FUNC_ENTER_PACKAGE_TAG(dxpl_id, oloc->addr, FAIL) /* Sanity check */ HDassert(oloc); @@ -554,7 +554,7 @@ H5G_stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, if(order != H5_ITER_DEC) { H5G_bt_it_it_t udata; /* User data to pass to B-tree callback */ - /* Build udata to pass through H5B_iterate() to H5G_node_iterate() */ + /* Build udata to pass through H5B_iterate() to H5G__node_iterate() */ udata.heap = heap; udata.skip = skip; udata.final_ent = last_lnk; @@ -562,7 +562,7 @@ H5G_stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, udata.op_data = op_data; /* Iterate over the group members */ - if((ret_value = H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G_node_iterate, &udata)) < 0) + if((ret_value = H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_iterate, &udata)) < 0) HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed"); /* Check for too high of a starting index (ex post facto :-) */ @@ -573,13 +573,13 @@ H5G_stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, else { H5G_bt_it_bt_t udata; /* User data to pass to B-tree callback */ - /* Build udata to pass through H5B_iterate() to H5G_node_build_table() */ + /* Build udata to pass through H5B_iterate() to H5G__node_build_table() */ udata.alloc_nlinks = 0; udata.heap = heap; udata.ltable = <able; /* Iterate over the group members */ - if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G_node_build_table, &udata) < 0) + if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_build_table, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to build link table") /* Check for skipping out of bounds */ @@ -587,11 +587,11 @@ H5G_stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound") /* Sort link table in correct iteration order */ - if(H5G_link_sort_table(<able, H5_INDEX_NAME, order) < 0) + if(H5G__link_sort_table(<able, H5_INDEX_NAME, order) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSORT, FAIL, "error sorting link messages") /* Iterate over links in table */ - if((ret_value = H5G_link_iterate_table(<able, skip, last_lnk, op, op_data)) < 0) + if((ret_value = H5G__link_iterate_table(<able, skip, last_lnk, op, op_data)) < 0) HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed"); } /* end else */ @@ -599,15 +599,15 @@ done: /* Release resources */ if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") - if(ltable.lnks && H5G_link_release_table(<able) < 0) + if(ltable.lnks && H5G__link_release_table(<able) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) -} /* end H5G_stab_iterate() */ +} /* end H5G__stab_iterate() */ /*------------------------------------------------------------------------- - * Function: H5G_stab_count + * Function: H5G__stab_count * * Purpose: Count the # of links in a group * @@ -619,12 +619,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_stab_count(H5O_loc_t *oloc, hsize_t *num_objs, hid_t dxpl_id) +H5G__stab_count(H5O_loc_t *oloc, hsize_t *num_objs, hid_t dxpl_id) { H5O_stab_t stab; /* Info about symbol table */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_TAG(dxpl_id, oloc->addr, FAIL) + FUNC_ENTER_PACKAGE_TAG(dxpl_id, oloc->addr, FAIL) /* Sanity check */ HDassert(oloc); @@ -638,16 +638,16 @@ H5G_stab_count(H5O_loc_t *oloc, hsize_t *num_objs, hid_t dxpl_id) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") /* Iterate over the group members */ - if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G_node_sumup, num_objs) < 0) + if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_sumup, num_objs) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed") done: FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) -} /* end H5G_stab_count() */ +} /* end H5G__stab_count() */ /*------------------------------------------------------------------------- - * Function: H5G_stab_bh_size + * Function: H5G__stab_bh_size * * Purpose: Retrieve storage for btree and heap (1.6) * @@ -659,14 +659,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_stab_bh_size(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab, +H5G__stab_bh_size(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab, H5_ih_info_t *bh_info) { hsize_t snode_size; /* Symbol table node size */ H5B_info_t bt_info; /* B-tree node info */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -677,7 +677,7 @@ H5G_stab_bh_size(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab, snode_size = 0; /* Get the B-tree & symbol table node size info */ - if(H5B_get_info(f, dxpl_id, H5B_SNODE, stab->btree_addr, &bt_info, H5G_node_iterate_size, &snode_size) < 0) + if(H5B_get_info(f, dxpl_id, H5B_SNODE, stab->btree_addr, &bt_info, H5G__node_iterate_size, &snode_size) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "iteration operator failed") /* Add symbol table & B-tree node sizes to index info */ @@ -689,7 +689,7 @@ H5G_stab_bh_size(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_stab_bh_size() */ +} /* end H5G__stab_bh_size() */ /*------------------------------------------------------------------------- @@ -731,7 +731,7 @@ H5G_stab_get_name_by_idx_cb(const H5G_entry_t *ent, void *_udata) /*------------------------------------------------------------------------- - * Function: H5G_stab_get_name_by_idx + * Function: H5G__stab_get_name_by_idx * * Purpose: Returns the name of objects in the group by giving index. * @@ -744,7 +744,7 @@ H5G_stab_get_name_by_idx_cb(const H5G_entry_t *ent, void *_udata) *------------------------------------------------------------------------- */ ssize_t -H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, +H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, char* name, size_t size, hid_t dxpl_id) { H5HL_t *heap = NULL; /* Pointer to local heap */ @@ -774,7 +774,7 @@ H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, hsize_t nlinks = 0; /* Number of links in group */ /* Iterate over the symbol table nodes, to count the links */ - if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G_node_sumup, &nlinks) < 0) + if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_sumup, &nlinks) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed") /* Map decreasing iteration order index to increasing iteration order index */ @@ -790,7 +790,7 @@ H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, udata_valid = TRUE; /* Iterate over the group members */ - if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G_node_by_idx, &udata) < 0) + if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed") /* If we don't know the name now, we almost certainly went out of bounds */ @@ -817,7 +817,7 @@ done: H5MM_xfree(udata.name); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_stab_get_name_by_idx() */ +} /* end H5G__stab_get_name_by_idx() */ /*------------------------------------------------------------------------- @@ -845,7 +845,7 @@ H5G_stab_lookup_cb(const H5G_entry_t *ent, void *_udata) /* Check for setting link info */ if(udata->lnk) /* Convert the entry to a link */ - if(H5G_ent_to_link(udata->lnk, udata->heap, ent, udata->name) < 0) + if(H5G__ent_to_link(udata->lnk, udata->heap, ent, udata->name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, FAIL, "unable to convert symbol table entry to link") done: @@ -854,7 +854,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_stab_lookup + * Function: H5G__stab_lookup * * Purpose: Look up an object relative to a group, using symbol table * @@ -867,7 +867,7 @@ done: *------------------------------------------------------------------------- */ htri_t -H5G_stab_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, +H5G__stab_lookup(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, hid_t dxpl_id) { H5HL_t *heap = NULL; /* Pointer to local heap */ @@ -876,7 +876,7 @@ H5G_stab_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, H5O_stab_t stab; /* Symbol table message */ htri_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check arguments */ HDassert(grp_oloc && grp_oloc->file); @@ -912,7 +912,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_stab_lookup() */ +} /* end H5G__stab_lookup() */ /*------------------------------------------------------------------------- @@ -947,7 +947,7 @@ H5G_stab_lookup_by_idx_cb(const H5G_entry_t *ent, void *_udata) HDassert(name); /* Convert the entry to a link */ - if(H5G_ent_to_link(udata->lnk, udata->heap, ent, name) < 0) + if(H5G__ent_to_link(udata->lnk, udata->heap, ent, name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, FAIL, "unable to convert symbol table entry to link") udata->found = TRUE; @@ -957,7 +957,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_stab_lookup_by_idx + * Function: H5G__stab_lookup_by_idx * * Purpose: Look up an object in a group, according to the name index * @@ -970,7 +970,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_stab_lookup_by_idx(H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n, +H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n, H5O_link_t *lnk, hid_t dxpl_id) { H5HL_t *heap = NULL; /* Pointer to local heap */ @@ -978,7 +978,7 @@ H5G_stab_lookup_by_idx(H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n, H5O_stab_t stab; /* Symbol table message */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check arguments */ HDassert(grp_oloc && grp_oloc->file); @@ -997,7 +997,7 @@ H5G_stab_lookup_by_idx(H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n, hsize_t nlinks = 0; /* Number of links in group */ /* Iterate over the symbol table nodes, to count the links */ - if(H5B_iterate(grp_oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G_node_sumup, &nlinks) < 0) + if(H5B_iterate(grp_oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_sumup, &nlinks) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed") /* Map decreasing iteration order index to increasing iteration order index */ @@ -1013,7 +1013,7 @@ H5G_stab_lookup_by_idx(H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n, udata.found = FALSE; /* Iterate over the group members */ - if(H5B_iterate(grp_oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G_node_by_idx, &udata) < 0) + if(H5B_iterate(grp_oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed") /* If we didn't find the link, we almost certainly went out of bounds */ @@ -1026,12 +1026,12 @@ done: HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_stab_lookup_by_idx() */ +} /* end H5G__stab_lookup_by_idx() */ #ifndef H5_STRICT_FORMAT_CHECKS /*------------------------------------------------------------------------- - * Function: H5G_stab_valid + * Function: H5G__stab_valid * * Purpose: Verify that a group's symbol table message is valid. If * provided, the addresses in alt_stab will be tried if the @@ -1053,14 +1053,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_stab_valid(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5O_stab_t *alt_stab) +H5G__stab_valid(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5O_stab_t *alt_stab) { H5O_stab_t stab; /* Current symbol table */ H5HL_t *heap = NULL; /* Pointer to local heap */ hbool_t changed = FALSE; /* Whether stab has been modified */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_TAG(dxpl_id, grp_oloc->addr, FAIL) + FUNC_ENTER_PACKAGE_TAG(dxpl_id, grp_oloc->addr, FAIL) /* Read the symbol table message */ if(NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, &stab, dxpl_id)) @@ -1107,7 +1107,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) -} /* end H5G_stab_valid */ +} /* end H5G__stab_valid */ #endif /* H5_STRICT_FORMAT_CHECKS */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -1172,7 +1172,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_get_objtype_by_idx + * Function: H5G__stab_get_type_by_idx * * Purpose: Private function for H5Gget_objtype_by_idx. * Returns the type of objects in the group by giving index. @@ -1187,13 +1187,13 @@ done: *------------------------------------------------------------------------- */ H5G_obj_t -H5G_stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id) +H5G__stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id) { H5O_stab_t stab; /* Info about local heap & B-tree */ H5G_bt_it_gtbi_t udata; /* User data for B-tree callback */ H5G_obj_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI_TAG(dxpl_id, oloc->addr, H5G_UNKNOWN) + FUNC_ENTER_PACKAGE_TAG(dxpl_id, oloc->addr, H5G_UNKNOWN) /* Sanity check */ HDassert(oloc); @@ -1211,7 +1211,7 @@ H5G_stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id) udata.type = H5G_UNKNOWN; /* Iterate over the group members */ - if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G_node_by_idx, &udata) < 0) + if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "iteration operator failed") /* If we don't know the type now, we almost certainly went out of bounds */ @@ -1223,6 +1223,6 @@ H5G_stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id) done: FUNC_LEAVE_NOAPI_TAG(ret_value, H5G_UNKNOWN) -} /* end H5G_stab_get_type_by_idx() */ +} /* end H5G__stab_get_type_by_idx() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Gtest.c b/src/H5Gtest.c index af8c30f..48aa10b 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -74,11 +74,11 @@ /*-------------------------------------------------------------------------- NAME - H5G_is_empty_test + H5G__is_empty_test PURPOSE Determine whether a group contains no objects USAGE - htri_t H5G_is_empty_test(gid) + htri_t H5G__is_empty_test(gid) hid_t gid; IN: group to check RETURNS Non-negative TRUE/FALSE on success, negative on failure @@ -92,14 +92,14 @@ REVISION LOG --------------------------------------------------------------------------*/ htri_t -H5G_is_empty_test(hid_t gid) +H5G__is_empty_test(hid_t gid) { H5G_t *grp = NULL; /* Pointer to group */ htri_t msg_exists = FALSE; /* Indicate that a header message is present */ htri_t linfo_exists = FALSE;/* Indicate that the 'link info' message is present */ htri_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get group structure */ if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) @@ -133,7 +133,7 @@ H5G_is_empty_test(hid_t gid) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link info messages found") /* Get the link info */ - if(H5G_obj_get_linfo(&(grp->oloc), &linfo, H5AC_dxpl_id) < 0) + if(H5G__obj_get_linfo(&(grp->oloc), &linfo, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info") /* Check for 'dense' link storage file addresses being defined */ @@ -171,7 +171,7 @@ H5G_is_empty_test(hid_t gid) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbol table message") /* Get the count of links in the group */ - if(H5G_stab_count(&(grp->oloc), &nlinks, H5AC_dxpl_id) < 0) + if(H5G__stab_count(&(grp->oloc), &nlinks, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to count links") /* Check for link count */ @@ -181,16 +181,16 @@ H5G_is_empty_test(hid_t gid) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5G_is_empty_test() */ +} /* H5G__is_empty_test() */ /*-------------------------------------------------------------------------- NAME - H5G_has_links_test + H5G__has_links_test PURPOSE Determine whether a group contains link messages USAGE - htri_t H5G_has_links_test(gid) + htri_t H5G__has_links_test(gid) hid_t gid; IN: group to check unsigned *nmsgs; OUT: # of link messages in header RETURNS @@ -204,13 +204,13 @@ done: REVISION LOG --------------------------------------------------------------------------*/ htri_t -H5G_has_links_test(hid_t gid, unsigned *nmsgs) +H5G__has_links_test(hid_t gid, unsigned *nmsgs) { H5G_t *grp = NULL; /* Pointer to group */ htri_t msg_exists = 0; /* Indicate that a header message is present */ htri_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get group structure */ if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) @@ -240,16 +240,16 @@ H5G_has_links_test(hid_t gid, unsigned *nmsgs) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5G_has_links_test() */ +} /* H5G__has_links_test() */ /*-------------------------------------------------------------------------- NAME - H5G_has_stab_test + H5G__has_stab_test PURPOSE Determine whether a group contains a symbol table message USAGE - htri_t H5G_has_stab_test(gid) + htri_t H5G__has_stab_test(gid) hid_t gid; IN: group to check RETURNS Non-negative TRUE/FALSE on success, negative on failure @@ -262,13 +262,13 @@ done: REVISION LOG --------------------------------------------------------------------------*/ htri_t -H5G_has_stab_test(hid_t gid) +H5G__has_stab_test(hid_t gid) { H5G_t *grp = NULL; /* Pointer to group */ htri_t msg_exists = 0; /* Indicate that a header message is present */ htri_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get group structure */ if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) @@ -288,16 +288,16 @@ H5G_has_stab_test(hid_t gid) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5G_has_stab_test() */ +} /* H5G__has_stab_test() */ /*-------------------------------------------------------------------------- NAME - H5G_is_new_dense_test + H5G__is_new_dense_test PURPOSE Determine whether a group is in the "new" format and dense USAGE - htri_t H5G_is_new_dense_test(gid) + htri_t H5G__is_new_dense_test(gid) hid_t gid; IN: group to check RETURNS Non-negative TRUE/FALSE on success, negative on failure @@ -312,13 +312,13 @@ done: REVISION LOG --------------------------------------------------------------------------*/ htri_t -H5G_is_new_dense_test(hid_t gid) +H5G__is_new_dense_test(hid_t gid) { H5G_t *grp = NULL; /* Pointer to group */ htri_t msg_exists = 0; /* Indicate that a header message is present */ htri_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get group structure */ if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) @@ -343,7 +343,7 @@ H5G_is_new_dense_test(hid_t gid) H5O_linfo_t linfo; /* Link info message */ /* Get the link info */ - if(H5G_obj_get_linfo(&(grp->oloc), &linfo, H5AC_dxpl_id) < 0) + if(H5G__obj_get_linfo(&(grp->oloc), &linfo, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info") /* Check for 'dense' link storage file addresses being defined */ @@ -355,16 +355,16 @@ H5G_is_new_dense_test(hid_t gid) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5G_is_new_dense_test() */ +} /* H5G__is_new_dense_test() */ /*-------------------------------------------------------------------------- NAME - H5G_new_dense_info_test + H5G__new_dense_info_test PURPOSE Retrieve information about the state of the new "dense" storage for groups USAGE - herr_t H5G_new_dense_info_test(gid, name_count, corder_count) + herr_t H5G__new_dense_info_test(gid, name_count, corder_count) hid_t gid; IN: group to check hsize_t *name_count; OUT: Number of links in name index hsize_t *corder_count; OUT: Number of links in creation order index @@ -380,7 +380,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5G_new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) +H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) { 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 */ @@ -388,7 +388,7 @@ H5G_new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) H5G_t *grp = NULL; /* Pointer to group */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get group structure */ if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) @@ -398,7 +398,7 @@ H5G_new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) H5_BEGIN_TAG(H5AC_dxpl_id, grp->oloc.addr, FAIL); /* Get the link info */ - if(H5G_obj_get_linfo(&(grp->oloc), &linfo, H5AC_dxpl_id) < 0) + if(H5G__obj_get_linfo(&(grp->oloc), &linfo, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info") /* Check for 'dense' link storage file addresses being defined */ @@ -439,16 +439,16 @@ done: HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index") FUNC_LEAVE_NOAPI(ret_value) -} /* H5G_new_dense_info_test() */ +} /* H5G__new_dense_info_test() */ /*-------------------------------------------------------------------------- NAME - H5G_lheap_size_test + H5G__lheap_size_test PURPOSE Determine the size of a local heap for a group USAGE - herr_t H5G_lheap_size_test(gid, lheap_size) + herr_t H5G__lheap_size_test(gid, lheap_size) hid_t gid; IN: group to check size_t *lheap_size; OUT: Size of local heap RETURNS @@ -462,13 +462,13 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5G_lheap_size_test(hid_t gid, size_t *lheap_size) +H5G__lheap_size_test(hid_t gid, size_t *lheap_size) { H5G_t *grp = NULL; /* Pointer to group */ H5O_stab_t stab; /* Symbol table message */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get group structure */ if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) @@ -484,16 +484,16 @@ H5G_lheap_size_test(hid_t gid, size_t *lheap_size) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5G_lheap_size_test() */ +} /* H5G__lheap_size_test() */ /*-------------------------------------------------------------------------- NAME - H5G_user_path_test + H5G__user_path_test PURPOSE Retrieve the user path for an ID USAGE - herr_t H5G_user_path_test(obj_id, user_path, user_path_len) + herr_t H5G__user_path_test(obj_id, user_path, user_path_len) hid_t obj_id; IN: ID to check char *user_path; OUT: Pointer to buffer for User path size_t *user_path_len; OUT: Size of user path @@ -510,13 +510,13 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5G_user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsigned *obj_hidden) +H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsigned *obj_hidden) { void *obj_ptr; /* Pointer to object for ID */ H5G_name_t *obj_path; /* Pointer to group hier. path for obj */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(user_path_len); @@ -583,11 +583,11 @@ H5G_user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsigne done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5G_user_path_test() */ +} /* H5G__user_path_test() */ /*------------------------------------------------------------------------- - * Function: H5G_verify_cached_stab_test + * Function: H5G__verify_cached_stab_test * * Purpose: Check that a that the provided group entry contains a * cached symbol table entry, that the entry matches that in @@ -603,13 +603,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent) +H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent) { H5O_stab_t stab; /* Symbol table */ H5HL_t *heap = NULL; /* Pointer to local heap */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_TAG(H5AC_ind_dxpl_id, grp_oloc->addr, FAIL) + FUNC_ENTER_PACKAGE_TAG(H5AC_ind_dxpl_id, grp_oloc->addr, FAIL) /* Verify that stab info is cached in ent */ if(ent->type != H5G_CACHED_STAB) @@ -639,7 +639,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) -} /* end H5G_verify_cached_stab_test() */ +} /* end H5G__verify_cached_stab_test() */ /*------------------------------------------------------------------------- @@ -670,7 +670,7 @@ H5G_verify_cached_stabs_test_cb(H5F_t *f, hid_t dxpl_id, unsigned i; int ret_value = H5_ITER_CONT; - FUNC_ENTER_NOAPI(H5_ITER_ERROR) + FUNC_ENTER_NOAPI_NOINIT /* * Check arguments. @@ -738,7 +738,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_verify_cached_stabs_test + * Function: H5G__verify_cached_stabs_test * * Purpose: If the provided group contains a symbol table, verifies * that all links in the group contain cached symbol table @@ -756,7 +756,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_verify_cached_stabs_test(hid_t gid) +H5G__verify_cached_stabs_test(hid_t gid) { H5G_t *grp = NULL; /* Group */ htri_t stab_exists; @@ -765,7 +765,7 @@ H5G_verify_cached_stabs_test(hid_t gid) haddr_t prev_tag = HADDR_UNDEF; /* Previous metadata tag */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check args */ HDassert(gid >= 0); @@ -803,5 +803,5 @@ H5G_verify_cached_stabs_test(hid_t gid) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_verify_cached_stabs_test() */ +} /* end H5G__verify_cached_stabs_test() */ diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 766dab4..aff87f8 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -201,7 +201,7 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, grp_loc_copy.path = &grp_path_copy; grp_loc_copy.oloc = &grp_oloc_copy; H5G_loc_reset(&grp_loc_copy); - if(H5G_loc_copy(&grp_loc_copy, grp_loc, H5_COPY_DEEP) < 0) + if(H5G__loc_copy(&grp_loc_copy, grp_loc, H5_COPY_DEEP) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "unable to copy object location") /* Create a group ID to pass to the user-defined callback */ @@ -263,7 +263,7 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, H5G_loc_free(obj_loc); /* Copy new object's location information */ - H5G_loc_copy(obj_loc, &new_loc, H5_COPY_DEEP); + H5G__loc_copy(obj_loc, &new_loc, H5_COPY_DEEP); /* Hold the file open until we free this object header (otherwise the * object location will be invalidated when the file closes). @@ -344,7 +344,7 @@ H5G_traverse_slink(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, /* ("tracking the names properly" means to ignore the effects of the * link traversal on the object's & group's paths - QAK) */ - H5G_loc_copy(&tmp_grp_loc, grp_loc, H5_COPY_DEEP); + H5G__loc_copy(&tmp_grp_loc, grp_loc, H5_COPY_DEEP); tmp_grp_loc_set = TRUE; /* Hold the object's group hier. path to restore later */ @@ -380,7 +380,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_traverse_special + * Function: H5G__traverse_special * * Purpose: Handle traversing special link situations * @@ -393,13 +393,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, +H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, unsigned target, size_t *nlinks, hbool_t last_comp, H5G_loc_t *obj_loc, hbool_t *obj_exists, hid_t lapl_id, hid_t dxpl_id) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(grp_loc); @@ -460,7 +460,7 @@ H5G_traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_traverse_special() */ +} /* end H5G__traverse_special() */ /*------------------------------------------------------------------------- @@ -544,7 +544,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, #endif /* H5_USING_MEMCHECKER */ /* Deep copy of the starting location to group location */ - if(H5G_loc_copy(&grp_loc, &loc, H5_COPY_DEEP) < 0) + if(H5G__loc_copy(&grp_loc, &loc, H5_COPY_DEEP) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to copy location") group_copy = TRUE; @@ -561,7 +561,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't get actual buffer") /* Traverse the path */ - while((name = H5G_component(name, &nchars)) && *name) { + while((name = H5G__component(name, &nchars)) && *name) { const char *s; /* Temporary string pointer */ htri_t lookup_status; /* Status from object lookup */ hbool_t obj_exists; /* Whether the object exists */ @@ -582,7 +582,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, } /* end if */ /* Check if this is the last component of the name */ - if(!((s = H5G_component(name + nchars, NULL)) && *s)) + if(!((s = H5G__component(name + nchars, NULL)) && *s)) last_comp = TRUE; /* If there's valid information in the link, reset it */ @@ -592,7 +592,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, } /* end if */ /* Get information for object in current group */ - if((lookup_status = H5G_obj_lookup(grp_loc.oloc, comp, &lnk/*out*/, dxpl_id)) < 0) + if((lookup_status = H5G__obj_lookup(grp_loc.oloc, comp, &lnk/*out*/, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't look up component") obj_exists = FALSE; @@ -604,7 +604,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, link_valid = TRUE; /* Build object location from the link */ - if(H5G_link_to_loc(&grp_loc, &lnk, &obj_loc) < 0) + if(H5G__link_to_loc(&grp_loc, &lnk, &obj_loc) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot initialize object location") obj_loc_valid = TRUE; @@ -613,7 +613,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, /* Perform any special traversals that the link needs */ /* (soft links, user-defined links, file mounting, etc.) */ - if(H5G_traverse_special(&grp_loc, &lnk, target, nlinks, last_comp, &obj_loc, &obj_exists, lapl_id, dxpl_id) < 0) + if(H5G__traverse_special(&grp_loc, &lnk, target, nlinks, last_comp, &obj_loc, &obj_exists, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_TRAVERSE, FAIL, "special link traversal failed") } /* end if */ @@ -679,7 +679,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, /* Check for the parent group having a link info message */ /* (OK if not found) */ /* Get the link info for parent group */ - if((exists = H5G_obj_get_linfo(grp_loc.oloc, &par_linfo, dxpl_id)) < 0) + if((exists = H5G__obj_get_linfo(grp_loc.oloc, &par_linfo, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header") if(exists) { /* Only keep the creation order information from the parent @@ -715,11 +715,11 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, gcrt_info.gcpl_id = H5P_GROUP_CREATE_DEFAULT; gcrt_info.cache_type = H5G_NOTHING_CACHED; HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); - if(H5G_obj_create_real(grp_oloc.file, dxpl_id, ginfo, linfo, pline, &gcrt_info, obj_loc.oloc/*out*/) < 0) + if(H5G__obj_create_real(grp_oloc.file, dxpl_id, ginfo, linfo, pline, &gcrt_info, obj_loc.oloc/*out*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry") /* Insert new group into current group's symbol table */ - if(H5G_loc_insert(&grp_loc, comp, &obj_loc, H5O_TYPE_GROUP, &gcrt_info, dxpl_id) < 0) + if(H5G__loc_insert(&grp_loc, comp, &obj_loc, H5O_TYPE_GROUP, &gcrt_info, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert intermediate group") /* Decrement refcount on intermediate group's object header in memory */ @@ -761,7 +761,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, /* Transfer "ownership" of the object's information to the group object */ H5G_loc_free(&grp_loc); - H5G_loc_copy(&grp_loc, &obj_loc, H5_COPY_SHALLOW); + H5G__loc_copy(&grp_loc, &obj_loc, H5_COPY_SHALLOW); H5G_loc_reset(&obj_loc); obj_loc_valid = FALSE; diff --git a/src/H5L.c b/src/H5L.c index ddf41dc..86a2e80 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -17,7 +17,6 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ #define H5L_PACKAGE /*suppress error about including H5Lpkg */ /* Interface initialization */ @@ -30,8 +29,8 @@ #include "H5ACprivate.h" /* Metadata cache */ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ -#include "H5Gpkg.h" /* Groups */ #include "H5Fprivate.h" /* File access */ +#include "H5Gprivate.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5Lpkg.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ @@ -2965,3 +2964,137 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_get_name_by_idx_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5L_link_copy_file + * + * Purpose: Copy a link and the object it points to from one file to + * another. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Sep 29 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5L_link_copy_file(H5F_t *dst_file, hid_t dxpl_id, const H5O_link_t *_src_lnk, + const H5O_loc_t *src_oloc, H5O_link_t *dst_lnk, H5O_copy_t *cpy_info) +{ + H5O_link_t tmp_src_lnk; /* Temporary copy of src link, when needed */ + const H5O_link_t *src_lnk = _src_lnk; /* Source link */ + hbool_t dst_lnk_init = FALSE; /* Whether the destination link is initialized */ + hbool_t expanded_link_open = FALSE; /* Whether the target location has been opened */ + H5G_loc_t tmp_src_loc; /* Group location holding target object */ + H5G_name_t tmp_src_path; /* Path for target object */ + H5O_loc_t tmp_src_oloc; /* Object location for target object */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* check arguments */ + HDassert(dst_file); + HDassert(src_lnk); + HDassert(dst_lnk); + HDassert(cpy_info); + + /* Expand soft or external link, if requested */ + if((H5L_TYPE_SOFT == src_lnk->type && cpy_info->expand_soft_link) + || (H5L_TYPE_EXTERNAL == src_lnk->type + && cpy_info->expand_ext_link)) { + H5G_loc_t lnk_grp_loc; /* Group location holding link */ + H5G_name_t lnk_grp_path; /* Path for link */ + htri_t tar_exists; /* Whether the target object exists */ + + /* Set up group location for link */ + H5G_name_reset(&lnk_grp_path); + lnk_grp_loc.path = &lnk_grp_path; + lnk_grp_loc.oloc = (H5O_loc_t *)src_oloc; /* Casting away const OK -QAK */ + + /* Check if the target object exists */ + if((tar_exists = H5G_loc_exists(&lnk_grp_loc, src_lnk->name, H5P_DEFAULT, + dxpl_id)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to check if target object exists") + + if(tar_exists) { + /* Make a temporary copy of the link, so that it will not change the + * info in the cache when we change it to a hard link */ + if(NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, &tmp_src_lnk)) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy message") + + /* Set up group location for target object. Let H5G_traverse expand + * the link. */ + tmp_src_loc.path = &tmp_src_path; + tmp_src_loc.oloc = &tmp_src_oloc; + if(H5G_loc_reset(&tmp_src_loc) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to reset location") + + /* Find the target object */ + if(H5G_loc_find(&lnk_grp_loc, src_lnk->name, &tmp_src_loc, + H5P_DEFAULT, dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to find target object") + expanded_link_open = TRUE; + + /* Convert symbolic link to hard link */ + if(tmp_src_lnk.type == H5L_TYPE_SOFT) + tmp_src_lnk.u.soft.name = + (char *)H5MM_xfree(tmp_src_lnk.u.soft.name); + else if(tmp_src_lnk.u.ud.size > 0) + tmp_src_lnk.u.ud.udata = H5MM_xfree(tmp_src_lnk.u.ud.udata); + tmp_src_lnk.type = H5L_TYPE_HARD; + tmp_src_lnk.u.hard.addr = tmp_src_oloc.addr; + src_lnk = &tmp_src_lnk; + } /* end if */ + } /* end if */ + + /* Copy src link information to dst link information */ + if(NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, dst_lnk)) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy message") + dst_lnk_init = TRUE; + + /* Check if object in source group is a hard link & copy it */ + if(H5L_TYPE_HARD == src_lnk->type) { + H5O_loc_t new_dst_oloc; /* Copied object location in destination */ + + /* Set up copied object location to fill in */ + H5O_loc_reset(&new_dst_oloc); + new_dst_oloc.file = dst_file; + + if(!expanded_link_open) { + /* Build temporary object location for source */ + H5O_loc_reset(&tmp_src_oloc); + tmp_src_oloc.file = src_oloc->file; + tmp_src_oloc.addr = src_lnk->u.hard.addr; + } /* end if */ + HDassert(H5F_addr_defined(tmp_src_oloc.addr)); + + /* Copy the shared object from source to destination */ + /* Don't care about obj_type or udata because those are only important + * for old style groups */ + if(H5O_copy_header_map(&tmp_src_oloc, &new_dst_oloc, dxpl_id, cpy_info, + TRUE, NULL, NULL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") + + /* Copy new destination object's information for eventual insertion */ + dst_lnk->u.hard.addr = new_dst_oloc.addr; + } /* end if */ + +done: + /* Check if we used a temporary src link */ + if(src_lnk != _src_lnk) { + HDassert(src_lnk == &tmp_src_lnk); + H5O_msg_reset(H5O_LINK_ID, &tmp_src_lnk); + } /* end if */ + if(ret_value < 0) + if(dst_lnk_init) + H5O_msg_reset(H5O_LINK_ID, dst_lnk); + /* Check if we need to free the temp source oloc */ + if(expanded_link_open) + if(H5G_loc_free(&tmp_src_loc) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free object") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L_link_copy_file() */ + diff --git a/src/H5Lpkg.h b/src/H5Lpkg.h index e02a871..2e931f5 100644 --- a/src/H5Lpkg.h +++ b/src/H5Lpkg.h @@ -56,6 +56,9 @@ H5_DLL herr_t H5L_create_ud(const H5G_loc_t *link_loc, const char *link_name, const void * ud_data, size_t ud_data_size, H5L_type_t type, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id); +H5_DLL herr_t H5L_link_copy_file(H5F_t *dst_file, hid_t dxpl_id, + const H5O_link_t *_src_lnk, const H5O_loc_t *src_oloc, H5O_link_t *dst_lnk, + H5O_copy_t *cpy_info); #endif /* _H5Lpkg_H */ diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index 87822c7..acdd1e1 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -25,12 +25,14 @@ */ #define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#define H5L_PACKAGE /*suppress error about including H5Lpkg */ #define H5O_PACKAGE /*suppress error about including H5Opkg */ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free lists */ #include "H5Gpkg.h" /* Groups */ +#include "H5Lpkg.h" /* Links */ #include "H5Opkg.h" /* Object headers */ @@ -353,7 +355,7 @@ H5O_linfo_delete(H5F_t *f, hid_t dxpl_id, H5O_t UNUSED *open_oh, void *_mesg) /* If the group is using "dense" link storage, delete it */ if(H5F_addr_defined(linfo->fheap_addr)) - if(H5G_dense_delete(f, dxpl_id, linfo, TRUE) < 0) + if(H5G__dense_delete(f, dxpl_id, linfo, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free dense link storage") done: @@ -413,7 +415,7 @@ H5O_linfo_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t *file_dst, */ if(H5F_addr_defined(linfo_src->fheap_addr)) { /* Create the dense link storage */ - if(H5G_dense_create(file_dst, dxpl_id, linfo_dst, udata->common.src_pline) < 0) + if(H5G__dense_create(file_dst, dxpl_id, linfo_dst, udata->common.src_pline) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create 'dense' form of new format group") } /* end if */ } /* end else */ @@ -460,7 +462,7 @@ H5O_linfo_post_copy_file_cb(const H5O_link_t *src_lnk, void *_udata) HDassert(udata); /* Copy the link (and the object it points to) */ - if(H5G_link_copy_file(udata->dst_oloc->file, udata->dxpl_id, src_lnk, + if(H5L_link_copy_file(udata->dst_oloc->file, udata->dxpl_id, src_lnk, udata->src_oloc, &dst_lnk, udata->cpy_info) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy link") dst_lnk_init = TRUE; @@ -470,7 +472,7 @@ H5O_linfo_post_copy_file_cb(const H5O_link_t *src_lnk, void *_udata) /* Insert the new object in the destination file's group */ /* (Doesn't increment the link count - that's already been taken care of for hard links) */ - if(H5G_dense_insert(udata->dst_oloc->file, udata->dxpl_id, udata->dst_linfo, &dst_lnk) < 0) + if(H5G__dense_insert(udata->dst_oloc->file, udata->dxpl_id, udata->dst_linfo, &dst_lnk) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, H5_ITER_ERROR, "unable to insert destination link") /* Reset metadata tag in dxpl_id */ @@ -531,7 +533,7 @@ H5O_linfo_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, udata.cpy_info = cpy_info; /* Iterate over the links in the group, building a table of the link messages */ - if(H5G_dense_iterate(src_oloc->file, dxpl_id, linfo_src, H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)0, NULL, H5O_linfo_post_copy_file_cb, &udata) < 0) + if(H5G__dense_iterate(src_oloc->file, dxpl_id, linfo_src, H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)0, NULL, H5O_linfo_post_copy_file_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links") } /* end if */ diff --git a/src/H5Olink.c b/src/H5Olink.c index 21984c7..ccc6d0e 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -25,6 +25,7 @@ */ #define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#define H5L_PACKAGE /*suppress error about including H5Lpkg */ #define H5O_PACKAGE /*suppress error about including H5Opkg */ #include "H5private.h" /* Generic Functions */ @@ -32,7 +33,7 @@ #include "H5FLprivate.h" /* Free lists */ #include "H5Gpkg.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ +#include "H5Lpkg.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ #include "H5Opkg.h" /* Object headers */ @@ -768,7 +769,7 @@ H5O_link_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, HDassert(cpy_info->max_depth < 0 || cpy_info->curr_depth < cpy_info->max_depth); /* Copy the link (and the object it points to) */ - if(H5G_link_copy_file(dst_oloc->file, dxpl_id, link_src, src_oloc, link_dst, + if(H5L_link_copy_file(dst_oloc->file, dxpl_id, link_src, src_oloc, link_dst, cpy_info) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy link") diff --git a/src/H5Ostab.c b/src/H5Ostab.c index 6499561..42cd92c 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -283,7 +283,7 @@ H5O_stab_delete(H5F_t *f, hid_t dxpl_id, H5O_t UNUSED *open_oh, void *mesg) HDassert(mesg); /* Free the file space for the symbol table */ - if(H5G_stab_delete(f, dxpl_id, (const H5O_stab_t *)mesg) < 0) + if(H5G__stab_delete(f, dxpl_id, (const H5O_stab_t *)mesg) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free symbol table") done: @@ -334,7 +334,7 @@ H5O_stab_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst, H5_BEGIN_TAG(dxpl_id, H5AC__COPIED_TAG, NULL); /* Create components of symbol table message */ - if(H5G_stab_create_components(file_dst, stab_dst, size_hint, dxpl_id) < 0) + if(H5G__stab_create_components(file_dst, stab_dst, size_hint, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "can't create symbol table components") /* Reset metadata tag */ @@ -399,7 +399,7 @@ H5O_stab_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc udata.cpy_info = cpy_info; /* Iterate over objects in group, copying them */ - if((H5B_iterate(src_oloc->file, dxpl_id, H5B_SNODE, stab_src->btree_addr, H5G_node_copy, &udata)) < 0) + if((H5B_iterate(src_oloc->file, dxpl_id, H5B_SNODE, stab_src->btree_addr, H5G__node_copy, &udata)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed") done: diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 9197708..a49d66e 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -159,7 +159,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list") /* Commit the type */ - if(H5T_commit_named(&loc, name, type, lcpl_id, tcpl_id, tapl_id, H5AC_dxpl_id) < 0) + if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id, tapl_id, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") done: @@ -168,7 +168,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5T_commit_named + * Function: H5T__commit_named * * Purpose: Internal routine to save a transient datatype to a file and * turn the type ID into a "named", immutable type. @@ -181,7 +181,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt, +H5T__commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id) { H5O_obj_create_t ocrt_info; /* Information for object creation */ @@ -189,7 +189,7 @@ H5T_commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt, H5T_state_t old_state = H5T_STATE_TRANSIENT; /* The state of the datatype before H5T_commit. */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(loc); @@ -246,7 +246,7 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5T_commit_named() */ +} /* end H5T__commit_named() */ /*------------------------------------------------------------------------- diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index dc8172e..32080fe 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -141,7 +141,7 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Commit the datatype to the file, using default property list values */ - if(H5T_commit_named(&loc, name, type, H5P_LINK_CREATE_DEFAULT, + if(H5T__commit_named(&loc, name, type, H5P_LINK_CREATE_DEFAULT, H5P_DATATYPE_CREATE_DEFAULT, H5P_DATATYPE_ACCESS_DEFAULT, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 0ec9632..f25fb1e 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -513,7 +513,7 @@ H5FL_EXTERN(H5T_shared_t); /* Common functions */ H5_DLL H5T_t *H5T_create(H5T_class_t type, size_t size); H5_DLL herr_t H5T_commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id); -H5_DLL herr_t H5T_commit_named(const H5G_loc_t *loc, const char *name, +H5_DLL herr_t H5T__commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id); H5_DLL H5T_t *H5T_alloc(void); H5_DLL herr_t H5T_free(H5T_t *dt); diff --git a/src/H5private.h b/src/H5private.h index 539b39d..e01edd2 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1891,6 +1891,30 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); FUNC_ENTER_NOAPI_INIT(err) \ { +/* Use this macro for all "normal" package-level functions */ +#define FUNC_ENTER_PACKAGE { \ + FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ + H5_PUSH_FUNC \ + { + +/* Use this macro for package-level functions which propgate errors, but don't issue them */ +#define FUNC_ENTER_PACKAGE_NOERR { \ + FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \ + H5_PUSH_FUNC \ + { + +/* Use the following macro as replacement for the FUNC_ENTER_PACKAGE + * macro when the function needs to set up a metadata tag. */ +#define FUNC_ENTER_PACKAGE_TAG(dxpl_id, tag, err) { \ + haddr_t prev_tag = HADDR_UNDEF; \ + hid_t tag_dxpl_id = dxpl_id; \ + \ + FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ + if(H5AC_tag(tag_dxpl_id, tag, &prev_tag) < 0) \ + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ + H5_PUSH_FUNC \ + { + /* Use this macro for all non-API functions, which propagate errors, but don't issue them */ #define FUNC_ENTER_NOAPI_NOERR { \ FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ diff --git a/test/getname.c b/test/getname.c index cb7ea41..fbad220 100644 --- a/test/getname.c +++ b/test/getname.c @@ -72,7 +72,7 @@ check_name(hid_t id, const char *chk_name, const char *chk_user_path) /* Get user path */ *user_path = '\0'; - if(H5G_user_path_test(id, user_path, &user_path_len, &user_path_hidden) < 0) TEST_ERROR + if(H5G__user_path_test(id, user_path, &user_path_len, &user_path_hidden) < 0) TEST_ERROR /* Check on name from H5Iget_name() */ if(HDstrcmp(name, chk_name)) goto error; diff --git a/test/h5test.c b/test/h5test.c index e5e798e..7faba81 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1173,7 +1173,7 @@ h5_verify_cached_stabs_cb(hid_t oid, const char UNUSED *name, const H5O_info_t *oinfo, void UNUSED *udata) { if(oinfo->type == H5O_TYPE_GROUP) - return(H5G_verify_cached_stabs_test(oid)); + return(H5G__verify_cached_stabs_test(oid)); else return(0); } /* end h5_verify_cached_stabs_cb() */ diff --git a/test/links.c b/test/links.c index fdb1bdb..966802a 100644 --- a/test/links.c +++ b/test/links.c @@ -5452,7 +5452,7 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check on root group's status */ - if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR /* Query the group creation properties */ if((gcpl = H5Gget_create_plist(gid)) < 0) TEST_ERROR @@ -5463,10 +5463,10 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) if(H5Lcreate_external(filename2, "/dst", gid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Check on root group's status */ - if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G_has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR if(nmsgs != 1) TEST_ERROR - if(H5G_has_stab_test(gid) == TRUE) TEST_ERROR + if(H5G__has_stab_test(gid) == TRUE) TEST_ERROR /* Create enough objects in the root group to change it into a "dense" group */ for(u = 0; u < max_compact; u++) { @@ -5476,9 +5476,9 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) } /* end for */ /* Check on root group's status */ - if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR /* Close group creation property list */ if(H5Pclose(gcpl) < 0) TEST_ERROR @@ -5518,11 +5518,11 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) } /* end for */ /* Check on root group's status */ - if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G_has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR if(nmsgs != (min_dense - 1)) TEST_ERROR - if(H5G_is_new_dense_test(gid) == TRUE) TEST_ERROR - if(H5G_has_stab_test(gid) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(gid) == TRUE) TEST_ERROR + if(H5G__has_stab_test(gid) == TRUE) TEST_ERROR /* Close root group */ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR @@ -5790,7 +5790,7 @@ external_link_ride(hid_t fapl, hbool_t new_format) if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check on root group's status */ - if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR /* Query the group creation properties */ if((gcpl = H5Gget_create_plist(gid)) < 0) TEST_ERROR @@ -5804,13 +5804,13 @@ external_link_ride(hid_t fapl, hbool_t new_format) } /* end for */ /* Check on root group's status */ - if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR if(new_format) { - if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR + if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR } /* end if */ else { - if(H5G_has_stab_test(gid) != TRUE) TEST_ERROR + if(H5G__has_stab_test(gid) != TRUE) TEST_ERROR } /* end else */ /* Create external link */ @@ -5818,9 +5818,9 @@ external_link_ride(hid_t fapl, hbool_t new_format) if(H5Lcreate_external(filename2, "/dst", gid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Check on root group's status */ - if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR /* Close group creation property list */ if(H5Pclose(gcpl) < 0) TEST_ERROR @@ -5872,11 +5872,11 @@ external_link_ride(hid_t fapl, hbool_t new_format) } /* end for */ /* Check on root group's status */ - if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G_has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR if(nmsgs != (min_dense - 1)) TEST_ERROR - if(H5G_has_stab_test(gid) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(gid) == TRUE) TEST_ERROR + if(H5G__has_stab_test(gid) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(gid) == TRUE) TEST_ERROR /* Close root group */ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR @@ -10189,7 +10189,7 @@ corder_create_empty(hid_t fapl) if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR /* Check on group's status */ - if(H5G_is_empty_test(group_id) != TRUE) TEST_ERROR + if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR /* Close the group */ if(H5Gclose(group_id) < 0) TEST_ERROR @@ -10208,7 +10208,7 @@ corder_create_empty(hid_t fapl) if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check on group's status */ - if(H5G_is_empty_test(group_id) != TRUE) TEST_ERROR + if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR /* Retrieve group creation property list for group */ if((gcpl_id = H5Gget_create_plist(group_id)) < 0) TEST_ERROR @@ -10282,9 +10282,9 @@ corder_create_compact(hid_t fapl) if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR /* Check on group's initial status */ - if(H5G_is_empty_test(group_id) != TRUE) TEST_ERROR - if(H5G_has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR /* Query the group creation properties */ if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR @@ -10296,10 +10296,10 @@ corder_create_compact(hid_t fapl) if(H5Gclose(group_id2) < 0) TEST_ERROR /* Verify state of group */ - if(H5G_has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR if(nlinks != (u + 1)) TEST_ERROR - if(H5G_has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(group_id) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR } /* end for */ /* Close the group */ @@ -10319,10 +10319,10 @@ corder_create_compact(hid_t fapl) if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify state of group */ - if(H5G_has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR if(nlinks != max_compact) TEST_ERROR - if(H5G_has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(group_id) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR /* Loop through links, checking their creation order values */ /* (the name index is used, but the creation order value is in the same order) */ @@ -10402,9 +10402,9 @@ corder_create_dense(hid_t fapl) if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR /* Check on group's initial status */ - if(H5G_is_empty_test(group_id) != TRUE) TEST_ERROR - if(H5G_has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR /* Query the group creation properties */ if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR @@ -10416,10 +10416,10 @@ corder_create_dense(hid_t fapl) if(H5Gclose(group_id2) < 0) TEST_ERROR /* Verify state of group */ - if(H5G_has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR if(nlinks != (u + 1)) TEST_ERROR - if(H5G_has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(group_id) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR } /* end for */ /* Create another link, to push group into dense form */ @@ -10428,12 +10428,12 @@ corder_create_dense(hid_t fapl) if(H5Gclose(group_id2) < 0) TEST_ERROR /* Verify state of group */ - if(H5G_has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G_has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G_new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR if(name_count != corder_count) TEST_ERROR /* Close the group */ @@ -10453,9 +10453,9 @@ corder_create_dense(hid_t fapl) if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify state of group */ - if(H5G_has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G_has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR /* Loop through links, checking their creation order values */ /* (the name index is used, but the creation order value is in the same order) */ @@ -10576,12 +10576,12 @@ corder_transition(hid_t fapl) if(H5Gclose(group_id2) < 0) TEST_ERROR /* Verify state of group */ - if(H5G_has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G_has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G_new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR if(name_count != corder_count) TEST_ERROR /* Delete several links from group, until it resumes compact form */ @@ -10590,12 +10590,12 @@ corder_transition(hid_t fapl) if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR /* Verify state of group */ - if(H5G_has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G_has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G_new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR if(name_count != corder_count) TEST_ERROR } /* end for */ @@ -10604,10 +10604,10 @@ corder_transition(hid_t fapl) if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR /* Verify state of group */ - if(H5G_has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR if(nlinks != (min_dense - 1)) TEST_ERROR - if(H5G_has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(group_id) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR /* Re-add links to get back into dense form */ for(u = (min_dense - 1); u < (max_compact + 1); u++) { @@ -10617,12 +10617,12 @@ corder_transition(hid_t fapl) } /* end for */ /* Verify state of group */ - if(H5G_has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G_has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G_new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR if(name_count != corder_count) TEST_ERROR /* Close the group */ @@ -10639,12 +10639,12 @@ corder_transition(hid_t fapl) if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify state of group */ - if(H5G_has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G_has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G_new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR if(name_count != corder_count) TEST_ERROR /* Delete several links from group, until it resumes compact form */ @@ -10653,12 +10653,12 @@ corder_transition(hid_t fapl) if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR /* Verify state of group */ - if(H5G_has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G_has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G_new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR if(name_count != corder_count) TEST_ERROR } /* end for */ @@ -10667,10 +10667,10 @@ corder_transition(hid_t fapl) if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR /* Verify state of group */ - if(H5G_has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR if(nlinks != (min_dense - 1)) TEST_ERROR - if(H5G_has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(group_id) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR /* Re-add links to get back into dense form */ for(u = (min_dense - 1); u < (max_compact + 1); u++) { @@ -10680,12 +10680,12 @@ corder_transition(hid_t fapl) } /* end for */ /* Verify state of group */ - if(H5G_has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G_has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G_new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR if(name_count != corder_count) TEST_ERROR /* Delete all the links */ @@ -10797,12 +10797,12 @@ corder_delete(hid_t fapl) } /* end for */ /* Verify state of group */ - if(H5G_has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G_has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G_new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR if(name_count != corder_count) TEST_ERROR /* Close the group */ @@ -11106,7 +11106,7 @@ link_info_by_idx(hid_t fapl) } /* end for */ /* Verify state of group */ - if(H5G_has_links_test(group_id, NULL) != TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR /* Check for out of bound offset queries */ H5E_BEGIN_TRY { @@ -11144,7 +11144,7 @@ link_info_by_idx(hid_t fapl) } /* end else */ /* Verify state of group */ - if(H5G_is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR /* Verify link information for new link */ if(link_info_by_idx_check(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR @@ -11333,7 +11333,7 @@ link_info_by_idx_old(hid_t fapl) if(ret >= 0) TEST_ERROR /* Verify state of group */ - if(H5G_has_stab_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR /* Close the group */ if(H5Gclose(group_id) < 0) TEST_ERROR @@ -11465,7 +11465,7 @@ delete_by_idx(hid_t fapl) } /* end for */ /* Verify state of group (compact) */ - if(H5G_has_links_test(group_id, NULL) != TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR /* Check for out of bound deletion */ H5E_BEGIN_TRY { @@ -11502,7 +11502,7 @@ delete_by_idx(hid_t fapl) if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR /* Verify state of group (empty) */ - if(H5G_has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR /* Create more links, to push group into dense form */ for(u = 0; u < (max_compact * 2); u++) { @@ -11517,7 +11517,7 @@ delete_by_idx(hid_t fapl) /* Verify state of group (dense) */ if(u >= max_compact) - if(H5G_is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR /* Verify link information for new link */ if(link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR @@ -11558,8 +11558,8 @@ delete_by_idx(hid_t fapl) if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR /* Verify state of group (empty) */ - if(H5G_has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(group_id) == TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR /* Check for deletion on empty group again */ H5E_BEGIN_TRY { @@ -11584,7 +11584,7 @@ delete_by_idx(hid_t fapl) /* Verify state of group (dense) */ if(u >= max_compact) - if(H5G_is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR /* Verify link information for new link */ if(link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR @@ -11644,8 +11644,8 @@ delete_by_idx(hid_t fapl) if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR /* Verify state of group (empty) */ - if(H5G_has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(group_id) == TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR @@ -11795,7 +11795,7 @@ delete_by_idx_old(hid_t fapl) if(ret >= 0) TEST_ERROR /* Verify state of group */ - if(H5G_has_stab_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR /* Delete links in middle */ @@ -11877,7 +11877,7 @@ delete_by_idx_old(hid_t fapl) if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR /* Verify state of group */ - if(H5G_has_stab_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR /* Close the group */ if(H5Gclose(group_id) < 0) TEST_ERROR @@ -12304,7 +12304,7 @@ link_iterate(hid_t fapl) } /* end for */ /* Verify state of group (compact) */ - if(H5G_has_links_test(group_id, NULL) != TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR /* Check for out of bound iteration on compact group */ skip = (hsize_t)u; @@ -12330,7 +12330,7 @@ link_iterate(hid_t fapl) } /* end for */ /* Verify state of group (dense) */ - if(H5G_is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR /* Check for out of bound iteration on dense group */ skip = (hsize_t)u; @@ -12717,7 +12717,7 @@ link_iterate_old(hid_t fapl) } /* end for */ /* Verify state of group (symbol table) */ - if(H5G_has_stab_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR /* Check for out of bound iteration on old-style group */ skip = (hsize_t)u; @@ -13008,7 +13008,7 @@ open_by_idx(hid_t fapl) } /* end for */ /* Verify state of group (compact) */ - if(H5G_has_links_test(group_id, NULL) != TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR /* Check for out of bound open by index on compact group */ H5E_BEGIN_TRY { @@ -13043,7 +13043,7 @@ open_by_idx(hid_t fapl) } /* end for */ /* Verify state of group (dense) */ - if(H5G_is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR /* Check for out of bound open by index on compact group */ H5E_BEGIN_TRY { @@ -13185,7 +13185,7 @@ open_by_idx_old(hid_t fapl) } /* end for */ /* Verify state of group (symbol table) */ - if(H5G_has_stab_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR /* Check for out of bound open by index */ H5E_BEGIN_TRY { @@ -13456,7 +13456,7 @@ object_info(hid_t fapl) } /* end for */ /* Verify state of group (compact) */ - if(H5G_has_links_test(group_id, NULL) != TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR /* Check for out of bound query by index */ H5E_BEGIN_TRY { @@ -13504,7 +13504,7 @@ object_info(hid_t fapl) } /* end for */ /* Verify state of group (dense) */ - if(H5G_is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR /* Check for out of bound query by index */ H5E_BEGIN_TRY { @@ -13653,7 +13653,7 @@ object_info_old(hid_t fapl) } /* end for */ /* Verify state of group (symbol table) */ - if(H5G_has_stab_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR /* Check for out of bound query by index */ H5E_BEGIN_TRY { @@ -13941,7 +13941,7 @@ group_info(hid_t fapl) } /* end for */ /* Verify state of group (compact) */ - if(H5G_has_links_test(group_id, NULL) != TRUE) TEST_ERROR + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR /* Check for out of bound query by index */ H5E_BEGIN_TRY { @@ -14082,7 +14082,7 @@ group_info(hid_t fapl) } /* end for */ /* Verify state of group (dense) */ - if(H5G_is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR /* Check for out of bound query by index */ H5E_BEGIN_TRY { @@ -14312,7 +14312,7 @@ group_info_old(hid_t fapl) } /* end for */ /* Verify state of group (old-style) */ - if(H5G_has_stab_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR /* Check for out of bound query by index */ H5E_BEGIN_TRY { diff --git a/test/stab.c b/test/stab.c index b460d90..a42ee5e 100644 --- a/test/stab.c +++ b/test/stab.c @@ -277,14 +277,14 @@ test_large(hid_t fapl, hbool_t new_format) */ if((cwg = H5Gcreate2(fid, "/big", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(new_format) - if(H5G_has_stab_test(cwg) != FALSE) TEST_ERROR + if(H5G__has_stab_test(cwg) != FALSE) TEST_ERROR for(i = 0; i < LARGE_NOBJS; i++) { sprintf(name, "%05d%05d", (HDrandom() % 100000), i); if((dir = H5Gcreate2(cwg, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(dir) < 0) TEST_ERROR } if(new_format) - if(H5G_is_new_dense_test(cwg) != TRUE) TEST_ERROR + if(H5G__is_new_dense_test(cwg) != TRUE) TEST_ERROR if(H5Gclose(cwg) < 0) TEST_ERROR /* Close file */ @@ -386,21 +386,21 @@ lifecycle(hid_t fapl2) if(est_name_len != LIFECYCLE_EST_NAME_LEN) TEST_ERROR /* Use internal testing routine to check that the group has no links or symbol table */ - if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR /* Create first "bottom" group */ sprintf(objname, LIFECYCLE_BOTTOM_GROUP, (unsigned)0); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Check on bottom group's status */ - if(H5G_is_empty_test(gid2) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid2) != TRUE) TEST_ERROR /* Close bottom group */ if(H5Gclose(gid2) < 0) TEST_ERROR /* Check on top group's status */ - if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G_has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR if(nmsgs != 1) TEST_ERROR /* Create several more bottom groups, to push the top group almost to a symbol table */ @@ -410,17 +410,17 @@ lifecycle(hid_t fapl2) if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Check on bottom group's status */ - if(H5G_is_empty_test(gid2) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid2) != TRUE) TEST_ERROR /* Close bottom group */ if(H5Gclose(gid2) < 0) TEST_ERROR } /* end for */ /* Check on top group's status */ - if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G_has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR if(nmsgs != LIFECYCLE_MAX_COMPACT) TEST_ERROR - if(H5G_is_new_dense_test(gid) != FALSE) TEST_ERROR + if(H5G__is_new_dense_test(gid) != FALSE) TEST_ERROR /* Check that the object header is only one chunk and the space has been allocated correctly */ if(H5Oget_info(gid, &oinfo) < 0) TEST_ERROR @@ -434,15 +434,15 @@ lifecycle(hid_t fapl2) if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Check on bottom group's status */ - if(H5G_is_empty_test(gid2) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid2) != TRUE) TEST_ERROR /* Close bottom group */ if(H5Gclose(gid2) < 0) TEST_ERROR /* Check on top group's status */ - if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR /* Check that the object header is still one chunk and the space has been allocated correctly */ if(H5Oget_info(gid, &oinfo) < 0) TEST_ERROR @@ -461,9 +461,9 @@ lifecycle(hid_t fapl2) } /* end while */ /* Check on top group's status */ - if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR /* Unlink one more object from the group, which should transform back to using links */ sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); @@ -471,8 +471,8 @@ lifecycle(hid_t fapl2) u--; /* Check on top group's status */ - if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G_has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR if(nmsgs != (LIFECYCLE_MIN_DENSE - 1)) TEST_ERROR /* Unlink last two objects from top group */ @@ -483,7 +483,7 @@ lifecycle(hid_t fapl2) if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check on top group's status */ - if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR /* Close top group */ if(H5Gclose(gid) < 0) TEST_ERROR @@ -568,47 +568,47 @@ long_compact(hid_t fapl2) if((gid = H5Gcreate2(fid, "top", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Use internal testing routine to check that the group has no links or dense storage */ - if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR /* Create first group with "long" name */ if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Check on bottom group's status */ - if(H5G_is_empty_test(gid2) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid2) != TRUE) TEST_ERROR /* Close bottom group */ if(H5Gclose(gid2) < 0) TEST_ERROR /* Check on top group's status */ /* (Should have dense storage to hold links, since name is too long for object header message) */ - if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR /* Create second group with "long" name */ objname[0] = 'b'; if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Check on bottom group's status */ - if(H5G_is_empty_test(gid2) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid2) != TRUE) TEST_ERROR /* Close bottom group */ if(H5Gclose(gid2) < 0) TEST_ERROR /* Check on top group's status */ /* (Should have dense storage to hold links, since name is too long for object header message) */ - if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR /* Unlink second object from top group */ if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check on top group's status */ /* (Should still be dense storage to hold links, since name is too long for object header message) */ - if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR /* Unlink first object from top group */ objname[0] = 'a'; @@ -616,7 +616,7 @@ long_compact(hid_t fapl2) /* Check on top group's status */ /* (Should have deleted the dense storage now) */ - if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR /* Free object name */ HDfree(objname); @@ -684,9 +684,9 @@ read_old(void) if((gid = H5Gopen2(fid, "old", H5P_DEFAULT)) < 0) TEST_ERROR /* Check on old group's status */ - if(H5G_is_empty_test(gid) == FALSE) TEST_ERROR - if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR - if(H5G_has_stab_test(gid) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) == FALSE) TEST_ERROR + if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(gid) != TRUE) TEST_ERROR /* Create a bunch of objects in the group */ for(u = 0; u < READ_OLD_NGROUPS; u++) { @@ -694,7 +694,7 @@ read_old(void) if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Check on bottom group's status */ - if(H5G_is_empty_test(gid2) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid2) != TRUE) TEST_ERROR /* Close bottom group */ if(H5Gclose(gid2) < 0) TEST_ERROR @@ -702,9 +702,9 @@ read_old(void) /* Check on old group's status */ /* (Should stay in old "symbol table" form) */ - if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR - if(H5G_has_stab_test(gid) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(gid) != TRUE) TEST_ERROR /* Delete new objects from old group */ for(u = 0; u < READ_OLD_NGROUPS; u++) { @@ -714,9 +714,9 @@ read_old(void) /* Check on old group's status */ /* (Should stay in old "symbol table" form, but have no links) */ - if(H5G_is_empty_test(gid) == FALSE) TEST_ERROR - if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR - if(H5G_has_stab_test(gid) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) == FALSE) TEST_ERROR + if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(gid) != TRUE) TEST_ERROR /* Close old group */ if(H5Gclose(gid) < 0) TEST_ERROR @@ -798,29 +798,29 @@ no_compact(hid_t fapl2) if(H5Pclose(gcpl) < 0) TEST_ERROR /* Use internal testing routine to check that the group has no links or dense storage */ - if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR /* Create first "bottom" group */ sprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Check on bottom group's status */ - if(H5G_is_empty_test(gid2) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid2) != TRUE) TEST_ERROR /* Close bottom group */ if(H5Gclose(gid2) < 0) TEST_ERROR /* Check on top group's status */ - if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR /* Unlink object from top group */ sprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0); if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check on top group's status */ - if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR /* Close top group */ if(H5Gclose(gid) < 0) TEST_ERROR diff --git a/test/unlink.c b/test/unlink.c index 604b014..993a7ec 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -2221,9 +2221,9 @@ test_full_group_compact(hid_t fapl) } /* end for */ /* Check on group's status */ - if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G_has_links_test(gid, NULL) != TRUE) TEST_ERROR - if(H5G_has_stab_test(gid) == TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, NULL) != TRUE) TEST_ERROR + if(H5G__has_stab_test(gid) == TRUE) TEST_ERROR /* Close group with objects to delete */ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR @@ -2367,9 +2367,9 @@ test_full_group_dense(hid_t fapl) } /* end for */ /* Check on group's status */ - if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR - if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR /* Close group with objects to delete */ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR -- cgit v0.12