summaryrefslogtreecommitdiffstats
path: root/src/H5Gnode.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1997-10-20 23:14:35 (GMT)
committerRobb Matzke <matzke@llnl.gov>1997-10-20 23:14:35 (GMT)
commit56ad55117a89a423a9341d2f0c3912d4ad57ec6f (patch)
treedff0bada659180ac324d81a4d97f7bfb884f0ed6 /src/H5Gnode.c
parentdc4961d072249ddf39a7db7a945ea627c276d025 (diff)
downloadhdf5-56ad55117a89a423a9341d2f0c3912d4ad57ec6f.zip
hdf5-56ad55117a89a423a9341d2f0c3912d4ad57ec6f.tar.gz
hdf5-56ad55117a89a423a9341d2f0c3912d4ad57ec6f.tar.bz2
[svn-r129] Changes since 19970916
---------------------- ./config/depend.in Fixed backslashes in sed script because the H5Gnode.c dependency info was disappearing. You'll have to rerun config.status to rebuild the Makefiles unless you use gnu make. ./config/conclude.in Also removes emacs backup files, TAGS, and svf backup files. ./config/linux Grouped gcc flags and added provisions for debugging vs. production. ./html/H5.format.html Updated messages 0x0008, 0x0009, and 0x000A. ./html/storage.html Documentation describing storage schemes. ./src/Makefile.in ./test/Makefile.in New source files. ./src/H5A.c ./src/H5Apublic.h ./src/H5C.c Changed VOIDP to void* in a couple places. ./src/H5AC.c ./src/H5ACprivate.h ./src/H5B.c ./src/H5Bprivate.h ./src/H5G.c ./src/H5Gnode.c ./src/H5Gprivate.h ./src/H5H.c ./src/H5O.c Removed `const' from some variables because H5G_node_found() wanted to modify it's udata argument. Removing const there caused it to cascade to these other locations. ./src/H5AC.c ./src/H5ACprivate.h ./src/H5B.c ./src/H5Gnode.c ./src/H5Gstab.c ./src/H5H.c ./src/H5O.c Added an extra argument to H5AC_find_f() and H5AC_protect(). This arg gets passed to the load() method. Also added an extra argument to the H5AC_find() macro. ./src/H5B.c ./src/H5Bprivate.h ./src/H5Gnode.c Extra argument passed to the sizeof_rkey() method. ./src/H5Fprivate.c ./src/H5Fistore.c (new) Added indexed I/O operations. ./src/H5G.c ./src/H5Gnode.c ./src/H5Gprivate.h Beginning to add H5G_open/close and related bug fixes. ./src/H5Oprivate.h ./src/H5Oistore.c (new) Added the H5O_ISTORE messsage (0x0008) for indexed storage of objects. ./src/H5private.h Added extra braces around both sides of the FUNC_ENTER() and FUNC_LEAVE() macros so FUNC_ENTER() can appear before declarations or after executable statements the second case is used by H5G_namei() to initialize output arguments to sane values before FUNC_ENTER() might return failure. int f () { int decl1; printf ("This happens before FUNC_ENTER()\n"); FUNC_ENTER (...); int another_declaration; ./src/H5B.c ./src/H5Bprivate.h ./src/H5Gnode.c Extra arguments for key encoding and decoding. ./src/H5E.c ./src/H5Epublic.h ./src/H5Fistore.c ./src/H5Oistore.c ./src/H5Oprivate.h Indexed, chunked, sparse storage (not ready for general consumption yet). ./src/H5V.c (new) ./src/H5Vprivate.h (new) ./test/hyperslab.c (new) Vector, array, and hyperslab functions. ./src/H5B.c ./src/H5Bprivate.h ./src/H5Fistore.c ./src/H5Gnode.c ./src/H5V.c ./src/H5Vprivate.h ./test/hyperslab.c Added functionality for indexed storage. ./src/H5F.c Fixed problems with seek optimizing. Recommend we disable it until we can implement it in the file/address class since all of HDF5 must be aware of it. ./src/H5O.c Fixed comeent speling erorr :-) ./MANIFEST Added new files. ./config/conclude.in Added the word `Testing' to the test cases. So if a test program is called hyperslab then the make output will contain the line `Testing hyperslab'. ./config/linux The default file I/O library is Posix section 2 on my linux machine so I can do some I/O performance testing. ./src/H5C.c ./src/H5Cprivate.h ./src/H5Cpublic.h Added ability to set size of indexed-storage B-tree. ./src/H5D.c ./src/H5E.c ./src/H5Epublic.h ./src/H5F.c ./src/H5Fprivate.h ./src/H5G.c ./src/H5Gnode.c ./src/H5Gpkg.h ./src/H5Gprivate.h ./src/H5Gpublic.h ./src/H5Gshad.c ./src/H5Gstab.c ./test/stab.c Changed `directory' to `group' in numerous places. ./src/H5private.h The FILELIB constant can be set on the compile command-line. ./src/istore.c NEW Tests for indexed storage.
Diffstat (limited to 'src/H5Gnode.c')
-rw-r--r--src/H5Gnode.c81
1 files changed, 41 insertions, 40 deletions
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 84dc0e5..58c924c 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -39,29 +39,32 @@
#define PABLO_MASK H5G_node_mask
/* PRIVATE PROTOTYPES */
-static herr_t H5G_node_decode_key (H5F_t *f, uint8 *raw, void *_key);
-static herr_t H5G_node_encode_key (H5F_t *f, uint8 *raw, void *_key);
+static herr_t H5G_node_decode_key (H5F_t *f, H5B_t *bt, uint8 *raw,
+ void *_key);
+static herr_t H5G_node_encode_key (H5F_t *f, H5B_t *bt, uint8 *raw,
+ void *_key);
static size_t H5G_node_size (H5F_t *f);
static haddr_t H5G_node_new (H5F_t *f, void *_lt_key, void *_udata,
void *_rt_key);
static herr_t H5G_node_flush (H5F_t *f, hbool_t destroy, haddr_t addr,
H5G_node_t *sym);
-static H5G_node_t *H5G_node_load (H5F_t *f, haddr_t addr, void *_data);
+static H5G_node_t *H5G_node_load (H5F_t *f, haddr_t addr, void *_udata1,
+ void *_udata2);
static intn H5G_node_cmp (H5F_t *f, void *_lt_key, void *_udata,
void *_rt_key);
static herr_t H5G_node_found (H5F_t *f, haddr_t addr,
const void *_lt_key, void *_udata,
const void *_rt_key);
-static haddr_t H5G_node_insert (H5F_t *f, haddr_t addr, intn *anchor,
+static haddr_t H5G_node_insert (H5F_t *f, haddr_t addr, H5B_ins_t *anchor,
void *_lt_key, hbool_t *lt_key_changed,
void *_md_key, void *_udata,
void *_rt_key, hbool_t *rt_key_changed);
static herr_t H5G_node_list (H5F_t *f, haddr_t addr, void *_udata);
-static size_t H5G_node_sizeof_rkey (H5F_t *f);
+static size_t H5G_node_sizeof_rkey (H5F_t *f, const void *_udata);
/* H5G inherits cache-like properties from H5AC */
const H5AC_class_t H5AC_SNODE[1] = {{
- (void*(*)(H5F_t*,haddr_t,void*))H5G_node_load,
+ (void*(*)(H5F_t*,haddr_t,void*,void*))H5G_node_load,
(herr_t(*)(H5F_t*,hbool_t,haddr_t,void*))H5G_node_flush,
}};
@@ -74,6 +77,8 @@ H5B_class_t H5B_SNODE[1] = {{
H5G_node_cmp, /*cmp */
H5G_node_found, /*found */
H5G_node_insert, /*insert */
+ TRUE, /*follow min branch? */
+ TRUE, /*follow max branch? */
H5G_node_list, /*list */
H5G_node_decode_key, /*decode */
H5G_node_encode_key, /*encode */
@@ -102,7 +107,7 @@ static intn interface_initialize_g = FALSE;
*-------------------------------------------------------------------------
*/
static size_t
-H5G_node_sizeof_rkey (H5F_t *f)
+H5G_node_sizeof_rkey (H5F_t *f, const void *udata __attribute__((unused)))
{
return H5F_SIZEOF_OFFSET(f);
}
@@ -126,7 +131,7 @@ H5G_node_sizeof_rkey (H5F_t *f)
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_node_decode_key (H5F_t *f, uint8 *raw, void *_key)
+H5G_node_decode_key (H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
{
H5G_node_key_t *key = (H5G_node_key_t *)_key;
@@ -160,7 +165,7 @@ H5G_node_decode_key (H5F_t *f, uint8 *raw, void *_key)
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_node_encode_key (H5F_t *f, uint8 *raw, void *_key)
+H5G_node_encode_key (H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
{
H5G_node_key_t *key = (H5G_node_key_t *)_key;
@@ -378,12 +383,12 @@ H5G_node_flush (H5F_t *f, hbool_t destroy, haddr_t addr, H5G_node_t *sym)
*-------------------------------------------------------------------------
*/
static H5G_node_t *
-H5G_node_load (H5F_t *f, haddr_t addr, void *_udata)
+H5G_node_load (H5F_t *f, haddr_t addr, void *_udata1, void *_udata2)
{
H5G_node_t *sym = NULL;
size_t size = 0;
uint8 *buf = NULL, *p = NULL;
- H5G_ac_ud1_t *ac_udata = (H5G_ac_ud1_t*)_udata;
+ H5G_ac_ud1_t *ac_udata = (H5G_ac_ud1_t*)_udata1;
H5G_node_t *ret_value = NULL; /*for error handling*/
FUNC_ENTER (H5G_node_load, NULL, NULL);
@@ -394,6 +399,7 @@ H5G_node_load (H5F_t *f, haddr_t addr, void *_udata)
assert (f);
assert (addr>=0);
assert (ac_udata);
+ assert (NULL==_udata2);
/*
* Initialize variables.
@@ -453,21 +459,21 @@ H5G_node_load (H5F_t *f, haddr_t addr, void *_udata)
/*-------------------------------------------------------------------------
* Function: H5G_node_cmp
*
- * Purpose: Compares two keys from a B-tree node (LEFT and RIGHT)
+ * Purpose: Compares two keys from a B-tree node (LT_KEY and RT_KEY)
* against another key (not necessarily the same type)
* pointed to by UDATA.
*
* Return: Success: negative if the UDATA key is less than
- * or equal to the LEFT key.
+ * or equal to the LT_KEY
*
* positive if the UDATA key is greater
- * than the RIGHT key.
+ * than the RT_KEY.
*
* zero if the UDATA key falls between
- * the LEFT key (exclusive) and the
- * RIGHT key (inclusive).
+ * the LT_KEY (exclusive) and the
+ * RT_KEY (inclusive).
*
- * Failure: FAIL (same as LT < RT)
+ * Failure: FAIL (same as UDATA < LT_KEY)
*
* Programmer: Robb Matzke
* matzke@llnl.gov
@@ -551,13 +557,13 @@ H5G_node_found (H5F_t *f, haddr_t addr, const void *_lt_key,
assert (addr>=0);
assert (bt_udata);
- ac_udata.dir_addr = bt_udata->dir_addr;
+ ac_udata.grp_addr = bt_udata->grp_addr;
ac_udata.heap_addr = bt_udata->heap_addr;
/*
* Load the symbol table node for exclusive access.
*/
- if (NULL==(sn=H5AC_protect (f, H5AC_SNODE, addr, &ac_udata))) {
+ if (NULL==(sn=H5AC_protect (f, H5AC_SNODE, addr, &ac_udata, NULL))) {
HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, FAIL);
}
@@ -656,7 +662,7 @@ done:
*-------------------------------------------------------------------------
*/
static haddr_t
-H5G_node_insert (H5F_t *f, haddr_t addr, intn *anchor,
+H5G_node_insert (H5F_t *f, haddr_t addr, H5B_ins_t *anchor,
void *_lt_key, hbool_t *lt_key_changed,
void *_md_key, void *_udata,
void *_rt_key, hbool_t *rt_key_changed)
@@ -693,19 +699,11 @@ H5G_node_insert (H5F_t *f, haddr_t addr, intn *anchor,
bt_udata->entry_ptr = NULL;
/*
- * Symbol tables are always split so the new symbol table node is
- * to the right of the old one.
- */
- *anchor = H5B_ANCHOR_LT;
- *lt_key_changed = FALSE;
- *rt_key_changed = FALSE;
-
- /*
* Load the symbol node.
*/
- ac_udata.dir_addr = bt_udata->dir_addr;
+ ac_udata.grp_addr = bt_udata->grp_addr;
ac_udata.heap_addr = bt_udata->heap_addr;
- if (NULL==(sn=H5AC_protect (f, H5AC_SNODE, addr, &ac_udata))) {
+ if (NULL==(sn=H5AC_protect (f, H5AC_SNODE, addr, &ac_udata, NULL))) {
HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, FAIL);
}
@@ -746,12 +744,13 @@ H5G_node_insert (H5F_t *f, haddr_t addr, intn *anchor,
* node and return the address of the new right node (the
* left node is at the same address as the original node).
*/
+ *anchor = H5B_INS_RIGHT;
/* The right node */
if ((new_node = H5G_node_new (f, NULL, NULL, NULL))<0) {
HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL);
}
- if (NULL==(snrt=H5AC_find (f, H5AC_SNODE, new_node, &ac_udata))) {
+ if (NULL==(snrt=H5AC_find (f, H5AC_SNODE, new_node, &ac_udata, NULL))) {
HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, FAIL);
}
HDmemcpy (snrt->entry, sn->entry + H5G_NODE_K(f),
@@ -789,6 +788,7 @@ H5G_node_insert (H5F_t *f, haddr_t addr, intn *anchor,
} else {
/* Where to insert the new entry? */
+ *anchor = H5B_INS_NOOP;
sn->dirty = TRUE;
insert_into = sn;
insert_addr = addr;
@@ -809,7 +809,7 @@ H5G_node_insert (H5F_t *f, haddr_t addr, intn *anchor,
H5G_shadow_move (f, bt_udata->entry.shadow,
bt_udata->name,
insert_into->entry + idx,
- bt_udata->dir_addr);
+ bt_udata->grp_addr);
}
/* Move entries */
@@ -837,7 +837,8 @@ done:
if (H5AC_unprotect (f, H5AC_SNODE, addr, sn)<0) {
HRETURN_ERROR (H5E_SYM, H5E_PROTECT, FAIL);
}
- if (NULL==(sn=H5AC_protect (f, H5AC_SNODE, insert_addr, &ac_udata))) {
+ if (NULL==(sn=H5AC_protect (f, H5AC_SNODE, insert_addr, &ac_udata,
+ NULL))) {
HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, FAIL);
}
assert (sn==bt_udata->node_ptr);
@@ -852,7 +853,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5G_node_list
*
- * Purpose: This function gets called during a directory list operation.
+ * Purpose: This function gets called during a group list operation.
* It should fill in data in the UDATA struct.
*
* Return: Success: SUCCEED
@@ -886,9 +887,9 @@ H5G_node_list (H5F_t *f, haddr_t addr, void *_udata)
assert (addr>=0);
assert (bt_udata);
- ac_udata.dir_addr = bt_udata->dir_addr;
+ ac_udata.grp_addr = bt_udata->grp_addr;
ac_udata.heap_addr = bt_udata->heap_addr;
- if (NULL==(sn=H5AC_protect (f, H5AC_SNODE, addr, &ac_udata))) {
+ if (NULL==(sn=H5AC_protect (f, H5AC_SNODE, addr, &ac_udata, NULL))) {
HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, FAIL);
}
@@ -978,21 +979,21 @@ H5G_node_debug (H5F_t *f, haddr_t addr, FILE *stream, intn indent,
* We have absolutely no idea where the object header for the symbol table
* to which this node belongs is located. In fact, if the file is corrupt,
* there may not even be an object header for that symbol table. So we
- * supply `-1' as the directory address which causes no open objects to be
+ * supply `-1' as the group address which causes no open objects to be
* associated with the node. For that reason, we flush this node from the
* cache when we're done so if some later caller knows the header address
* they'll be able to access the open objects.
*/
- ac_udata.dir_addr = -1;
+ ac_udata.grp_addr = -1;
ac_udata.heap_addr = heap;
/*
* If we couldn't load the symbol table node, then try loading the
* B-tree node.
*/
- if (NULL==(sn=H5AC_find(f, H5AC_SNODE, addr, &ac_udata))) {
+ if (NULL==(sn=H5AC_find(f, H5AC_SNODE, addr, &ac_udata, NULL))) {
H5ECLEAR; /*discard that error*/
- status = H5B_debug (f, addr, stream, indent, fwidth, H5B_SNODE);
+ status = H5B_debug (f, addr, stream, indent, fwidth, H5B_SNODE, NULL);
if (status<0) HRETURN_ERROR (H5E_SYM, H5E_CANTLOAD, FAIL);
HRETURN (SUCCEED);
}