summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MANIFEST1
-rw-r--r--src/H5D.c2
-rw-r--r--src/H5Fmount.c4
-rw-r--r--src/H5G.c158
-rw-r--r--src/H5Gent.c162
-rw-r--r--src/H5Gnode.c218
-rw-r--r--src/H5Gpkg.h88
-rw-r--r--src/H5Gprivate.h15
-rw-r--r--src/H5Gpublic.h4
-rw-r--r--src/H5Gstab.c241
-rw-r--r--src/H5Oprivate.h12
-rw-r--r--src/H5Ostab.c7
-rw-r--r--src/H5Pgcpl.c106
-rw-r--r--src/H5Ppublic.h3
-rw-r--r--src/H5T.c2
-rwxr-xr-xsrc/Makefile.am3
-rw-r--r--src/Makefile.in5
-rw-r--r--test/tmisc.c10
18 files changed, 625 insertions, 416 deletions
diff --git a/MANIFEST b/MANIFEST
index c68770b..00b09cf 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -528,6 +528,7 @@ a------------------------------------------------------------------------------
./src/H5Pdxpl.c
./src/H5Pfapl.c
./src/H5Pfcpl.c
+./src/H5Pgcpl.c
./src/H5Pocpl.c
./src/H5Ppkg.h
./src/H5Pprivate.h
diff --git a/src/H5D.c b/src/H5D.c
index ee8660e..1063499 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -1250,7 +1250,7 @@ H5Dopen(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
/* Find the dataset object */
- if (H5G_find(loc, name, NULL, &ent, dxpl_id) < 0)
+ if (H5G_find(loc, name, &ent, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found")
ent_found = TRUE;
diff --git a/src/H5Fmount.c b/src/H5Fmount.c
index 0bff83b..c876b15 100644
--- a/src/H5Fmount.c
+++ b/src/H5Fmount.c
@@ -147,7 +147,7 @@ H5F_mount(H5G_entry_t *loc, const char *name, H5F_t *child,
*/
if (child->mtab.parent)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "file is already mounted")
- if (H5G_find(loc, name, NULL, &mp_open_ent/*out*/, H5AC_dxpl_id) < 0)
+ if (H5G_find(loc, name, &mp_open_ent/*out*/, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found")
if (NULL==(mount_point=H5G_open(&mp_open_ent, dxpl_id)))
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point not found")
@@ -276,7 +276,7 @@ H5F_unmount(H5G_entry_t *loc, const char *name, hid_t dxpl_id)
* If we get the root group and the file has a parent in the mount tree,
* then we must have found the mount point.
*/
- if (H5G_find(loc, name, NULL, &mnt_open_ent/*out*/, H5AC_dxpl_id) < 0)
+ if (H5G_find(loc, name, &mnt_open_ent/*out*/, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found")
if (NULL==(mounted=H5G_open(&mnt_open_ent, dxpl_id)))
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point not found")
diff --git a/src/H5G.c b/src/H5G.c
index 92575e2..67ccf3c 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -85,8 +85,8 @@
*-------------------------------------------------------------------------
*/
-#define H5G_PACKAGE /*suppress error message about including H5Gpkg.h */
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
+#define H5G_PACKAGE /*suppress error about including H5Gpkg */
+#define H5F_PACKAGE /*suppress error about including H5Fpkg */
/* Interface initialization */
#define H5_INTERFACE_INIT_FUNC H5G_init_interface
@@ -95,7 +95,6 @@
/* Packages needed by this file... */
#include "H5private.h" /* Generic Functions */
#include "H5Aprivate.h" /* Attributes */
-#include "H5Bprivate.h" /* B-link trees */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
@@ -176,8 +175,8 @@ static herr_t H5G_namei(const H5G_entry_t *loc_ent, const char *name,
H5G_entry_t *ent, hid_t dxpl_id);
static herr_t H5G_traverse_slink(H5G_entry_t *grp_ent/*in,out*/,
H5G_entry_t *obj_ent/*in,out*/, int *nlinks/*in,out*/, hid_t dxpl_id);
-static H5G_t *H5G_create(H5G_entry_t *loc, const char *name, size_t size_hint,
- hid_t dxpl_id, hid_t gcpl_id, hid_t gapl_id);
+static H5G_t *H5G_create(H5G_entry_t *loc, const char *name, hid_t dxpl_id,
+ hid_t gcpl_id, hid_t gapl_id);
static htri_t H5G_isa(H5G_entry_t *ent, hid_t dxpl_id);
static htri_t H5G_link_isa(H5G_entry_t *ent, hid_t dxpl_id);
static H5G_t * H5G_open_oid(H5G_entry_t *ent, hid_t dxpl_id);
@@ -237,6 +236,7 @@ H5Gcreate(hid_t loc_id, const char *name, size_t size_hint)
{
H5G_entry_t *loc = NULL;
H5G_t *grp = NULL;
+ hid_t tmp_gcpl = (-1); /* Temporary group creation property list */
hid_t ret_value;
FUNC_ENTER_API(H5Gcreate, FAIL);
@@ -248,15 +248,47 @@ H5Gcreate(hid_t loc_id, const char *name, size_t size_hint)
if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given");
+ /* Check if we need to create a non-standard GCPL */
+ if(size_hint > 0) {
+ H5P_genplist_t *gc_plist; /* Property list created */
+ H5O_ginfo_t ginfo; /* Group info property */
+
+ /* Get the default property list */
+ if(NULL == (gc_plist = H5I_object(H5P_GROUP_CREATE_DEFAULT)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+
+ /* Make a copy of the default property list */
+ if((tmp_gcpl = H5P_copy_plist(gc_plist)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to copy the creation property list")
+
+ /* Get the copy of the property list */
+ if(NULL == (gc_plist = H5I_object(H5P_GROUP_CREATE_DEFAULT)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+
+ /* Get the group info property */
+ if(H5P_get(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info")
+
+ /* Set the non-default local heap size hint */
+ ginfo.lheap_size_hint = size_hint;
+ if(H5P_set(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set group info")
+ } /* end if */
+ else
+ tmp_gcpl = H5P_GROUP_CREATE_DEFAULT;
+
/* Create the group */
- if (NULL == (grp = H5G_create(loc, name, size_hint, H5AC_dxpl_id,
- H5P_GROUP_CREATE_DEFAULT, H5P_DEFAULT)))
+ if (NULL == (grp = H5G_create(loc, name, H5AC_dxpl_id, tmp_gcpl, H5P_DEFAULT)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group");
if ((ret_value = H5I_register(H5I_GROUP, grp)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group");
done:
- if(ret_value<0) {
+ if(tmp_gcpl > 0 && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT)
+ if(H5I_dec_ref(tmp_gcpl) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release property list")
+
+ if(ret_value < 0) {
if(grp!=NULL)
H5G_close(grp);
} /* end if */
@@ -295,7 +327,7 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5Gcreate_expand(hid_t loc_id, const char *name, size_t size_hint, hid_t gcpl_id, hid_t gapl_id)
+H5Gcreate_expand(hid_t loc_id, const char *name, hid_t gcpl_id, hid_t gapl_id)
{
H5G_entry_t *loc = NULL;
H5G_t *grp = NULL;
@@ -325,7 +357,7 @@ H5Gcreate_expand(hid_t loc_id, const char *name, size_t size_hint, hid_t gcpl_id
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list")
#endif /* LATER */
- if (NULL == (grp = H5G_create(loc, name, size_hint, H5AC_dxpl_id, gcpl_id, gapl_id)))
+ if (NULL == (grp = H5G_create(loc, name, H5AC_dxpl_id, gcpl_id, gapl_id)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group")
if ((ret_value = H5I_register(H5I_GROUP, grp)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
@@ -377,7 +409,7 @@ H5Gopen(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name");
/* Open the parent group, making sure it's a group */
- if (H5G_find(loc, name, NULL, &ent/*out*/, H5AC_dxpl_id) < 0)
+ if (H5G_find(loc, name, &ent/*out*/, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found");
/* Open the group */
@@ -468,9 +500,9 @@ herr_t
H5Giterate(hid_t loc_id, const char *name, int *idx_p,
H5G_iterate_t op, void *op_data)
{
- H5O_stab_t stab_mesg; /*info about B-tree */
+ H5O_stab_t stab; /*info about B-tree */
int idx;
- H5G_bt_ud2_t udata;
+ H5G_bt_it_ud1_t udata;
H5G_t *grp = NULL;
herr_t ret_value;
@@ -500,12 +532,12 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p,
}
/* Get the B-tree info */
- if (NULL==H5O_read (&(grp->ent), H5O_STAB_ID, 0, &stab_mesg, H5AC_dxpl_id))
+ if (NULL==H5O_read (&(grp->ent), H5O_STAB_ID, 0, &stab, H5AC_dxpl_id))
HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address")
/* Build udata to pass through H5B_iterate() to H5G_node_iterate() */
udata.skip = idx;
- udata.stab = &stab_mesg;
+ udata.heap_addr = stab.heap_addr;
udata.op = op;
udata.op_data = op_data;
@@ -514,15 +546,15 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p,
/* Iterate over the group members */
if ((ret_value = H5B_iterate (H5G_fileof(grp), H5AC_dxpl_id, H5B_SNODE,
- H5G_node_iterate, stab_mesg.btree_addr, &udata))<0)
+ H5G_node_iterate, stab.btree_addr, &udata))<0)
HERROR (H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
H5I_dec_ref (udata.group_id); /*also closes 'grp'*/
/* Check for too high of a starting index (ex post facto :-) */
/* (Skipping exactly as many entries as are in the group is currently an error) */
- if (idx>0 && idx>=udata.final_ent)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified");
+ if(idx>0 && idx>=udata.final_ent)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified");
/* Set the index we stopped at */
*idx_p=udata.final_ent;
@@ -1029,8 +1061,14 @@ done:
static herr_t
H5G_init_interface(void)
{
- herr_t ret_value=SUCCEED; /* Return value */
+ /* Group creation property class variables. In sequence, they are,
+ * - Creation property list class to modify
+ * - Default value for "group info"
+ */
H5P_genclass_t *crt_pclass;
+ H5O_ginfo_t ginfo = H5G_CRT_GROUP_INFO_DEF;
+ size_t nprops; /* Number of properties */
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5G_init_interface);
@@ -1056,8 +1094,17 @@ H5G_init_interface(void)
if(NULL == (crt_pclass = H5I_object(H5P_CLS_GROUP_CREATE_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
- /* Put group creation property insertion code here when it's needed. */
- /* (See example in H5D_init_interface() ) */
+ /* Get the number of properties in the class */
+ if(H5P_get_nprops_pclass(crt_pclass, &nprops, FALSE)<0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties")
+
+ /* Assume that if there are properties in the class, they are the default ones */
+ if(nprops==0) {
+ /* Register group info */
+ if(H5P_register(crt_pclass,H5G_CRT_GROUP_INFO_NAME,H5G_CRT_GROUP_INFO_SIZE,
+ &ginfo,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ } /* end if */
/* Only register the default property list if it hasn't been created yet */
if(H5P_LST_GROUP_CREATE_g==(-1)) {
@@ -1781,8 +1828,7 @@ herr_t
H5G_mkroot (H5F_t *f, hid_t dxpl_id, H5G_entry_t *ent)
{
H5G_entry_t new_root; /*new root object */
- H5O_stab_t stab; /*symbol table message */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_mkroot, FAIL);
@@ -1796,8 +1842,8 @@ H5G_mkroot (H5F_t *f, hid_t dxpl_id, H5G_entry_t *ent)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group node info")
/*
- * If there is no root object then create one. The root group always has
- * a hard link count of one since it's pointed to by the boot block.
+ * If there is no root object then create one. The root group always starts
+ * with a hard link count of one since it's pointed to by the boot block.
*/
if (!ent) {
ent = &new_root;
@@ -1812,11 +1858,6 @@ H5G_mkroot (H5F_t *f, hid_t dxpl_id, H5G_entry_t *ent)
*/
if (H5O_open (ent)<0)
HGOTO_ERROR (H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open root group");
- if (NULL==H5O_read (ent, H5O_STAB_ID, 0, &stab, dxpl_id)) {
- H5O_close(ent);
- HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "root object is not a group");
- }
- H5O_reset (H5O_STAB_ID, &stab);
}
/* Create the path names for the root group's entry */
@@ -1876,7 +1917,7 @@ done:
*-------------------------------------------------------------------------
*/
static H5G_t *
-H5G_create(H5G_entry_t *loc, const char *name, size_t size_hint,
+H5G_create(H5G_entry_t *loc, const char *name,
hid_t dxpl_id, hid_t gcpl_id, hid_t UNUSED gapl_id)
{
H5G_t *grp = NULL; /*new group */
@@ -1906,7 +1947,7 @@ H5G_create(H5G_entry_t *loc, const char *name, size_t size_hint,
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to locate insertion point");
/* Create the group entry */
- if (H5G_stab_create(file, dxpl_id, size_hint, &(grp->ent)/*out*/) < 0)
+ if (H5G_stab_create(file, dxpl_id, (size_t)H5G_SIZE_HINT, &(grp->ent)/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "can't create grp");
stab_init=1; /* Indicate that the symbol table information is valid */
@@ -2123,7 +2164,7 @@ H5G_open_oid(H5G_entry_t *ent, hid_t dxpl_id)
{
H5G_t *grp = NULL;
H5G_t *ret_value = NULL;
- H5O_stab_t mesg;
+ hbool_t ent_opened = FALSE;
FUNC_ENTER_NOAPI_NOINIT(H5G_open_oid);
@@ -2141,21 +2182,26 @@ H5G_open_oid(H5G_entry_t *ent, hid_t dxpl_id)
/* Grab the object header */
if (H5O_open(&(grp->ent)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group");
- if (NULL==H5O_read (&(grp->ent), H5O_STAB_ID, 0, &mesg, dxpl_id)) {
- H5O_close(&(grp->ent));
- HGOTO_ERROR (H5E_SYM, H5E_CANTOPENOBJ, NULL, "not a group");
- }
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group")
+ ent_opened = TRUE;
+
+ /* Check if this object has the right message(s) to be treated as a group */
+ if(H5O_exists(&(grp->ent), H5O_STAB_ID, 0, dxpl_id) <= 0)
+ HGOTO_ERROR (H5E_SYM, H5E_CANTOPENOBJ, NULL, "not a group")
/* Set return value */
ret_value = grp;
done:
- if (!ret_value && grp) {
- if(grp->shared)
- H5FL_FREE(H5G_shared_t, grp->shared);
- H5FL_FREE(H5G_t,grp);
- }
+ if(!ret_value) {
+ if(grp) {
+ if(ent_opened)
+ H5O_close(&(grp->ent));
+ if(grp->shared)
+ H5FL_FREE(H5G_shared_t, grp->shared);
+ H5FL_FREE(H5G_t,grp);
+ } /* end if */
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value);
}
@@ -2369,12 +2415,15 @@ done:
* Aug 12 1997
*
* Modifications:
+ * Removed the "H5G_entry_t *grp_ent" parameter, since it was unused
+ * Quincey Koziol
+ * Aug 29 2005
*
*-------------------------------------------------------------------------
*/
herr_t
H5G_find(H5G_entry_t *loc, const char *name,
- H5G_entry_t *grp_ent/*out*/, H5G_entry_t *obj_ent/*out*/, hid_t dxpl_id)
+ H5G_entry_t *obj_ent/*out*/, hid_t dxpl_id)
{
herr_t ret_value=SUCCEED; /* Return value */
@@ -2384,7 +2433,7 @@ H5G_find(H5G_entry_t *loc, const char *name,
assert (loc);
assert (name && *name);
- if (H5G_namei(loc, name, NULL, grp_ent, obj_ent, H5G_TARGET_NORMAL, NULL, H5G_NAMEI_TRAVERSE, NULL, dxpl_id)<0)
+ if (H5G_namei(loc, name, NULL, NULL, obj_ent, H5G_TARGET_NORMAL, NULL, H5G_NAMEI_TRAVERSE, NULL, dxpl_id)<0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found");
done:
@@ -2889,8 +2938,8 @@ done:
static ssize_t
H5G_get_objname_by_idx(H5G_entry_t *loc, hsize_t idx, char* name, size_t size, hid_t dxpl_id)
{
- H5O_stab_t stab_mesg; /*info about local heap & B-tree */
- H5G_bt_ud3_t udata; /* Iteration information */
+ H5O_stab_t stab; /*info about local heap & B-tree */
+ H5G_bt_it_ud2_t udata; /* Iteration information */
ssize_t ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5G_get_objname_by_idx);
@@ -2899,18 +2948,18 @@ H5G_get_objname_by_idx(H5G_entry_t *loc, hsize_t idx, char* name, size_t size, h
assert(loc);
/* Get the B-tree & local heap info */
- if (NULL==H5O_read (loc, H5O_STAB_ID, 0, &stab_mesg, dxpl_id))
+ if (NULL==H5O_read (loc, H5O_STAB_ID, 0, &stab, dxpl_id))
HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address");
/* Set iteration information */
udata.idx = idx;
udata.num_objs = 0;
- udata.mesg = &stab_mesg;
+ udata.heap_addr = stab.heap_addr;
udata.name = NULL;
/* Iterate over the group members */
if ((ret_value = H5B_iterate (loc->file, dxpl_id, H5B_SNODE,
- H5G_node_name, stab_mesg.btree_addr, &udata))<0)
+ H5G_node_name, stab.btree_addr, &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 */
@@ -2956,7 +3005,7 @@ static H5G_obj_t
H5G_get_objtype_by_idx(H5G_entry_t *loc, hsize_t idx, hid_t dxpl_id)
{
H5O_stab_t stab_mesg; /*info about local heap & B-tree */
- H5G_bt_ud3_t udata; /* User data for B-tree callback */
+ H5G_bt_it_ud3_t udata; /* User data for B-tree callback */
H5G_obj_t ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5G_get_objtype_by_idx);
@@ -2971,7 +3020,6 @@ H5G_get_objtype_by_idx(H5G_entry_t *loc, hsize_t idx, hid_t dxpl_id)
/* Set iteration information */
udata.idx = idx;
udata.num_objs = 0;
- udata.mesg = &stab_mesg;
udata.type = H5G_UNKNOWN;
/* Iterate over the group members */
@@ -3094,8 +3142,7 @@ H5G_set_comment(H5G_entry_t *loc, const char *name, const char *buf, hid_t dxpl_
FUNC_ENTER_NOAPI_NOINIT(H5G_set_comment);
/* Get the symbol table entry for the object */
- if (H5G_namei(loc, name, NULL, NULL, &obj_ent/*out*/, H5G_TARGET_NORMAL,
- NULL, H5G_NAMEI_TRAVERSE, NULL, dxpl_id)<0)
+ if (H5G_find(loc, name, &obj_ent/*out*/, dxpl_id)<0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found");
/* Remove the previous comment message if any */
@@ -3149,8 +3196,7 @@ H5G_get_comment(H5G_entry_t *loc, const char *name, size_t bufsize, char *buf, h
FUNC_ENTER_NOAPI_NOINIT(H5G_get_comment);
/* Get the symbol table entry for the object */
- if (H5G_namei(loc, name, NULL, NULL, &obj_ent/*out*/, H5G_TARGET_NORMAL,
- NULL, H5G_NAMEI_TRAVERSE, NULL, dxpl_id)<0)
+ if (H5G_find(loc, name, &obj_ent/*out*/, dxpl_id)<0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found");
/* Get the message */
diff --git a/src/H5Gent.c b/src/H5Gent.c
index bcc7895..52729c6 100644
--- a/src/H5Gent.c
+++ b/src/H5Gent.c
@@ -16,22 +16,26 @@
* Programmer: Robb Matzke <matzke@llnl.gov>
* Friday, September 19, 1997
*/
-#define H5G_PACKAGE
+#define H5G_PACKAGE /*suppress error about including H5Gpkg */
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
+/* Packages needed by this file... */
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
+#include "H5FLprivate.h" /* Free Lists */
#include "H5Gpkg.h" /* Groups */
#include "H5HLprivate.h" /* Local Heaps */
-#include "H5MMprivate.h" /* Memory management */
/* Private prototypes */
#ifdef NOT_YET
static herr_t H5G_ent_modified(H5G_entry_t *ent, H5G_type_t cache_type);
#endif /* NOT_YET */
+/* Declare extern the PQ free list for the wrapped strings */
+H5FL_BLK_EXTERN(str_buf);
+
/*-------------------------------------------------------------------------
* Function: H5G_ent_cache
@@ -94,19 +98,17 @@ done:
static herr_t
H5G_ent_modified(H5G_entry_t *ent, H5G_type_t cache_type)
{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5G_ent_modified, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5G_ent_modified)
- assert(ent);
+ HDassert(ent);
- if (H5G_NO_CHANGE != ent->type)
+ /* Update cache type, if requested */
+ if (H5G_NO_CHANGE != cache_type)
ent->type = cache_type;
ent->dirty = TRUE;
-done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5G_ent_modified */
#endif /* NOT_YET */
@@ -133,9 +135,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_ent_decode_vec(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, int n)
+H5G_ent_decode_vec(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, unsigned n)
{
- int i;
+ unsigned u;
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_ent_decode_vec, FAIL);
@@ -144,13 +146,11 @@ H5G_ent_decode_vec(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, int n)
assert(f);
assert(pp);
assert(ent);
- assert(n >= 0);
/* decode entries */
- for (i = 0; i < n; i++) {
- if (H5G_ent_decode(f, pp, ent + i) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode");
- }
+ for (u = 0; u < n; u++)
+ if (H5G_ent_decode(f, pp, ent + u) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode")
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -249,9 +249,9 @@ H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent)
*-------------------------------------------------------------------------
*/
herr_t
-H5G_ent_encode_vec(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, int n)
+H5G_ent_encode_vec(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsigned n)
{
- int i;
+ unsigned u;
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_ent_encode_vec, FAIL);
@@ -260,13 +260,11 @@ H5G_ent_encode_vec(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, int n)
assert(f);
assert(pp);
assert(ent);
- assert(n >= 0);
/* encode entries */
- for (i = 0; i < n; i++) {
- if (H5G_ent_encode(f, pp, ent + i) < 0)
+ for (u = 0; u < n; u++)
+ if (H5G_ent_encode(f, pp, ent + u) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode");
- }
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -461,6 +459,124 @@ H5G_ent_reset(H5G_entry_t *ent)
/*-------------------------------------------------------------------------
+ * Function: H5G_ent_set_name
+ *
+ * Purpose: Set the name of a symbol entry OBJ, located at LOC
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: August 22, 2002
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_ent_set_name(H5G_entry_t *loc, H5G_entry_t *obj, const char *name)
+{
+ size_t name_len; /* Length of name to append */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(H5G_ent_set_name, FAIL)
+
+ assert(loc);
+ assert(obj);
+ assert(name);
+
+ /* Reset the object's previous names, if they exist */
+ if(obj->user_path_r) {
+ H5RS_decr(obj->user_path_r);
+ obj->user_path_r=NULL;
+ } /* end if */
+ if(obj->canon_path_r) {
+ H5RS_decr(obj->canon_path_r);
+ obj->canon_path_r=NULL;
+ } /* end if */
+ obj->user_path_hidden=0;
+
+ /* Get the length of the new name */
+ name_len = HDstrlen(name);
+
+ /* Modify the object's user path, if a user path exists in the location */
+ if(loc->user_path_r) {
+ const char *loc_user_path; /* Pointer to raw string for user path */
+ size_t user_path_len; /* Length of location's user path name */
+ char *new_user_path; /* Pointer to new user path */
+
+ /* Get the length of the strings involved */
+ user_path_len = H5RS_len(loc->user_path_r);
+
+ /* Modify the object's user path */
+
+ /* Get the raw string for the user path */
+ loc_user_path=H5RS_get_str(loc->user_path_r);
+ assert(loc_user_path);
+
+ /* The location's user path already ends in a '/' separator */
+ if ('/'==loc_user_path[user_path_len-1]) {
+ if (NULL==(new_user_path = H5FL_BLK_MALLOC(str_buf,user_path_len+name_len+1)))
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HDstrcpy(new_user_path, loc_user_path);
+ } /* end if */
+ /* The location's user path needs a separator */
+ else {
+ if (NULL==(new_user_path = H5FL_BLK_MALLOC(str_buf,user_path_len+1+name_len+1)))
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HDstrcpy(new_user_path, loc_user_path);
+ HDstrcat(new_user_path, "/");
+ } /* end else */
+
+ /* Append the component's name */
+ HDstrcat(new_user_path, name);
+
+ /* Give ownership of the user path to the entry */
+ obj->user_path_r=H5RS_own(new_user_path);
+ assert(obj->user_path_r);
+ } /* end if */
+
+ /* Modify the object's canonical path, if a canonical path exists in the location */
+ if(loc->canon_path_r) {
+ const char *loc_canon_path; /* Pointer to raw string for canonical path */
+ size_t canon_path_len; /* Length of location's canonical path name */
+ char *new_canon_path; /* Pointer to new canonical path */
+
+ /* Get the length of the strings involved */
+ canon_path_len = H5RS_len(loc->canon_path_r);
+
+ /* Modify the object's canonical path */
+
+ /* Get the raw string for the canonical path */
+ loc_canon_path=H5RS_get_str(loc->canon_path_r);
+ assert(loc_canon_path);
+
+ /* The location's canonical path already ends in a '/' separator */
+ if ('/'==loc_canon_path[canon_path_len-1]) {
+ if (NULL==(new_canon_path = H5FL_BLK_MALLOC(str_buf,canon_path_len+name_len+1)))
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HDstrcpy(new_canon_path, loc_canon_path);
+ } /* end if */
+ /* The location's canonical path needs a separator */
+ else {
+ if (NULL==(new_canon_path = H5FL_BLK_MALLOC(str_buf,canon_path_len+1+name_len+1)))
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HDstrcpy(new_canon_path, loc_canon_path);
+ HDstrcat(new_canon_path, "/");
+ } /* end else */
+
+ /* Append the component's name */
+ HDstrcat(new_canon_path, name);
+
+ /* Give ownership of the canonical path to the entry */
+ obj->canon_path_r=H5RS_own(new_canon_path);
+ assert(obj->canon_path_r);
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_ent_set_name() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5G_ent_debug
*
* Purpose: Prints debugging information about a symbol table entry.
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 7aac30a..f21d0fd 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -14,7 +14,7 @@
/*-------------------------------------------------------------------------
*
- * Created: snode.c
+ * Created: H5Gnode.c
* Jun 26 1997
* Robb Matzke <matzke@llnl.gov>
*
@@ -23,28 +23,21 @@
* table entries. A B-tree usually points to the
* symbol table nodes for any given symbol table.
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-#define H5G_PACKAGE /*suppress error message about including H5Gpkg.h */
+#define H5G_PACKAGE /*suppress error about including H5Gpkg */
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
/* Packages needed by this file... */
#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5Bprivate.h" /* B-link trees */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Gpkg.h" /* Groups */
#include "H5HLprivate.h" /* Local Heaps */
-#include "H5Iprivate.h" /* IDs */
#include "H5MFprivate.h" /* File memory management */
#include "H5MMprivate.h" /* Memory management */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Pprivate.h" /* Property lists */
/* Private typedefs */
@@ -296,7 +289,7 @@ H5G_node_debug_key (FILE *stream, H5F_t *f, hid_t dxpl_id, int indent, int fwidt
const void *_key, const void *_udata)
{
const H5G_node_key_t *key = (const H5G_node_key_t *) _key;
- const H5G_bt_ud1_t *udata = (const H5G_bt_ud1_t *) _udata;
+ const H5G_bt_ud0_t *udata = (const H5G_bt_ud0_t *) _udata;
const H5HL_t *heap = NULL;
const char *s;
herr_t ret_value=SUCCEED; /* Return value */
@@ -470,7 +463,7 @@ H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_
{
uint8_t *buf = NULL;
size_t size;
- int i;
+ unsigned u;
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5G_node_flush);
@@ -485,15 +478,14 @@ H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_
/*
* Look for dirty entries and set the node dirty flag.
*/
- for (i=0; i<sym->nsyms; i++) {
- if (sym->entry[i].dirty) {
+ for (u = 0; u < sym->nsyms; u++)
+ if (sym->entry[u].dirty) {
/* Set the node's dirty flag */
sym->cache_info.is_dirty = TRUE;
/* Reset the entry's dirty flag */
- sym->entry[i].dirty=FALSE;
+ sym->entry[u].dirty=FALSE;
} /* end if */
- }
/*
* Write the symbol node to disk.
@@ -637,7 +629,7 @@ H5G_node_dest(H5F_t UNUSED *f, H5G_node_t *sym)
static herr_t
H5G_node_clear(H5F_t *f, H5G_node_t *sym, hbool_t destroy)
{
- int i; /* Local index variable */
+ unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT(H5G_node_clear);
@@ -647,10 +639,9 @@ H5G_node_clear(H5F_t *f, H5G_node_t *sym, hbool_t destroy)
*/
assert(sym);
-
- /* Look for dirty entries and reset the dirty flag. */
- for (i=0; i<sym->nsyms; i++)
- sym->entry[i].dirty=FALSE;
+ /* Look for dirty entries and reset their dirty flag. */
+ for(u = 0; u < sym->nsyms; u++)
+ sym->entry[u].dirty=FALSE;
sym->cache_info.is_dirty = FALSE;
/*
@@ -806,7 +797,7 @@ done:
static int
H5G_node_cmp2(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_key)
{
- H5G_bt_ud1_t *udata = (H5G_bt_ud1_t *) _udata;
+ H5G_bt_ud0_t *udata = (H5G_bt_ud0_t *) _udata;
H5G_node_key_t *lt_key = (H5G_node_key_t *) _lt_key;
H5G_node_key_t *rt_key = (H5G_node_key_t *) _rt_key;
const H5HL_t *heap = NULL;
@@ -871,7 +862,7 @@ done:
static int
H5G_node_cmp3(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_key)
{
- H5G_bt_ud1_t *udata = (H5G_bt_ud1_t *) _udata;
+ H5G_bt_ud0_t *udata = (H5G_bt_ud0_t *) _udata;
H5G_node_key_t *lt_key = (H5G_node_key_t *) _lt_key;
H5G_node_key_t *rt_key = (H5G_node_key_t *) _rt_key;
const H5HL_t *heap = NULL;
@@ -944,10 +935,11 @@ static herr_t
H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key,
void *_udata)
{
- H5G_bt_ud1_t *bt_udata = (H5G_bt_ud1_t *) _udata;
+ H5G_bt_ud1_t *udata = (H5G_bt_ud1_t *) _udata;
H5G_node_t *sn = NULL;
const H5HL_t *heap = NULL;
- int lt = 0, idx = 0, rt, cmp = 1;
+ unsigned lt = 0, idx = 0, rt;
+ int cmp = 1;
const char *s;
const char *base; /* Base of heap */
herr_t ret_value=SUCCEED; /* Return value */
@@ -959,7 +951,7 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key
*/
assert(f);
assert(H5F_addr_defined(addr));
- assert(bt_udata);
+ assert(udata);
/*
* Load the symbol table node for exclusive access.
@@ -968,7 +960,7 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to protect symbol table node");
/* Get base address of heap */
- if (NULL == (heap = H5HL_protect(f, dxpl_id, bt_udata->heap_addr)))
+ if (NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to protect symbol name");
base = H5HL_offset_into(f, heap, 0);
@@ -980,16 +972,15 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key
while (lt < rt && cmp) {
idx = (lt + rt) / 2;
s=base+sn->entry[idx].name_off;
- cmp = HDstrcmp(bt_udata->name, s);
+ cmp = HDstrcmp(udata->common.name, s);
- if (cmp < 0) {
+ if (cmp < 0)
rt = idx;
- } else {
+ else
lt = idx + 1;
- }
}
- if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, udata->common.heap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name");
heap=NULL; base=NULL;
@@ -1002,7 +993,7 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key
*
* (do a NULL copy, since the entry's name will be constructed later)
*/
- if (H5G_ent_copy(bt_udata->ent, &sn->entry[idx], H5G_COPY_NULL)<0)
+ if (H5G_ent_copy(udata->ent, &sn->entry[idx], H5G_COPY_NULL)<0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to copy entry");
done:
@@ -1064,16 +1055,16 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key,
{
H5G_node_key_t *md_key = (H5G_node_key_t *) _md_key;
H5G_node_key_t *rt_key = (H5G_node_key_t *) _rt_key;
- H5G_bt_ud1_t *bt_udata = (H5G_bt_ud1_t *) _udata;
+ H5G_bt_ud1_t *udata = (H5G_bt_ud1_t *) _udata;
H5G_node_t *sn = NULL, *snrt = NULL;
unsigned sn_flags = H5AC__NO_FLAGS_SET, snrt_flags = H5AC__NO_FLAGS_SET;
const H5HL_t *heap = NULL;
size_t offset; /*offset of name in heap */
const char *s;
- const char *base; /* Base of heap */
- int idx = -1, cmp = 1;
- int lt = 0, rt; /*binary search cntrs */
+ const char *base; /* Base of heap */
+ unsigned lt = 0, rt; /* Binary search cntrs */
+ int cmp = 1, idx = -1;
H5G_node_t *insert_into = NULL; /*node that gets new entry*/
H5B_ins_t ret_value = H5B_INS_ERROR;
@@ -1086,7 +1077,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key,
assert(H5F_addr_defined(addr));
assert(md_key);
assert(rt_key);
- assert(bt_udata);
+ assert(udata);
assert(new_node_p);
/*
@@ -1096,7 +1087,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key,
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node");
/* Get base address of heap */
- if (NULL == (heap = H5HL_protect(f, dxpl_id, bt_udata->heap_addr)))
+ if (NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name");
base = H5HL_offset_into(f, heap, 0);
@@ -1109,37 +1100,36 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key,
idx = (lt + rt) / 2;
s=base+sn->entry[idx].name_off;
- if (0 == (cmp = HDstrcmp(bt_udata->name, s))) /*already present */ {
+ if (0 == (cmp = HDstrcmp(udata->common.name, s))) /*already present */ {
HCOMMON_ERROR(H5E_SYM, H5E_CANTINSERT, "symbol is already present in symbol table");
- if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, udata->common.heap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name");
heap=NULL; base=NULL;
HGOTO_DONE(H5B_INS_ERROR);
}
- if (cmp < 0) {
+ if (cmp < 0)
rt = idx;
- } else {
+ else
lt = idx + 1;
- }
}
idx += cmp > 0 ? 1 : 0;
- if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, udata->common.heap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name");
heap=NULL; base=NULL;
/*
* Add the new name to the heap.
*/
- offset = H5HL_insert(f, dxpl_id, bt_udata->heap_addr, HDstrlen(bt_udata->name)+1,
- bt_udata->name);
- bt_udata->ent->name_off = offset;
+ offset = H5HL_insert(f, dxpl_id, udata->common.heap_addr, HDstrlen(udata->common.name)+1,
+ udata->common.name);
+ udata->ent->name_off = offset;
if (0==offset || (size_t)(-1)==offset)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5B_INS_ERROR, "unable to insert symbol name into heap");
- if ((size_t)(sn->nsyms) >= 2*H5F_SYM_LEAF_K(f)) {
+ if (sn->nsyms >= 2*H5F_SYM_LEAF_K(f)) {
/*
* The node is full. Split it into a left and right
* node and return the address of the new right node (the
@@ -1187,7 +1177,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key,
ret_value = H5B_INS_NOOP;
sn_flags |= H5AC__DIRTIED_FLAG;
insert_into = sn;
- if (idx == sn->nsyms) {
+ if (idx == (int)sn->nsyms) {
rt_key->offset = offset;
*rt_key_changed = TRUE;
}
@@ -1200,7 +1190,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key,
/* Copy new entry into table */
/* (use H5G_COPY_NULL because we don't track the object names in the table) */
- H5G_ent_copy(&(insert_into->entry[idx]), bt_udata->ent, H5G_COPY_NULL);
+ H5G_ent_copy(&(insert_into->entry[idx]), udata->ent, H5G_COPY_NULL);
/* Flag entry as dirty */
insert_into->entry[idx].dirty = TRUE;
@@ -1267,13 +1257,14 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
void *_udata/*in,out*/, void *_rt_key/*in,out*/,
hbool_t *rt_key_changed/*out*/)
{
- H5G_node_key_t *lt_key = (H5G_node_key_t*)_lt_key;
- H5G_node_key_t *rt_key = (H5G_node_key_t*)_rt_key;
- H5G_bt_ud1_t *bt_udata = (H5G_bt_ud1_t*)_udata;
+ H5G_node_key_t *lt_key = (H5G_node_key_t *)_lt_key;
+ H5G_node_key_t *rt_key = (H5G_node_key_t *)_rt_key;
+ H5G_bt_ud2_t *udata = (H5G_bt_ud2_t *)_udata;
H5G_node_t *sn = NULL;
unsigned sn_flags = H5AC__NO_FLAGS_SET;
const H5HL_t *heap = NULL;
- int lt=0, rt, idx=0, cmp=1;
+ unsigned lt=0, rt, idx=0;
+ int cmp=1;
const char *s = NULL;
const char *base; /* Base of heap */
H5B_ins_t ret_value = H5B_INS_ERROR;
@@ -1285,19 +1276,19 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
assert(H5F_addr_defined(addr));
assert(lt_key);
assert(rt_key);
- assert(bt_udata);
+ assert(udata);
/* Load the symbol table */
if (NULL==(sn=H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node");
/* "Normal" removal of a single entry from the symbol table node */
- if(bt_udata->name!=NULL) {
+ if(udata->common.name!=NULL) {
size_t len=0;
hbool_t found; /* Indicate that the string was found */
/* Get base address of heap */
- if (NULL == (heap = H5HL_protect(f, dxpl_id, bt_udata->heap_addr)))
+ if (NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name");
base = H5HL_offset_into(f, heap, 0);
@@ -1307,7 +1298,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
while (lt<rt && cmp) {
idx = (lt+rt)/2;
s=base+sn->entry[idx].name_off;
- cmp = HDstrcmp(bt_udata->name, s);
+ cmp = HDstrcmp(udata->common.name, s);
if (cmp<0) {
rt = idx;
} else {
@@ -1315,7 +1306,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
}
}
- if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, udata->common.heap_addr, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name");
heap=NULL; base=NULL;
@@ -1324,7 +1315,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
if (H5G_CACHED_SLINK==sn->entry[idx].type) {
/* Remove the symbolic link value */
- if (NULL == (heap = H5HL_protect(f, dxpl_id, bt_udata->heap_addr)))
+ if (NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name");
s = H5HL_offset_into(f, heap, sn->entry[idx].cache.slink.lval_offset);
@@ -1335,23 +1326,25 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
else
found=0;
- if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, udata->common.heap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name");
heap=NULL; s=NULL;
if (found)
- H5HL_remove(f, dxpl_id, bt_udata->heap_addr, sn->entry[idx].cache.slink.lval_offset, len);
+ H5HL_remove(f, dxpl_id, udata->common.heap_addr, sn->entry[idx].cache.slink.lval_offset, len);
H5E_clear_stack(NULL); /* no big deal */
} else {
- /* Decrement the reference count */
- assert(H5F_addr_defined(sn->entry[idx].header));
- if (H5O_link(sn->entry+idx, -1, dxpl_id)<0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, "unable to decrement object link count");
+ /* Decrement the reference count, if requested */
+ if(udata->adj_link) {
+ HDassert(H5F_addr_defined(sn->entry[idx].header));
+ if (H5O_link(sn->entry+idx, -1, dxpl_id)<0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, "unable to decrement object link count")
+ } /* end if */
}
/* Remove the name from the local heap */
- if (NULL == (heap = H5HL_protect(f, dxpl_id, bt_udata->heap_addr)))
+ if (NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name");
s = H5HL_offset_into(f, heap, sn->entry[idx].name_off);
@@ -1363,17 +1356,17 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
else
found=0;
- if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, udata->common.heap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name");
heap=NULL; s=NULL;
if (found)
- H5HL_remove(f, dxpl_id, bt_udata->heap_addr, sn->entry[idx].name_off, len);
+ H5HL_remove(f, dxpl_id, udata->common.heap_addr, sn->entry[idx].name_off, len);
H5E_clear_stack(NULL); /* no big deal */
/* Remove the entry from the symbol table node */
- if (1==sn->nsyms) {
+ if(1==sn->nsyms) {
/*
* We are about to remove the only symbol in this node. Copy the left
* key to the right key and mark the right key as dirty. Free this
@@ -1433,10 +1426,12 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
/* Reduce the link count for all entries in this node */
for(idx=0; idx<sn->nsyms; idx++) {
if (H5G_CACHED_SLINK!=sn->entry[idx].type) {
- /* Decrement the reference count */
- assert(H5F_addr_defined(sn->entry[idx].header));
- if (H5O_link(sn->entry+idx, -1, dxpl_id)<0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, H5B_INS_ERROR, "unable to decrement object link count");
+ /* Decrement the reference count, if requested */
+ if(udata->adj_link) {
+ HDassert(H5F_addr_defined(sn->entry[idx].header));
+ if (H5O_link(sn->entry+idx, -1, dxpl_id)<0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, H5B_INS_ERROR, "unable to decrement object link count")
+ } /* end if */
} /* end if */
} /* end for */
@@ -1495,13 +1490,14 @@ int
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_ud2_t *bt_udata = (H5G_bt_ud2_t *)_udata;
+ H5G_bt_it_ud1_t *udata = (H5G_bt_it_ud1_t *)_udata;
H5G_node_t *sn = NULL;
const H5HL_t *heap = NULL;
- int i, nsyms;
+ unsigned nsyms; /* # of symbols in node */
size_t n, *name_off=NULL;
const char *name;
char buf[1024], *s;
+ unsigned u; /* Local index variable */
int ret_value;
FUNC_ENTER_NOAPI(H5G_node_iterate, H5B_ITER_ERROR);
@@ -1511,7 +1507,7 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t a
*/
assert(f);
assert(H5F_addr_defined(addr));
- assert(bt_udata);
+ assert(udata);
/*
* Save information about the symbol table node since we can't lock it
@@ -1522,8 +1518,8 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t a
nsyms = sn->nsyms;
if (NULL==(name_off = H5FL_SEQ_MALLOC(size_t, (size_t)nsyms)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, H5B_ITER_ERROR, "memory allocation failed");
- for (i=0; i<nsyms; i++)
- name_off[i] = sn->entry[i].name_off;
+ for(u = 0; u < nsyms; u++)
+ name_off[u] = sn->entry[u].name_off;
if (H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) {
sn = NULL;
@@ -1535,14 +1531,14 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t a
/*
* Iterate over the symbol table node entries.
*/
- for (i=0, ret_value=H5B_ITER_CONT; i<nsyms && !ret_value; i++) {
- if (bt_udata->skip>0) {
- --bt_udata->skip;
+ for(u = 0, ret_value = H5B_ITER_CONT; u < nsyms && !ret_value; u++) {
+ if (udata->skip>0) {
+ --udata->skip;
} else {
- if (NULL == (heap = H5HL_protect(f, dxpl_id, bt_udata->stab->heap_addr)))
+ if (NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_ITER_ERROR, "unable to protect symbol name");
- name = H5HL_offset_into(f, heap, name_off[i]);
+ name = H5HL_offset_into(f, heap, name_off[u]);
assert (name);
n = HDstrlen (name);
@@ -1554,24 +1550,24 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t a
}
HDstrcpy (s, name);
- if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->stab->heap_addr, H5AC__NO_FLAGS_SET) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name");
heap=NULL; name=NULL;
- ret_value = (bt_udata->op)(bt_udata->group_id, s, bt_udata->op_data);
+ ret_value = (udata->op)(udata->group_id, s, udata->op_data);
if (s!=buf)
H5MM_xfree (s);
}
/* Increment the number of entries passed through */
/* (whether we skipped them or not) */
- bt_udata->final_ent++;
+ udata->final_ent++;
}
if (ret_value<0)
HERROR (H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
done:
- if (heap && H5HL_unprotect(f, dxpl_id, heap, bt_udata->stab->heap_addr, H5AC__NO_FLAGS_SET) < 0)
+ if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name");
if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED)
@@ -1660,7 +1656,7 @@ int
H5G_node_name(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
const void UNUSED *_rt_key, void *_udata)
{
- H5G_bt_ud3_t *bt_udata = (H5G_bt_ud3_t *)_udata;
+ H5G_bt_it_ud2_t *udata = (H5G_bt_it_ud2_t *)_udata;
const H5HL_t *heap = NULL;
size_t name_off;
hsize_t loc_idx;
@@ -1675,31 +1671,31 @@ H5G_node_name(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
*/
assert(f);
assert(H5F_addr_defined(addr));
- assert(bt_udata);
+ assert(udata);
if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node");
/* Find the node, locate the object symbol table entry and retrieve the name */
- if(bt_udata->idx >= bt_udata->num_objs && bt_udata->idx < (bt_udata->num_objs+sn->nsyms)) {
- loc_idx = bt_udata->idx - bt_udata->num_objs;
+ if(udata->idx >= udata->num_objs && udata->idx < (udata->num_objs + sn->nsyms)) {
+ loc_idx = udata->idx - udata->num_objs;
name_off = sn->entry[loc_idx].name_off;
- if (NULL == (heap = H5HL_protect(f, dxpl_id, bt_udata->mesg->heap_addr)))
+ if (NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_ITER_ERROR, "unable to protect symbol name");
name = H5HL_offset_into(f, heap, name_off);
assert (name);
- bt_udata->name = H5MM_strdup (name);
- assert(bt_udata->name);
+ udata->name = H5MM_strdup (name);
+ assert(udata->name);
- if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->mesg->heap_addr, H5AC__NO_FLAGS_SET) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name");
heap=NULL; name=NULL;
ret_value = H5B_ITER_STOP;
} else {
- bt_udata->num_objs += sn->nsyms;
+ udata->num_objs += sn->nsyms;
}
done:
@@ -1735,7 +1731,7 @@ int
H5G_node_type(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
const void UNUSED *_rt_key, void *_udata)
{
- H5G_bt_ud3_t *bt_udata = (H5G_bt_ud3_t*)_udata;
+ H5G_bt_it_ud3_t *udata = (H5G_bt_it_ud3_t*)_udata;
hsize_t loc_idx;
H5G_node_t *sn = NULL;
int ret_value = H5B_ITER_CONT;
@@ -1745,18 +1741,18 @@ H5G_node_type(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
/* Check arguments. */
assert(f);
assert(H5F_addr_defined(addr));
- assert(bt_udata);
+ assert(udata);
/* Find the node, locate the object symbol table entry and retrieve the type */
if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node");
- if(bt_udata->idx >= bt_udata->num_objs && bt_udata->idx < (bt_udata->num_objs+sn->nsyms)) {
- loc_idx = bt_udata->idx - bt_udata->num_objs;
- bt_udata->type = H5G_get_type(&(sn->entry[loc_idx]), dxpl_id);
+ if(udata->idx >= udata->num_objs && udata->idx < (udata->num_objs + sn->nsyms)) {
+ loc_idx = udata->idx - udata->num_objs;
+ udata->type = H5G_get_type(&(sn->entry[loc_idx]), dxpl_id);
ret_value = H5B_ITER_STOP;
} else {
- bt_udata->num_objs += sn->nsyms;
+ udata->num_objs += sn->nsyms;
}
done:
@@ -1917,10 +1913,10 @@ herr_t
H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
int fwidth, haddr_t heap)
{
- int i;
H5G_node_t *sn = NULL;
const char *s;
const H5HL_t *heap_ptr = NULL;
+ unsigned u;
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_node_debug, FAIL);
@@ -1939,7 +1935,7 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
* B-tree node.
*/
if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) {
- H5G_bt_ud1_t udata; /*data to pass through B-tree */
+ H5G_bt_ud0_t udata; /*data to pass through B-tree */
H5E_clear_stack(NULL); /* discard that error */
udata.heap_addr = heap;
@@ -1953,20 +1949,20 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
sn->cache_info.is_dirty ? "Yes" : "No");
fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Size of Node (in bytes):", (unsigned)H5G_node_size(f));
- fprintf(stream, "%*s%-*s %d of %d\n", indent, "", fwidth,
+ fprintf(stream, "%*s%-*s %u of %u\n", indent, "", fwidth,
"Number of Symbols:",
- sn->nsyms, 2 * H5F_SYM_LEAF_K(f));
+ sn->nsyms, (unsigned)(2 * H5F_SYM_LEAF_K(f)));
indent += 3;
fwidth = MAX(0, fwidth - 3);
- for (i = 0; i < sn->nsyms; i++) {
- fprintf(stream, "%*sSymbol %d:\n", indent - 3, "", i);
+ for (u = 0; u < sn->nsyms; u++) {
+ fprintf(stream, "%*sSymbol %u:\n", indent - 3, "", u);
if (heap>0 && H5F_addr_defined(heap)) {
if (NULL == (heap_ptr = H5HL_protect(f, dxpl_id, heap)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to protect symbol name");
- s = H5HL_offset_into(f, heap_ptr, sn->entry[i].name_off);
+ s = H5HL_offset_into(f, heap_ptr, sn->entry[u].name_off);
if (s)
fprintf(stream, "%*s%-*s `%s'\n", indent, "", fwidth, "Name:", s);
@@ -1978,7 +1974,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(f, dxpl_id, sn->entry + i, stream, indent, fwidth, heap);
+ H5G_ent_debug(f, dxpl_id, sn->entry + u, stream, indent, fwidth, heap);
}
done:
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index 0bc7883..adb546f 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -43,7 +43,7 @@
typedef struct H5G_node_t {
H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */
/* first field in structure */
- int nsyms; /*number of symbols */
+ unsigned nsyms; /*number of symbols */
H5G_entry_t *entry; /*array of symbol table entries */
} H5G_node_t;
@@ -65,49 +65,106 @@ struct H5G_t {
};
/*
- * Data exchange structure for symbol table nodes. This structure is
+ * Common data exchange structure for symbol table nodes. This structure is
* passed through the B-link tree layer to the methods for the objects
* to which the B-link tree points.
*/
-typedef struct H5G_bt_ud1_t {
+typedef struct H5G_bt_ud_common_t {
/* downward */
const char *name; /*points to temporary memory */
haddr_t heap_addr; /*symbol table heap address */
+} H5G_bt_ud_common_t;
+
+/*
+ * Data exchange structure for symbol table nodes. This structure is
+ * passed through the B-link tree layer to the methods for the objects
+ * to which the B-link tree points for operations which require no
+ * additional information.
+ *
+ * (Just an alias for the "common" info).
+ */
+typedef H5G_bt_ud_common_t H5G_bt_ud0_t;
+
+/*
+ * Data exchange structure for symbol table nodes. This structure is
+ * passed through the B-link tree layer to the methods for the objects
+ * to which the B-link tree points.
+ */
+typedef struct H5G_bt_ud1_t {
+ /* downward */
+ H5G_bt_ud_common_t common; /* Common info for B-tree user data (must be first) */
/* downward for INSERT, upward for FIND */
H5G_entry_t *ent; /*entry to insert into table */
} H5G_bt_ud1_t;
/*
+ * Data exchange structure for symbol table nodes. This structure is
+ * passed through the B-link tree layer to the methods for the objects
+ * to which the B-link tree points.
+ */
+typedef struct H5G_bt_ud2_t {
+ /* downward */
+ H5G_bt_ud_common_t common; /* Common info for B-tree user data (must be first) */
+ hbool_t adj_link; /* Whether to adjust the link count on objects */
+
+ /* upward */
+} H5G_bt_ud2_t;
+
+/*
* Data exchange structure to pass through the B-tree layer for the
* H5B_iterate function.
*/
-typedef struct H5G_bt_ud2_t {
+typedef struct H5G_bt_it_ud1_t {
/* downward */
hid_t group_id; /*group id to pass to iteration operator */
- H5O_stab_t *stab; /*the cached symbol table info to which group_id points */
+ haddr_t heap_addr; /*symbol table heap address */
H5G_iterate_t op; /*iteration operator */
void *op_data; /*user-defined operator data */
int skip; /*initial entries to skip */
/* upward */
int final_ent; /*final entry looked at */
-} H5G_bt_ud2_t;
+} H5G_bt_it_ud1_t;
/*
* Data exchange structure to pass through the B-tree layer for the
* H5B_iterate function.
*/
-typedef struct H5G_bt_ud3_t {
+typedef struct H5G_bt_it_ud2_t {
/* downward */
- const H5O_stab_t *mesg; /*the symbol table message of group being queried */
- hsize_t idx; /*index of group member to be queried */
- hsize_t num_objs; /*the number of objects having been traversed*/
+ haddr_t heap_addr; /*symbol table heap address */
+ hsize_t idx; /*index of group member to be queried */
+ hsize_t num_objs; /*the number of objects having been traversed*/
/* upward */
char *name; /*member name to be returned */
+} H5G_bt_it_ud2_t;
+
+/*
+ * Data exchange structure to pass through the B-tree layer for the
+ * H5B_iterate function.
+ */
+typedef struct H5G_bt_it_ud3_t {
+ /* downward */
+ hsize_t idx; /*index of group member to be queried */
+ hsize_t num_objs; /*the number of objects having been traversed*/
+
+ /* upward */
H5G_obj_t type; /*member type to be returned */
-} H5G_bt_ud3_t;
+} H5G_bt_it_ud3_t;
+
+/*
+ * Data exchange structure to pass through the B-tree layer for the
+ * H5B_iterate function.
+ */
+typedef struct H5G_bt_it_ud4_t {
+ /* downward */
+ haddr_t heap_addr; /*symbol table heap address */
+ H5G_entry_t *grp_ent; /*entry of group */
+
+ /* upward */
+} H5G_bt_it_ud4_t;
/*
* This is the class identifier to give to the B-tree functions.
@@ -128,18 +185,17 @@ H5_DLL herr_t H5G_stab_find(H5G_entry_t *grp_ent, const char *name,
H5G_entry_t *obj_ent/*out*/, hid_t dxpl_id);
H5_DLL herr_t H5G_stab_insert(H5G_entry_t *grp_ent, const char *name,
H5G_entry_t *obj_ent, hbool_t inc_link, hid_t dxpl_id);
-H5_DLL herr_t H5G_stab_insert_name(H5G_entry_t *loc, H5G_entry_t *obj,
- const char *name);
-H5_DLL herr_t H5G_stab_delete(H5F_t *f, hid_t dxpl_id, haddr_t btree_addr, haddr_t heap_addr);
+H5_DLL herr_t H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab, hbool_t adj_link);
H5_DLL herr_t H5G_stab_remove(H5G_entry_t *grp_ent, const char *name, hid_t dxpl_id);
/*
* Functions that understand symbol table entries.
*/
H5_DLL herr_t H5G_ent_decode_vec(H5F_t *f, const uint8_t **pp,
- H5G_entry_t *ent, int n);
+ H5G_entry_t *ent, unsigned n);
H5_DLL herr_t H5G_ent_encode_vec(H5F_t *f, uint8_t **pp,
- const H5G_entry_t *ent, int n);
+ const H5G_entry_t *ent, unsigned n);
+H5_DLL herr_t H5G_ent_set_name(H5G_entry_t *loc, H5G_entry_t *obj, const char *name);
/* Functions that understand symbol table nodes */
H5_DLL int H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index f105463..815a76f 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -63,12 +63,17 @@
4 + /*reserved */ \
H5G_SIZEOF_SCRATCH) /*scratch pad space */
-/* ========= group Creation properties ============ */
+/* ========= Group Creation properties ============ */
+
+/* Definitions for local heap size hint */
+#define H5G_CRT_GROUP_INFO_NAME "group info"
+#define H5G_CRT_GROUP_INFO_SIZE sizeof(H5O_ginfo_t)
+#define H5G_CRT_GROUP_INFO_DEF {0, 8, 6, 4, 8}
/* Definitions for creating intermediate groups */
-#define H5G_CRT_INTERMEDIATE_GROUP_NAME "intermediate_group"
-#define H5G_CRT_INTERMEDIATE_GROUP_SIZE sizeof(unsigned)
-#define H5G_CRT_INTERMEDIATE_GROUP_DEF 0
+#define H5G_CRT_INTERMEDIATE_GROUP_NAME "intermediate_group"
+#define H5G_CRT_INTERMEDIATE_GROUP_SIZE sizeof(unsigned)
+#define H5G_CRT_INTERMEDIATE_GROUP_DEF 0
/*
* Various types of object header information can be cached in a symbol
@@ -161,7 +166,7 @@ H5_DLL herr_t H5G_get_objinfo(H5G_entry_t *loc, const char *name,
H5_DLL herr_t H5G_insert(H5G_entry_t *loc, const char *name,
H5G_entry_t *ent, hid_t dxpl_id, struct H5P_genplist_t *oc_plist);
H5_DLL herr_t H5G_find(H5G_entry_t *loc, const char *name,
- H5G_entry_t *grp_ent/*out*/, H5G_entry_t *ent/*out*/, hid_t dxpl_id);
+ H5G_entry_t *ent/*out*/, hid_t dxpl_id);
H5_DLL H5F_t *H5G_insertion_file(H5G_entry_t *loc, const char *name, hid_t dxpl_id);
H5_DLL herr_t H5G_replace_name(H5G_obj_t type, H5G_entry_t *loc,
H5RS_str_t *src_name, H5G_entry_t *src_loc,
diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h
index 6ab22fe..2f82536 100644
--- a/src/H5Gpublic.h
+++ b/src/H5Gpublic.h
@@ -121,8 +121,8 @@ H5_DLL herr_t H5Gset_comment(hid_t loc_id, const char *name,
const char *comment);
H5_DLL int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize,
char *buf);
-H5_DLL hid_t H5Gcreate_expand(hid_t loc_id, const char *name, size_t size_hint,
- hid_t gcpl_id, hid_t gapl_id);
+H5_DLL hid_t H5Gcreate_expand(hid_t loc_id, const char *name, hid_t gcpl_id,
+ hid_t gapl_id);
#ifdef __cplusplus
}
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index 1d813eb..8c83859 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -20,17 +20,13 @@
#define H5G_PACKAGE /*suppress error about including H5Gpkg */
-#include "H5private.h"
-#include "H5Eprivate.h"
-#include "H5Fpkg.h" /*file access */
-#include "H5FLprivate.h" /*Free Lists */
-#include "H5Gpkg.h"
-#include "H5HLprivate.h"
-#include "H5MMprivate.h"
-#include "H5Oprivate.h"
-
-/* Declare extern the PQ free list for the wrapped strings */
-H5FL_BLK_EXTERN(str_buf);
+/* Packages needed by this file... */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* File access */
+#include "H5Gpkg.h" /* Groups */
+#include "H5HLprivate.h" /* Local Heaps */
+#include "H5MMprivate.h" /* Memory management */
/* Private prototypes */
@@ -66,21 +62,21 @@ H5G_stab_create(H5F_t *f, hid_t dxpl_id, size_t init, H5G_entry_t *self/*out*/)
H5O_stab_t stab; /*symbol table message */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5G_stab_create, FAIL);
+ FUNC_ENTER_NOAPI(H5G_stab_create, FAIL)
/*
* Check arguments.
*/
- assert(f);
- assert(self);
+ HDassert(f);
+ HDassert(self);
init = MAX(init, H5HL_SIZEOF_FREE(f) + 2);
/* Create symbol table private heap */
if (H5HL_create(f, dxpl_id, init, &(stab.heap_addr)/*out*/)<0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create heap");
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create heap")
name = H5HL_insert(f, dxpl_id, stab.heap_addr, 1, "");
if ((size_t)(-1)==name)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't initialize heap");
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't initialize heap")
/*
* B-tree's won't work if the first name isn't at the beginning
@@ -90,7 +86,7 @@ H5G_stab_create(H5F_t *f, hid_t dxpl_id, size_t init, H5G_entry_t *self/*out*/)
/* Create the B-tree */
if (H5B_create(f, dxpl_id, H5B_SNODE, NULL, &(stab.btree_addr)/*out*/) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create B-tree");
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create B-tree")
/*
* Create symbol table object header. It has a zero link count
@@ -98,7 +94,7 @@ H5G_stab_create(H5F_t *f, hid_t dxpl_id, size_t init, H5G_entry_t *self/*out*/)
* incremented if the object is added to the group directed graph.
*/
if (H5O_create(f, dxpl_id, 4 + 2 * H5F_SIZEOF_ADDR(f), self/*out*/) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create header");
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create header")
/*
* Insert the symbol table message into the object header and the symbol
@@ -106,15 +102,15 @@ H5G_stab_create(H5F_t *f, hid_t dxpl_id, size_t init, H5G_entry_t *self/*out*/)
*/
if (H5O_modify(self, H5O_STAB_ID, H5O_NEW_MESG, H5O_FLAG_CONSTANT, H5O_UPDATE_TIME, &stab, dxpl_id)<0) {
H5O_close(self);
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message");
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
}
self->cache.stab.btree_addr = stab.btree_addr;
self->cache.stab.heap_addr = stab.heap_addr;
self->type = H5G_CACHED_STAB;
done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_stab_create() */
/*-------------------------------------------------------------------------
@@ -148,7 +144,7 @@ H5G_stab_find(H5G_entry_t *grp_ent, const char *name,
H5O_stab_t stab; /*symbol table message */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5G_stab_find, FAIL);
+ FUNC_ENTER_NOAPI(H5G_stab_find, FAIL)
/* Check arguments */
assert(grp_ent);
@@ -158,22 +154,22 @@ H5G_stab_find(H5G_entry_t *grp_ent, const char *name,
/* set up the udata */
if (NULL == H5O_read(grp_ent, H5O_STAB_ID, 0, &stab, dxpl_id))
- HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't read message");
- udata.name = name;
- udata.heap_addr = stab.heap_addr;
+ HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't read message")
+ udata.common.name = name;
+ udata.common.heap_addr = stab.heap_addr;
udata.ent = obj_ent;
/* search the B-tree */
if (H5B_find(grp_ent->file, dxpl_id, H5B_SNODE, stab.btree_addr, &udata) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found");
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found")
- /* insert the name into the symbol entry OBJ_ENT */
- if (H5G_stab_insert_name( grp_ent, obj_ent, name ) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot insert name");
+ /* Set the name for the symbol entry OBJ_ENT */
+ if (H5G_ent_set_name( grp_ent, obj_ent, name ) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot insert name")
done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_stab_find() */
/*-------------------------------------------------------------------------
@@ -183,19 +179,12 @@ done:
* file F. The name of the new symbol is NAME and its symbol
* table entry is OBJ_ENT.
*
- * Errors:
- *
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* matzke@llnl.gov
* Aug 1 1997
*
- * Modifications:
- *
- * Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
- * Added `id to name' support.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -206,30 +195,30 @@ H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent,
H5G_bt_ud1_t udata; /*data to pass through B-tree */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5G_stab_insert, FAIL);
+ FUNC_ENTER_NOAPI(H5G_stab_insert, FAIL)
/* check arguments */
assert(grp_ent && grp_ent->file);
assert(name && *name);
assert(obj_ent && obj_ent->file);
if (grp_ent->file->shared != obj_ent->file->shared)
- HGOTO_ERROR(H5E_SYM, H5E_LINK, FAIL, "interfile hard links are not allowed");
+ HGOTO_ERROR(H5E_SYM, H5E_LINK, FAIL, "interfile hard links are not allowed")
- /* insert the name into the symbol entry OBJ_ENT */
- if(H5G_stab_insert_name(grp_ent, obj_ent, name) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot insert name");
+ /* Set the name for the symbol entry OBJ_ENT */
+ if (H5G_ent_set_name( grp_ent, obj_ent, name ) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot insert name")
/* initialize data to pass through B-tree */
if (NULL == H5O_read(grp_ent, H5O_STAB_ID, 0, &stab, dxpl_id))
- HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table");
+ HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table")
- udata.name = name;
- udata.heap_addr = stab.heap_addr;
+ udata.common.name = name;
+ udata.common.heap_addr = stab.heap_addr;
udata.ent = obj_ent;
/* insert */
if (H5B_insert(grp_ent->file, dxpl_id, H5B_SNODE, stab.btree_addr, &udata) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry");
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry")
/* Increment link count on object, if appropriate */
if(inc_link)
@@ -259,149 +248,27 @@ herr_t
H5G_stab_remove(H5G_entry_t *grp_ent, const char *name, hid_t dxpl_id)
{
H5O_stab_t stab; /*symbol table message */
- H5G_bt_ud1_t udata; /*data to pass through B-tree */
+ H5G_bt_ud2_t udata; /*data to pass through B-tree */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5G_stab_remove, FAIL);
+ FUNC_ENTER_NOAPI(H5G_stab_remove, FAIL)
assert(grp_ent && grp_ent->file);
assert(name && *name);
/* initialize data to pass through B-tree */
if (NULL==H5O_read(grp_ent, H5O_STAB_ID, 0, &stab, dxpl_id))
- HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table");
- udata.name = name;
- udata.heap_addr = stab.heap_addr;
- udata.ent = NULL;
+ HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table")
+ udata.common.name = name;
+ udata.common.heap_addr = stab.heap_addr;
+ udata.adj_link = TRUE;
/* remove */
if (H5B_remove(grp_ent->file, dxpl_id, H5B_SNODE, stab.btree_addr, &udata)<0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to remove entry");
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to remove entry")
done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5G_stab_insert_name
- *
- * Purpose: Insert a name into the symbol entry OBJ, located at LOC
- *
- * Return: Success: 0, Failure: -1
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: August 22, 2002
- *
- * Comments: The allocated memory (H5MM_malloc) is freed in H5O_close
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5G_stab_insert_name(H5G_entry_t *loc, H5G_entry_t *obj, const char *name)
-{
- size_t name_len; /* Length of name to append */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT(H5G_stab_insert_name);
-
- assert(loc);
- assert(obj);
- assert(name);
-
- /* Reset the object's previous names, if they exist */
- if(obj->user_path_r) {
- H5RS_decr(obj->user_path_r);
- obj->user_path_r=NULL;
- } /* end if */
- if(obj->canon_path_r) {
- H5RS_decr(obj->canon_path_r);
- obj->canon_path_r=NULL;
- } /* end if */
- obj->user_path_hidden=0;
-
- /* Get the length of the new name */
- name_len = HDstrlen(name);
-
- /* Modify the object's user path, if a user path exists in the location */
- if(loc->user_path_r) {
- const char *loc_user_path; /* Pointer to raw string for user path */
- size_t user_path_len; /* Length of location's user path name */
- char *new_user_path; /* Pointer to new user path */
-
- /* Get the length of the strings involved */
- user_path_len = H5RS_len(loc->user_path_r);
-
- /* Modify the object's user path */
-
- /* Get the raw string for the user path */
- loc_user_path=H5RS_get_str(loc->user_path_r);
- assert(loc_user_path);
-
- /* The location's user path already ends in a '/' separator */
- if ('/'==loc_user_path[user_path_len-1]) {
- if (NULL==(new_user_path = H5FL_BLK_MALLOC(str_buf,user_path_len+name_len+1)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
- HDstrcpy(new_user_path, loc_user_path);
- } /* end if */
- /* The location's user path needs a separator */
- else {
- if (NULL==(new_user_path = H5FL_BLK_MALLOC(str_buf,user_path_len+1+name_len+1)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
- HDstrcpy(new_user_path, loc_user_path);
- HDstrcat(new_user_path, "/");
- } /* end else */
-
- /* Append the component's name */
- HDstrcat(new_user_path, name);
-
- /* Give ownership of the user path to the entry */
- obj->user_path_r=H5RS_own(new_user_path);
- assert(obj->user_path_r);
- } /* end if */
-
- /* Modify the object's canonical path, if a canonical path exists in the location */
- if(loc->canon_path_r) {
- const char *loc_canon_path; /* Pointer to raw string for canonical path */
- size_t canon_path_len; /* Length of location's canonical path name */
- char *new_canon_path; /* Pointer to new canonical path */
-
- /* Get the length of the strings involved */
- canon_path_len = H5RS_len(loc->canon_path_r);
-
- /* Modify the object's canonical path */
-
- /* Get the raw string for the canonical path */
- loc_canon_path=H5RS_get_str(loc->canon_path_r);
- assert(loc_canon_path);
-
- /* The location's canonical path already ends in a '/' separator */
- if ('/'==loc_canon_path[canon_path_len-1]) {
- if (NULL==(new_canon_path = H5FL_BLK_MALLOC(str_buf,canon_path_len+name_len+1)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
- HDstrcpy(new_canon_path, loc_canon_path);
- } /* end if */
- /* The location's canonical path needs a separator */
- else {
- if (NULL==(new_canon_path = H5FL_BLK_MALLOC(str_buf,canon_path_len+1+name_len+1)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
- HDstrcpy(new_canon_path, loc_canon_path);
- HDstrcat(new_canon_path, "/");
- } /* end else */
-
- /* Append the component's name */
- HDstrcat(new_canon_path, name);
-
- /* Give ownership of the canonical path to the entry */
- obj->canon_path_r=H5RS_own(new_canon_path);
- assert(obj->canon_path_r);
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -420,31 +287,31 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_stab_delete(H5F_t *f, hid_t dxpl_id, haddr_t btree_addr, haddr_t heap_addr)
+H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab, hbool_t adj_link)
{
- H5G_bt_ud1_t udata; /*data to pass through B-tree */
+ H5G_bt_ud2_t udata; /*data to pass through B-tree */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5G_stab_delete, FAIL);
assert(f);
- assert(H5F_addr_defined(btree_addr));
- assert(H5F_addr_defined(heap_addr));
+ assert(stab);
+ assert(H5F_addr_defined(stab->btree_addr));
+ assert(H5F_addr_defined(stab->heap_addr));
/* Set up user data for B-tree deletion */
- udata.name = NULL;
- udata.heap_addr = heap_addr;
- udata.ent = NULL;
+ udata.common.name = NULL;
+ udata.common.heap_addr = stab->heap_addr;
+ udata.adj_link = adj_link;
/* Delete entire B-tree */
- if(H5B_delete(f, dxpl_id, H5B_SNODE, btree_addr, &udata)<0)
+ if(H5B_delete(f, dxpl_id, H5B_SNODE, stab->btree_addr, &udata)<0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table B-tree");
/* Delete local heap for names */
- if(H5HL_delete(f, dxpl_id, heap_addr)<0)
+ if(H5HL_delete(f, dxpl_id, stab->heap_addr)<0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table heap");
done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5G_stab_delete() */
-
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 1e3d3fc..8a9dd7d 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -171,6 +171,18 @@ typedef struct H5O_bogus_t {
#endif /* H5O_ENABLE_BOGUS */
/*
+ * Group info message.
+ * (Data structure in memory)
+ */
+typedef struct H5O_ginfo_t {
+ size_t lheap_size_hint; /* Local heap size hint */
+ unsigned max_compact; /* Maximum # of compact links */
+ unsigned min_dense; /* Minimum # of "dense" links */
+ unsigned est_num_entries; /* Estimated # of entries in group */
+ unsigned est_name_len; /* Estimated length of entry name */
+} H5O_ginfo_t;
+
+/*
* Filter pipeline message.
* (Data structure in memory)
*/
diff --git a/src/H5Ostab.c b/src/H5Ostab.c
index 279b437..21391bd 100644
--- a/src/H5Ostab.c
+++ b/src/H5Ostab.c
@@ -317,19 +317,18 @@ H5O_stab_free (void *mesg)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link)
+H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *mesg, hbool_t adj_link)
{
- const H5O_stab_t *stab = (const H5O_stab_t *) _mesg;
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_stab_delete)
/* check args */
assert(f);
- assert(stab);
+ assert(mesg);
/* Free the file space for the symbol table */
- if (H5G_stab_delete(f, dxpl_id, stab->btree_addr, stab->heap_addr)<0)
+ if (H5G_stab_delete(f, dxpl_id, mesg, adj_link)<0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free symbol table")
done:
diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c
new file mode 100644
index 0000000..8b22015
--- /dev/null
+++ b/src/H5Pgcpl.c
@@ -0,0 +1,106 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#define H5P_PACKAGE /*suppress error about including H5Ppkg */
+
+/* Private header files */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Ppkg.h" /* Property lists */
+
+/* Local datatypes */
+
+/* Static function prototypes */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_local_heap_size_hint
+ *
+ * Purpose: Set the "size hint" for creating local heaps for a group.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * August 29, 2005
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_local_heap_size_hint(hid_t plist_id, size_t size_hint)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5O_ginfo_t ginfo; /* Group information structure */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pset_local_heap_size_hint, FAIL)
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get value */
+ if(H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info")
+
+ /* Update field */
+ ginfo.lheap_size_hint = size_hint;
+
+ /* Set value */
+ if(H5P_set(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_local_heap_size_hint() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_local_heap_size_hint
+ *
+ * Purpose: Returns the local heap size hint, which is used for creating
+ * groups
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * August 29, 2005
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_local_heap_size_hint(hid_t plist_id, size_t *size_hint /*out*/)
+{
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pget_local_heap_size_hint, FAIL)
+
+ if(size_hint) {
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5O_ginfo_t ginfo; /* Group information structure */
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get value */
+ if(H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info")
+
+ /* Update field */
+ *size_hint = ginfo.lheap_size_hint;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_local_heap_size_hint() */
+
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index cbf6b48..8d5e015 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -332,6 +332,9 @@ H5_DLL herr_t H5Pget_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t *op, voi
H5_DLL herr_t H5Pset_create_intermediate_group(hid_t plist_id, unsigned crt_intmd);
H5_DLL herr_t H5Pget_create_intermediate_group(hid_t plist_id, unsigned *crt_intmd /*out*/);
+H5_DLL herr_t H5Pset_local_heap_size_hint(hid_t plist_id, size_t size_hint);
+H5_DLL herr_t H5Pget_local_heap_size_hint(hid_t plist_id, size_t *size_hint /*out*/);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/H5T.c b/src/H5T.c
index ea77f8a..f67ed7f 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -1605,7 +1605,7 @@ H5Topen(hid_t loc_id, const char *name)
* Find the named data type object header and read the data type message
* from it.
*/
- if (H5G_find (loc, name, NULL, &ent/*out*/, dxpl_id)<0)
+ if (H5G_find (loc, name, &ent/*out*/, dxpl_id)<0)
HGOTO_ERROR (H5E_DATATYPE, H5E_NOTFOUND, FAIL, "not found");
ent_found = TRUE;
diff --git a/src/Makefile.am b/src/Makefile.am
index 046800f..15a09ed 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -55,7 +55,8 @@ libhdf5_la_SOURCES= H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2cache.c H5B2dbg.c \
H5Oattr.c H5Obogus.c \
H5Ocont.c H5Odtype.c H5Oefl.c H5Ofill.c H5Olayout.c H5Omtime.c \
H5Oname.c H5Onull.c H5Opline.c H5Osdspace.c H5Oshared.c H5Ostab.c \
- H5P.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Pocpl.c H5Ptest.c \
+ H5P.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Pgcpl.c H5Pocpl.c \
+ H5Ptest.c \
H5R.c H5RC.c \
H5RS.c H5S.c H5Sall.c H5Shyper.c H5Smpio.c H5Snone.c H5Spoint.c \
H5Sselect.c H5Stest.c H5SH.c H5SHcache.c H5SHdbg.c \
diff --git a/src/Makefile.in b/src/Makefile.in
index 27f5dcb..cb1b445 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -98,7 +98,7 @@ am_libhdf5_la_OBJECTS = H5.lo H5A.lo H5AC.lo H5B.lo H5B2.lo \
H5Ocont.lo H5Odtype.lo H5Oefl.lo H5Ofill.lo H5Olayout.lo \
H5Omtime.lo H5Oname.lo H5Onull.lo H5Opline.lo H5Osdspace.lo \
H5Oshared.lo H5Ostab.lo H5P.lo H5Pdcpl.lo H5Pdxpl.lo \
- H5Pfapl.lo H5Pfcpl.lo H5Pocpl.lo H5Ptest.lo H5R.lo H5RC.lo \
+ H5Pfapl.lo H5Pfcpl.lo H5Pgcpl.lo H5Pocpl.lo H5Ptest.lo H5R.lo H5RC.lo \
H5RS.lo H5S.lo H5Sall.lo H5Shyper.lo H5Smpio.lo H5Snone.lo \
H5Spoint.lo H5Sselect.lo H5Stest.lo H5SH.lo H5SHcache.lo \
H5SHdbg.lo H5SL.lo H5ST.lo H5T.lo H5Tarray.lo H5Tbit.lo \
@@ -380,7 +380,7 @@ libhdf5_la_SOURCES = H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2cache.c H5B2dbg.c \
H5Oattr.c H5Obogus.c \
H5Ocont.c H5Odtype.c H5Oefl.c H5Ofill.c H5Olayout.c H5Omtime.c \
H5Oname.c H5Onull.c H5Opline.c H5Osdspace.c H5Oshared.c H5Ostab.c \
- H5P.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Pocpl.c H5Ptest.c \
+ H5P.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Pgcpl.c H5Pocpl.c H5Ptest.c \
H5R.c H5RC.c \
H5RS.c H5S.c H5Sall.c H5Shyper.c H5Smpio.c H5Snone.c H5Spoint.c \
H5Sselect.c H5Stest.c H5SH.c H5SHcache.c H5SHdbg.c \
@@ -608,6 +608,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pdxpl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pfapl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pfcpl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pgcpl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pocpl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ptest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5R.Plo@am__quote@
diff --git a/test/tmisc.c b/test/tmisc.c
index e11bec2..c24195e 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -3783,7 +3783,7 @@ test_misc23(void)
CHECK(status, FAIL, "H5Pset_create_intermediate_group");
- tmp_id = H5Gcreate_expand(file_id, "/A/B01/grp", 0, create_id, access_id);
+ tmp_id = H5Gcreate_expand(file_id, "/A/B01/grp", create_id, access_id);
CHECK(tmp_id, FAIL, "H5Gcreate_expand");
/* Query that the name of the new group is correct */
@@ -3806,28 +3806,28 @@ test_misc23(void)
CHECK(status, FAIL, "H5Gclose");
- tmp_id = H5Gcreate_expand(file_id, "/A/B02/C02/grp", 0, create_id, access_id);
+ tmp_id = H5Gcreate_expand(file_id, "/A/B02/C02/grp", create_id, access_id);
CHECK(tmp_id, FAIL, "H5Gcreate_expand");
status = H5Gclose(tmp_id);
CHECK(status, FAIL, "H5Gclose");
- tmp_id = H5Gcreate_expand(group_id, "B03/grp/", 0, create_id, access_id);
+ tmp_id = H5Gcreate_expand(group_id, "B03/grp/", create_id, access_id);
CHECK(tmp_id, FAIL, "H5Gcreate_expand");
status = H5Gclose(tmp_id);
CHECK(status, FAIL, "H5Gclose");
- if ( (tmp_id = H5Gcreate_expand(group_id, "/A/B04/grp/", 0, create_id, access_id)) < 0)
+ if ( (tmp_id = H5Gcreate_expand(group_id, "/A/B04/grp/", create_id, access_id)) < 0)
CHECK(tmp_id, FAIL, "H5Gcreate_expand");
status = H5Gclose(tmp_id);
CHECK(status, FAIL, "H5Gclose");
- if ( (tmp_id = H5Gcreate_expand(file_id, "/A/B05/C05/A", 0, create_id, access_id)) < 0)
+ if ( (tmp_id = H5Gcreate_expand(file_id, "/A/B05/C05/A", create_id, access_id)) < 0)
CHECK(tmp_id, FAIL, "H5Gcreate_expand");
status = H5Gclose(tmp_id);