summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MANIFEST24
-rw-r--r--src/H5AC.c6
-rw-r--r--src/H5ACprivate.h27
-rw-r--r--src/H5B2dbg.c9
-rw-r--r--src/H5B2private.h1
-rw-r--r--src/H5BP.c471
-rw-r--r--src/H5BPcache.c710
-rw-r--r--src/H5BPdbg.c120
-rw-r--r--src/H5BPpkg.h212
-rw-r--r--src/H5BPprivate.h86
-rw-r--r--src/H5BPpublic.h53
-rw-r--r--src/H5BPtest.c237
-rw-r--r--src/H5BT.c1016
-rw-r--r--src/H5BTbtree2.c218
-rw-r--r--src/H5BTcache.c331
-rw-r--r--src/H5BTdbg.c111
-rw-r--r--src/H5BTpkg.h118
-rw-r--r--src/H5BTprivate.h88
-rw-r--r--src/H5BTpublic.h52
-rw-r--r--src/H5BTtest.c142
-rw-r--r--src/H5Cpkg.h2
-rw-r--r--src/H5SH.c337
-rw-r--r--src/H5SHcache.c332
-rw-r--r--src/H5SHdbg.c103
-rw-r--r--src/H5SHpkg.h103
-rw-r--r--src/H5SHprivate.h59
-rw-r--r--src/H5SHpublic.h53
-rwxr-xr-xsrc/Makefile.am9
-rw-r--r--src/Makefile.in40
-rw-r--r--test/Makefile.am4
-rw-r--r--test/Makefile.in82
-rw-r--r--test/b+tree.c210
-rw-r--r--test/blocktrack.c1949
-rw-r--r--test/sheap.c275
-rw-r--r--tools/misc/h5debug.c49
35 files changed, 65 insertions, 7574 deletions
diff --git a/MANIFEST b/MANIFEST
index 0dd204b..4cbd067 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -410,21 +410,6 @@
./src/H5B2private.h
./src/H5B2public.h
./src/H5B2test.c
-./src/H5BP.c
-./src/H5BPcache.c
-./src/H5BPdbg.c
-./src/H5BPpkg.h
-./src/H5BPprivate.h
-./src/H5BPpublic.h
-./src/H5BPtest.c
-./src/H5BT.c
-./src/H5BTbtree2.c
-./src/H5BTcache.c
-./src/H5BTdbg.c
-./src/H5BTpkg.h
-./src/H5BTprivate.h
-./src/H5BTpublic.h
-./src/H5BTtest.c
./src/H5C.c
./src/H5Cpkg.h
./src/H5Cprivate.h
@@ -584,12 +569,6 @@
./src/H5Spublic.h
./src/H5Sselect.c
./src/H5Stest.c
-./src/H5SH.c
-./src/H5SHcache.c
-./src/H5SHdbg.c
-./src/H5SHpkg.h
-./src/H5SHpublic.h
-./src/H5SHprivate.h
./src/H5SL.c
./src/H5SLprivate.h
./src/H5ST.c
@@ -639,10 +618,8 @@
./test/Makefile.am
./test/Makefile.in
-./test/b+tree.c
./test/big.c
./test/bittests.c
-./test/blocktrack.c
./test/btree2.c
./test/cache.c
./test/cache_api.c
@@ -698,7 +675,6 @@
./test/reserved.c
./test/pool.c
./test/set_extent.c
-./test/sheap.c
./test/space_overflow.c _DO_NOT_DISTRIBUTE_
./test/stab.c
./test/stream_test.c
diff --git a/src/H5AC.c b/src/H5AC.c
index 6e814a4..aeb78b6 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -742,10 +742,6 @@ static const char * H5AC_entry_type_names[H5AC_NTYPES] =
"v2 B-tree headers",
"v2 B-tree internal nodes",
"v2 B-tree leaf nodes",
- "block tracker nodes",
- "segmented heaps",
- "B+ tree headers",
- "B+ tree leaves",
"test entry" /* for testing only -- not used for actual files */
};
@@ -768,6 +764,8 @@ H5AC_create(const H5F_t *f,
HDassert ( f );
HDassert ( NULL == f->shared->cache );
HDassert ( config_ptr != NULL ) ;
+ HDassert ( NELMTS(H5AC_entry_type_names) == H5AC_NTYPES);
+ HDassert ( H5C__MAX_NUM_TYPE_IDS == H5AC_NTYPES);
result = H5AC_validate_config(config_ptr);
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index f492556..8f30c28 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -39,20 +39,19 @@
#include "H5Cprivate.h" /* cache */
-#define H5AC_BT_ID 0 /*B-tree nodes */
-#define H5AC_SNODE_ID 1 /*symbol table nodes */
-#define H5AC_LHEAP_ID 2 /*local heap */
-#define H5AC_GHEAP_ID 3 /*global heap */
-#define H5AC_OHDR_ID 4 /*object header */
-#define H5AC_BT2_HDR_ID 5 /*v2 B-tree header */
-#define H5AC_BT2_INT_ID 6 /*v2 B-tree internal node */
-#define H5AC_BT2_LEAF_ID 7 /*v2 B-tree leaf node */
-#define H5AC_BLTR_ID 8 /*block tracker */
-#define H5AC_SHEAP_ID 9 /*segmented heap */
-#define H5AC_BPT_HDR_ID 10 /*B+ tree header */
-#define H5AC_BPT_LEAF_ID 11 /*B+ tree leaf */
-#define H5AC_TEST_ID 12 /*test entry -- not used for actual files */
-#define H5AC_NTYPES 13
+/* Types of metadata objects cached */
+typedef enum {
+ H5AC_BT_ID = 0, /*B-tree nodes */
+ H5AC_SNODE_ID, /*symbol table nodes */
+ H5AC_LHEAP_ID, /*local heap */
+ H5AC_GHEAP_ID, /*global heap */
+ H5AC_OHDR_ID, /*object header */
+ H5AC_BT2_HDR_ID, /*v2 B-tree header */
+ H5AC_BT2_INT_ID, /*v2 B-tree internal node */
+ H5AC_BT2_LEAF_ID, /*v2 B-tree leaf node */
+ H5AC_TEST_ID, /*test entry -- not used for actual files */
+ H5AC_NTYPES /* Number of types, must be last */
+} H5AC_type_t;
/* H5AC_DUMP_STATS_ON_CLOSE should always be FALSE when
* H5C_COLLECT_CACHE_STATS is FALSE.
diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c
index d73cfbc..98abd60 100644
--- a/src/H5B2dbg.c
+++ b/src/H5B2dbg.c
@@ -87,8 +87,7 @@ H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Tree type ID:",
((shared->type->id)==H5B2_TEST_ID ? "H5B2_TEST_ID" :
- ((shared->type->id)==H5B2_BLK_TRK_ID ? "H5B2_BLK_TRK_ID" :
- "Unknown!")));
+ "Unknown!"));
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Size of node:",
shared->node_size);
@@ -212,8 +211,7 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Tree type ID:",
((shared->type->id)==H5B2_TEST_ID ? "H5B2_TEST_ID" :
- ((shared->type->id)==H5B2_BLK_TRK_ID ? "H5B2_BLK_TRK_ID" :
- "Unknown!")));
+ "Unknown!"));
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Size of node:",
shared->node_size);
@@ -331,8 +329,7 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Tree type ID:",
((shared->type->id)==H5B2_TEST_ID ? "H5B2_TEST_ID" :
- ((shared->type->id)==H5B2_BLK_TRK_ID ? "H5B2_BLK_TRK_ID" :
- "Unknown!")));
+ "Unknown!"));
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Size of node:",
shared->node_size);
diff --git a/src/H5B2private.h b/src/H5B2private.h
index 850eb50..537921f 100644
--- a/src/H5B2private.h
+++ b/src/H5B2private.h
@@ -52,7 +52,6 @@
/* B-tree IDs for various internal things. */
typedef enum H5B2_subid_t {
H5B2_TEST_ID = 0, /* B-tree is for testing (do not use for actual data) */
- H5B2_BLK_TRK_ID, /* B-tree is for block tracker records */
H5B2_NUM_BTREE_ID /* Number of B-tree IDs (must be last) */
} H5B2_subid_t;
diff --git a/src/H5BP.c b/src/H5BP.c
deleted file mode 100644
index e01ab28..0000000
--- a/src/H5BP.c
+++ /dev/null
@@ -1,471 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*-------------------------------------------------------------------------
- *
- * Created: H5BP.c
- * Apr 14 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
- *
- * Purpose: Implements a B+ tree, with several modifications from
- * the "standard" methods.
- *
- * Please see the documentation in:
- * doc/html/TechNotes/Btrees.html for a full description
- * of how they work, etc.
- *
- *-------------------------------------------------------------------------
- */
-
-#define H5BP_PACKAGE /*suppress error about including H5BPpkg */
-
-/* Private headers */
-#include "H5private.h" /* Generic Functions */
-#include "H5BPpkg.h" /* B+ trees */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
-
-/* Local macros */
-
-/* Uncomment this macro to enable extra sanity checking */
-/* #define H5BP_DEBUG */
-
-
-/* Local typedefs */
-
-/* Local prototypes */
-
-/* Helper functions */
-
-
-/* Package variables */
-
-/* Declare a free list to manage the H5BP_t struct */
-H5FL_DEFINE(H5BP_t);
-
-/* Declare a free list to manage the H5BP_branch_t struct */
-H5FL_DEFINE(H5BP_branch_t);
-
-/* Declare a free list to manage the H5BP_twig_t struct */
-H5FL_DEFINE(H5BP_twig_t);
-
-/* Declare a free list to manage the H5BP_leaf_t struct */
-H5FL_DEFINE(H5BP_leaf_t);
-
-
-/* Static variables */
-
-/* Declare a free list to manage B-tree node pages to/from disk */
-H5FL_BLK_DEFINE_STATIC(node_page);
-
-/* Declare a free list to manage the H5BP_shared_t struct */
-H5FL_DEFINE_STATIC(H5BP_shared_t);
-
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_shared_init
- *
- * Purpose: Allocate & initialize shared B-tree info
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Apr 14 2005
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5BP_shared_init (H5BP_t *bpt, const H5BP_class_t *type,
- size_t node_size, unsigned split_percent, unsigned merge_percent)
-{
- H5BP_shared_t *shared = NULL; /* Shared B+ tree information */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT(H5BP_shared_init)
-
- /* Allocate space for the shared information */
- if(NULL==(shared = H5FL_CALLOC(H5BP_shared_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B+ tree shared information")
-
- /* Assign user's information */
- shared->split_percent = split_percent;
- shared->merge_percent = merge_percent;
- shared->node_size = node_size;
-
- /* Assign common type information */
- shared->type = type;
-
- /* Allocate "page" for node I/O */
- if((shared->page=H5FL_BLK_MALLOC(node_page,shared->node_size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
-#ifdef H5_USING_PURIFY
-HDmemset(shared->page,0,shared->node_size);
-#endif /* H5_USING_PURIFY */
-
- /* Make shared B-tree info reference counted */
- if(NULL==(bpt->shared=H5RC_create(shared,H5BP_shared_free)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B+ tree info")
-
-done:
- if(ret_value<0)
- if(shared)
- H5BP_shared_free(shared);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5BP_shared_init() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_shared_free
- *
- * Purpose: Free shared B+ tree info
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Apr 14 2005
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5BP_shared_free (void *_shared)
-{
- H5BP_shared_t *shared = (H5BP_shared_t *)_shared;
- herr_t ret_value=SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BP_shared_free)
-
- /* Sanity check */
- HDassert(shared);
-
- /* Free the B-tree node buffer */
- if(shared->page)
- H5FL_BLK_FREE(node_page,shared->page);
-
- /* Free the shared B-tree info itself */
- H5FL_FREE(H5BP_shared_t,shared);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5BP_shared_free() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_create
- *
- * Purpose: Creates a new empty B+ tree in the file.
- *
- * Return: Non-negative on success (with address of new B-tree
- * filled in), negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Apr 19 2005
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5BP_create(H5F_t *f, hid_t dxpl_id, const H5BP_class_t *type,
- size_t node_size, unsigned split_percent, unsigned merge_percent,
- haddr_t *addr_p)
-{
- H5BP_t *bpt = NULL; /* The new B+ tree header information */
- herr_t ret_value=SUCCEED;
-
- FUNC_ENTER_NOAPI(H5BP_create, FAIL)
-
- /*
- * Check arguments.
- */
- HDassert(f);
- HDassert(type);
- HDassert(node_size>0);
- HDassert(merge_percent>0 && merge_percent<=100);
- HDassert(split_percent>0 && split_percent<=100);
- HDassert(merge_percent<(split_percent/2));
-
- /*
- * Allocate file and memory data structures.
- */
- if (NULL==(bpt = H5FL_MALLOC(H5BP_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree header")
-
- /* Assign internal information */
- HDmemset(&bpt->cache_info,0,sizeof(H5AC_info_t));
- bpt->cache_info.is_dirty = TRUE;
- bpt->depth = 0;
- bpt->root.addr = HADDR_UNDEF;
- bpt->root.all_nrec = 0;
- bpt->root.util = 0;
-
- /* Initialize shared B-tree info */
- if(H5BP_shared_init(bpt, type, node_size, split_percent, merge_percent)<0)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create shared B+ tree info")
-
- /* Allocate space for the header on disk */
- if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)H5BP_HEADER_SIZE(f))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree header")
-
- /* Cache the new B-tree node */
- if (H5AC_set(f, dxpl_id, H5AC_BPT_HDR, *addr_p, bpt, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B+ tree header to cache")
-
-done:
- if (ret_value<0) {
- if (bpt)
- (void)H5BP_cache_hdr_dest(f,bpt);
- } /* end if */
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5BP_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_create_leaf
- *
- * Purpose: Creates empty leaf node of a B+ tree and updates node pointer
- * to point to it.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Apr 19 2005
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5BP_create_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bpt_shared, H5BP_node_ptr_t *node_ptr)
-{
- H5BP_leaf_t *leaf=NULL; /* Pointer to new leaf node created */
- H5BP_shared_t *shared; /* Shared B+ tree information */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(H5BP_create_leaf, FAIL)
-
- /* Check arguments. */
- HDassert(f);
- HDassert(bpt_shared);
- HDassert(node_ptr);
-
- /* Allocate memory for leaf information */
- if (NULL==(leaf = H5FL_MALLOC(H5BP_leaf_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B+ tree leaf info")
-
- /* Set metadata cache info */
- HDmemset(&leaf->cache_info,0,sizeof(H5AC_info_t));
- leaf->cache_info.is_dirty = TRUE;
-
- /* Share common B+ tree information */
- leaf->shared = bpt_shared;
- H5RC_INC(leaf->shared);
-
- /* Get the pointer to the shared B-tree info */
- shared=H5RC_GET_OBJ(leaf->shared);
- HDassert(shared);
-
- /* Create record pool for leaf node */
- if((leaf->rec_pool = H5MP_create(H5BP_LEAF_POOL_PAGE, H5MP_FLG_DEFAULT)) == NULL)
- HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "can't allocate memory pool")
-
- /* Set number of records */
- leaf->nrec=0;
- leaf->flags=0;
-
- /* Allocate space on disk for the leaf */
- if (HADDR_UNDEF==(node_ptr->addr=H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)shared->node_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B+ tree leaf node")
-
- /* Cache the new B+ tree node */
- if (H5AC_set(f, dxpl_id, H5AC_BPT_LEAF, node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B+ tree leaf to cache")
-
-done:
- if (ret_value<0) {
- if (leaf)
- (void)H5BP_cache_leaf_dest(f,leaf);
- } /* end if */
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5BP_create_leaf() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_insert_leaf
- *
- * Purpose: Adds a new record to a B+ tree leaf node.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Apr 22 2005
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5BP_insert_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bpt_shared,
- H5BP_node_ptr_t *curr_node_ptr, void *udata)
-{
- H5BP_leaf_t *leaf; /* Pointer to leaf node */
- H5BP_shared_t *shared; /* Pointer to B+ tree's shared information */
-#ifdef LATER
- int cmp; /* Comparison value of records */
- unsigned idx; /* Location of record which matches key */
-#endif /* LATER */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT(H5BP_insert_leaf)
-
- /* Check arguments. */
- HDassert(f);
- HDassert(bpt_shared);
- HDassert(curr_node_ptr);
- HDassert(H5F_addr_defined(curr_node_ptr->addr));
-
-if( H5BP_NODE_OVERSIZE(curr_node_ptr->util)) {
- HDfprintf(stderr,"%s: attempting to insert record into extent node\n",FUNC);
- HGOTO_ERROR(H5E_BTREE, H5E_UNSUPPORTED, FAIL, "Can't handle extent node!")
-}
- /* Lock B+ tree node */
- if (NULL == (leaf = H5AC_protect(f, dxpl_id, H5AC_BPT_LEAF, curr_node_ptr->addr, &(curr_node_ptr->util), bpt_shared, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B+ tree leaf node")
-
- /* Get the pointer to the shared B+ tree info */
- shared=H5RC_GET_OBJ(bpt_shared);
- HDassert(shared);
-
-#ifndef LATER
-HDfprintf(stderr,"%s: finish record insertion code\n",FUNC);
-HGOTO_ERROR(H5E_BTREE, H5E_UNSUPPORTED, FAIL, "Can't handle record insertion!")
-#else /* LATER */
- /* Check for inserting into empty leaf */
- if(leaf->nrec==0)
- idx=0;
- else {
- /* Find correct location to insert this record */
- if((cmp = H5BP_locate_record(shared->type,leaf->nrec,shared->nat_off,leaf->leaf_native,udata,&idx)) == 0)
- HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B+ tree")
- if(cmp > 0)
- idx++;
-
- /* Make room for new record */
- if(idx<leaf->nrec)
- HDmemmove(H5BP_LEAF_NREC(leaf,shared,idx+1),H5BP_LEAF_NREC(leaf,shared,idx),shared->type->nrec_size*(leaf->nrec-idx));
- } /* end else */
-
- /* Make callback to store record in native form */
- if((shared->type->store)(H5BP_LEAF_NREC(leaf,shared,idx),udata)<0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into leaf node")
-#endif /* LATER */
-
- /* Update record count for node pointer to current node */
- curr_node_ptr->all_nrec++;
-
- /* Update record count for current node */
- leaf->nrec++;
-
-done:
- /* Release the B+ tree leaf node */
- if (leaf && H5AC_unprotect(f, dxpl_id, H5AC_BPT_LEAF, curr_node_ptr->addr, leaf, H5AC__DIRTIED_FLAG) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B+ tree node")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5BP_insert_leaf() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_insert
- *
- * Purpose: Adds a new record to the B+ tree.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Apr 19 2005
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5BP_insert(H5F_t *f, hid_t dxpl_id, const H5BP_class_t *type, haddr_t addr,
- void *udata)
-{
- H5BP_t *bpt=NULL; /* Pointer to the B+ tree header */
- H5BP_shared_t *shared; /* Pointer to B+ tree's shared information */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(H5BP_insert, FAIL)
-
- /* Check arguments. */
- HDassert(f);
- HDassert(type);
- HDassert(H5F_addr_defined(addr));
-
- /* Look up the B+ tree header */
- if (NULL == (bpt = H5AC_protect(f, dxpl_id, H5AC_BPT_HDR, addr, type, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B+ tree header")
-
- /* Get the pointer to the shared B+ tree info */
- shared=H5RC_GET_OBJ(bpt->shared);
- HDassert(shared);
-
- /* Check if the root node is allocated yet */
- if(!H5F_addr_defined(bpt->root.addr)) {
- /* Create root node as leaf node in B+ tree */
- if(H5BP_create_leaf(f, dxpl_id, bpt->shared, &(bpt->root))<0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create root node")
-
- /* Mark B+ tree header as dirty, since we updated the address of the root node */
- bpt->cache_info.is_dirty = TRUE;
- } /* end if */
- /* Check if we need to split the root node (equiv. to a 1->2 leaf node split) */
- else if(H5BP_NODE_OVERSIZE(bpt->root.util) ||
- (!H5BP_NODE_OVERSIZE(bpt->root.util) && bpt->root.util>=shared->split_percent)) {
- /* Split root node */
-#ifdef LATER
- if(H5BP_split_root(f, dxpl_id, bpt, bpt->shared)<0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split root node")
-#else /* LATER */
-HDfprintf(stderr,"%s: attempting to split root node\n",FUNC);
-HGOTO_ERROR(H5E_BTREE, H5E_UNSUPPORTED, FAIL, "Can't split root yet!")
-#endif /* LATER */
- } /* end if */
-
- /* Attempt to insert record into B+ tree */
- if(bpt->depth>0) {
-#ifdef LATER
- if(H5BP_insert_internal(f,dxpl_id,bpt->shared,bpt->depth,&(bpt->cache_info),&bpt->root,udata)<0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B+ tree internal node")
-#else /* LATER */
-HDfprintf(stderr,"%s: attempting to insert record with internal node\n",FUNC);
-HGOTO_ERROR(H5E_BTREE, H5E_UNSUPPORTED, FAIL, "Can't insert records yet!")
-#endif /* LATER */
- } /* end if */
- else {
- if(H5BP_insert_leaf(f,dxpl_id,bpt->shared,&bpt->root,udata)<0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B+ tree leaf node")
- } /* end else */
-
-done:
- /* Release the B+ tree header info */
- if (bpt && H5AC_unprotect(f, dxpl_id, H5AC_BPT_HDR, addr, bpt, H5AC__DIRTIED_FLAG) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B+ tree header info")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5BP_insert() */
-
diff --git a/src/H5BPcache.c b/src/H5BPcache.c
deleted file mode 100644
index 4580c38..0000000
--- a/src/H5BPcache.c
+++ /dev/null
@@ -1,710 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*-------------------------------------------------------------------------
- *
- * Created: H5BPcache.c
- * Apr 19 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
- *
- * Purpose: Implement B+ tree metadata cache methods.
- *
- *-------------------------------------------------------------------------
- */
-
-#define H5BP_PACKAGE /*suppress error about including H5BPpkg */
-
-/* Private headers */
-#include "H5private.h" /* Generic Functions */
-#include "H5BPpkg.h" /* B+ trees */
-#include "H5Eprivate.h" /* Error handling */
-
-/* Local macros */
-
-/* B+ tree format version #'s */
-#define H5BP_HDR_VERSION 0 /* Header */
-#define H5BP_LEAF_VERSION 0 /* Leaf nodes */
-
-
-/* Local typedefs */
-
-/* Local prototypes */
-
-/* Metadata cache callbacks */
-static H5BP_t *H5BP_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata);
-static herr_t H5BP_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5BP_t *b);
-static herr_t H5BP_cache_hdr_clear(H5F_t *f, H5BP_t *b, hbool_t destroy);
-static herr_t H5BP_cache_hdr_size(const H5F_t *f, const H5BP_t *bt, size_t *size_ptr);
-static H5BP_leaf_t *H5BP_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *_bpt_shared);
-static herr_t H5BP_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5BP_leaf_t *l);
-static herr_t H5BP_cache_leaf_clear(H5F_t *f, H5BP_leaf_t *l, hbool_t destroy);
-static herr_t H5BP_cache_leaf_size(const H5F_t *f, const H5BP_leaf_t *l, size_t *size_ptr);
-
-/* Package variables */
-
-/* H5BP headers inherit cache-like properties from H5AC */
-const H5AC_class_t H5AC_BPT_HDR[1] = {{
- H5AC_BPT_HDR_ID,
- (H5AC_load_func_t)H5BP_cache_hdr_load,
- (H5AC_flush_func_t)H5BP_cache_hdr_flush,
- (H5AC_dest_func_t)H5BP_cache_hdr_dest,
- (H5AC_clear_func_t)H5BP_cache_hdr_clear,
- (H5AC_size_func_t)H5BP_cache_hdr_size,
-}};
-
-/* H5BP leaves inherit cache-like properties from H5AC */
-const H5AC_class_t H5AC_BPT_LEAF[1] = {{
- H5AC_BPT_LEAF_ID,
- (H5AC_load_func_t)H5BP_cache_leaf_load,
- (H5AC_flush_func_t)H5BP_cache_leaf_flush,
- (H5AC_dest_func_t)H5BP_cache_leaf_dest,
- (H5AC_clear_func_t)H5BP_cache_leaf_clear,
- (H5AC_size_func_t)H5BP_cache_leaf_size,
-}};
-
-/* Static variables */
-
-/* Declare a free list to manage B+ tree header data to/from disk */
-H5FL_BLK_DEFINE_STATIC(header_block);
-
-/* Declare a free list to manage 'void *' array data */
-typedef void *voidp;
-H5FL_SEQ_DEFINE_STATIC(voidp);
-
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_cache_hdr_load
- *
- * Purpose: Loads a B+ tree header from the disk.
- *
- * Return: Success: Pointer to a new B+ tree.
- *
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Apr 19 2005
- *
- *-------------------------------------------------------------------------
- */
-static H5BP_t *
-H5BP_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void UNUSED *udata)
-{
- const H5BP_class_t *type = (const H5BP_class_t *) _type;
- size_t node_size; /* Size info for B+ tree */
- unsigned split_percent, merge_percent; /* Split & merge info for B+ tree */
- H5BP_t *bpt = NULL;
- size_t size;
- uint8_t *buf = NULL;
- uint8_t *p; /* Pointer into raw data buffer */
- H5BP_t *ret_value;
-
- FUNC_ENTER_NOAPI(H5BP_cache_hdr_load, NULL)
-
- /* Check arguments */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
- HDassert(type);
-
- if (NULL==(bpt = H5FL_MALLOC(H5BP_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemset(&bpt->cache_info,0,sizeof(H5AC_info_t));
-
- /* Compute the size of the B+ tree header on disk */
- size = H5BP_HEADER_SIZE(f);
-
- /* Allocate temporary buffer */
- if ((buf=H5FL_BLK_MALLOC(header_block,size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
-
- /* Read header from disk */
- if (H5F_block_read(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf)<0)
- HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B+ tree header")
-
- p = buf;
-
- /* magic number */
- if (HDmemcmp(p, H5BP_HDR_MAGIC, H5BP_SIZEOF_MAGIC))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B+ tree header signature")
- p += H5BP_SIZEOF_MAGIC;
-
- /* version */
- if (*p++ != H5BP_HDR_VERSION)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B+ tree header version")
-
- /* B+ tree type */
- if (*p++ != (uint8_t)type->id)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "incorrect B+ tree type")
-
- /* node size (in bytes) */
- UINT32DECODE(p, node_size);
-
- /* depth of tree */
- UINT16DECODE(p, bpt->depth);
-
- /* split & merge %s */
- UINT16DECODE(p, split_percent);
- UINT16DECODE(p, merge_percent);
-
- /* root node pointer */
- H5F_addr_decode(f, (const uint8_t **)&p, &(bpt->root.addr));
- H5F_DECODE_LENGTH(f, p, bpt->root.all_nrec);
- bpt->root.util = *p++;
-
- /* Initialize shared B+ tree info */
- if(H5BP_shared_init(bpt, type, node_size, split_percent, merge_percent)<0)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "can't create shared B+ tree info")
-
- /* Set return value */
- ret_value = bpt;
-
-done:
- if(buf)
- H5FL_BLK_FREE(header_block,buf);
- if (!ret_value && bpt)
- (void)H5BP_cache_hdr_dest(f,bpt);
- FUNC_LEAVE_NOAPI(ret_value)
-} /*lint !e818 Can't make udata a pointer to const */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_cache_hdr_flush
- *
- * Purpose: Flushes a dirty B+ tree header to disk.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Apr 19 2005
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5BP_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5BP_t *bpt)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5BP_cache_hdr_flush, FAIL)
-
- /* check arguments */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
- HDassert(bpt);
-
- if (bpt->cache_info.is_dirty) {
- H5BP_shared_t *shared; /* Shared B+ tree information */
- uint8_t *buf = NULL;
- uint8_t *p; /* Pointer into raw data buffer */
- size_t size;
-
- /* Get the pointer to the shared B+ tree info */
- shared=H5RC_GET_OBJ(bpt->shared);
- HDassert(shared);
-
- /* Compute the size of the B+ tree header on disk */
- size = H5BP_HEADER_SIZE(f);
-
- /* Allocate temporary buffer */
- if ((buf=H5FL_BLK_MALLOC(header_block,size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
-
- p = buf;
-
- /* magic number */
- HDmemcpy(p, H5BP_HDR_MAGIC, H5BP_SIZEOF_MAGIC);
- p += H5BP_SIZEOF_MAGIC;
-
- /* version # */
- *p++ = H5BP_HDR_VERSION;
-
- /* B+ tree type */
- *p++ = shared->type->id;
-
- /* node size (in bytes) */
- UINT32ENCODE(p, shared->node_size);
-
- /* depth of tree */
- UINT16ENCODE(p, bpt->depth);
-
- /* split & merge %s */
- UINT16ENCODE(p, shared->split_percent);
- UINT16ENCODE(p, shared->merge_percent);
-
- /* root node pointer */
- H5F_addr_encode(f, &p, bpt->root.addr);
- H5F_ENCODE_LENGTH(f, p, bpt->root.all_nrec);
- *p++ = bpt->root.util;
-
- /* Write the B+ tree header. */
- if (H5F_block_write(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B+ tree header to disk")
-
- H5FL_BLK_FREE(header_block,buf);
-
- bpt->cache_info.is_dirty = FALSE;
- } /* end if */
-
- if (destroy)
- if (H5BP_cache_hdr_dest(f, bpt) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B+ tree header")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5BP_cache_hdr_flush() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_cache_hdr_dest
- *
- * Purpose: Destroys a B+ tree header in memory.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Apr 19 2005
- *
- *-------------------------------------------------------------------------
- */
-/* ARGSUSED */
-herr_t
-H5BP_cache_hdr_dest(H5F_t UNUSED *f, H5BP_t *bpt)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BP_cache_hdr_dest)
-
- /*
- * Check arguments.
- */
- HDassert(bpt);
-
- /* Decrement reference count on shared B+ tree info */
- if(bpt->shared)
- H5RC_DEC(bpt->shared);
-
- /* Free B+ tree header info */
- H5FL_FREE(H5BP_t,bpt);
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5BP_cache_hdr_dest() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_cache_hdr_clear
- *
- * Purpose: Mark a B+ tree header in memory as non-dirty.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Apr 19 2005
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5BP_cache_hdr_clear(H5F_t *f, H5BP_t *bpt, hbool_t destroy)
-{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT(H5BP_cache_hdr_clear)
-
- /*
- * Check arguments.
- */
- HDassert(bpt);
-
- /* Reset the dirty flag. */
- bpt->cache_info.is_dirty = FALSE;
-
- if (destroy)
- if (H5BP_cache_hdr_dest(f, bpt) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B+ tree header")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5BP_cache_hdr_clear() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_cache_hdr_size
- *
- * Purpose: Compute the size in bytes of a B+ tree header
- * on disk, and return it in *size_ptr. On failure,
- * the value of *size_ptr is undefined.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Apr 19 2005
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5BP_cache_hdr_size(const H5F_t *f, const H5BP_t UNUSED *bpt, size_t *size_ptr)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BP_cache_hdr_size)
-
- /* check arguments */
- HDassert(f);
- HDassert(size_ptr);
-
- /* Set size value */
- *size_ptr = H5BP_HEADER_SIZE(f);
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5BP_cache_hdr_size() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_cache_leaf_load
- *
- * Purpose: Loads a B+ tree leaf from the disk.
- *
- * Return: Success: Pointer to a new B+ tree leaf node.
- *
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Apr 19 2005
- *
- *-------------------------------------------------------------------------
- */
-static H5BP_leaf_t *
-H5BP_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *_bpt_shared)
-{
- const unsigned char *nrec = (const unsigned char *)_nrec;
- H5RC_t *bpt_shared=(H5RC_t *)_bpt_shared; /* Shared B+ tree information */
- H5BP_shared_t *shared; /* Shared B+ tree information */
- H5BP_leaf_t *leaf = NULL; /* Pointer to new leaf */
- uint8_t *p; /* Pointer into raw data buffer */
- size_t rec_size; /* Size of records */
- unsigned u; /* Local index variable */
- H5BP_leaf_t *ret_value;
-
- FUNC_ENTER_NOAPI(H5BP_cache_leaf_load, NULL)
-
- /* Check arguments */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
- HDassert(bpt_shared);
-
- if (NULL==(leaf = H5FL_MALLOC(H5BP_leaf_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemset(&leaf->cache_info,0,sizeof(H5AC_info_t));
-
- /* Share common B+ tree information */
- leaf->shared = bpt_shared;
- H5RC_INC(leaf->shared);
-
- /* Get the pointer to the shared B+ tree info */
- shared=H5RC_GET_OBJ(leaf->shared);
- HDassert(shared);
-
- /* Check if we can use existing buffer for node */
- /* Read header from disk */
- if (H5F_block_read(f, H5FD_MEM_BTREE, addr, shared->node_size, dxpl_id, shared->page)<0)
- HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B+ tree leaf node")
-
- p = shared->page;
-
- /* magic number */
- if (HDmemcmp(p, H5BP_LEAF_MAGIC, H5BP_SIZEOF_MAGIC))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B+ tree leaf node signature")
- p += H5BP_SIZEOF_MAGIC;
-
- /* version */
- if (*p++ != H5BP_LEAF_VERSION)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B+ tree leaf node version")
-
- /* B+ tree type */
- if (*p++ != (uint8_t)shared->type->id)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "incorrect B+ tree type")
-
- /* Set the number of records in the leaf */
- leaf->nrec = *nrec;
-
- /* Get the status flags for the leaf */
- leaf->flags = *p++;
-
- /* Create record pool for leaf node */
- if((leaf->rec_pool = H5MP_create(H5BP_LEAF_POOL_PAGE, H5MP_FLG_DEFAULT)) == NULL)
- HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, NULL, "can't allocate memory pool")
-
- /* Retrieve variable-length record information, if present */
- if(H5BP_LEAF_REC_VARLEN(leaf->flags)) {
- /* Allocate space for the record pointers */
- if((leaf->rec_ptr = H5FL_SEQ_MALLOC(voidp, leaf->nrec)) == NULL)
- HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, NULL, "can't allocate record pointers for node")
-
- /* Work through the records on disk and insert them into array for node */
- for(u = 0; u < leaf->nrec; u++) {
- size_t rec_len; /* Index of current record */
-
- /* Determine the length of the record */
- UINT16DECODE(p, rec_len);
-
- /* Decode the record */
- if((leaf->rec_ptr[u] = (shared->type->decode)(f, leaf->rec_pool, p, rec_len)) == NULL)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "can't decode B+ tree record")
- p += rec_len;
- } /* end for */
- } /* end if */
- else {
- /* Retrieve the records' size */
- UINT16DECODE(p, rec_size);
-
-HDfprintf(stderr,"%s: attempting to decode fixed-size records from leaf node\n",FUNC);
-HGOTO_ERROR(H5E_BTREE, H5E_UNSUPPORTED, NULL, "Can't decode records yet!")
- } /* end else */
-
- /* Set return value */
- ret_value = leaf;
-
-done:
- if (!ret_value && leaf)
- (void)H5BP_cache_leaf_dest(f,leaf);
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5BP_cache_leaf_load() */ /*lint !e818 Can't make udata a pointer to const */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_cache_leaf_flush
- *
- * Purpose: Flushes a dirty B+ tree leaf node to disk.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Apr 19 2005
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5BP_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5BP_leaf_t *leaf)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5BP_cache_leaf_flush, FAIL)
-
- /* check arguments */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
- HDassert(leaf);
-
- if (leaf->cache_info.is_dirty) {
- H5BP_shared_t *shared; /* Shared B+ tree information */
- uint8_t *p; /* Pointer into raw data buffer */
-#ifdef LATER
- uint8_t *native; /* Pointer to native keys */
- unsigned u; /* Local index variable */
-#endif /* LATER */
-
- /* Get the pointer to the shared B+ tree info */
- shared=H5RC_GET_OBJ(leaf->shared);
- HDassert(shared);
-
- p = shared->page;
-
- /* magic number */
- HDmemcpy(p, H5BP_LEAF_MAGIC, H5BP_SIZEOF_MAGIC);
- p += H5BP_SIZEOF_MAGIC;
-
- /* version # */
- *p++ = H5BP_LEAF_VERSION;
-
- /* B+ tree type */
- *p++ = shared->type->id;
-
- /* status flags */
- *p++ = leaf->flags;
-
- /* Serialize records */
- if(H5BP_LEAF_REC_VARLEN(leaf->flags)) {
- unsigned u; /* Local index */
-
- /* Work through the records in memory and encode them to disk */
- for(u = 0; u < leaf->nrec; u++) {
- size_t rec_len; /* Index of current record */
- uint8_t *tp; /* Temporary pointer into raw data buffer */
-
- /* Save the location for the record length */
- tp = p;
-
- /* Skip over the location for the record length */
- p += 2;
-
- /* Encode the record */
- if((shared->type->encode)(f, leaf->rec_ptr[u], p, &rec_len) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "can't encode B+ tree record")
- assert(rec_len > 0);
- p += rec_len;
-
- /* Encode the record length */
- UINT16ENCODE(tp, rec_len);
- } /* end for */
- } /* end if */
- else {
-HDfprintf(stderr,"%s: attempting to decode fixed-size records from leaf node\n",FUNC);
-HGOTO_ERROR(H5E_BTREE, H5E_UNSUPPORTED, FAIL, "Can't decode records yet!")
- } /* end else */
-
-#ifdef LATER
- /* Serialize records for leaf node */
- native=leaf->leaf_native;
- for(u=0; u<leaf->nrec; u++) {
- /* Encode record */
- if((shared->type->encode)(f,p,native)<0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B+ tree record")
-
- /* Move to next record */
- p += shared->rrec_size;
- native += shared->type->nrec_size;
- } /* end for */
-#endif /* LATER */
-
- /* Write the B+ tree leaf node */
- if (H5F_block_write(f, H5FD_MEM_BTREE, addr, shared->node_size, dxpl_id, shared->page) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B+ tree leaf node to disk")
-
- leaf->cache_info.is_dirty = FALSE;
- } /* end if */
-
- if (destroy)
- if (H5BP_cache_leaf_dest(f,leaf) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B+ tree leaf node")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5BP_cache_leaf_flush() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_cache_leaf_dest
- *
- * Purpose: Destroys a B+ tree leaf node in memory.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Apr 19 2005
- *
- *-------------------------------------------------------------------------
- */
-/* ARGSUSED */
-herr_t
-H5BP_cache_leaf_dest(H5F_t UNUSED *f, H5BP_leaf_t *leaf)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BP_cache_leaf_dest)
-
- /*
- * Check arguments.
- */
- HDassert(leaf);
-
- /* Decrement reference count on shared B+ tree info */
- if(leaf->shared)
- H5RC_DEC(leaf->shared);
-
- /* Release B+ tree leaf node record pointer array */
- H5FL_SEQ_FREE(voidp, leaf->rec_ptr);
-
- /* Release B+ tree leaf node record memory pool */
- H5MP_close(leaf->rec_pool);
-
- /* Free B+ tree leaf node info */
- H5FL_FREE(H5BP_leaf_t, leaf);
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5BP_cache_leaf_dest() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_cache_leaf_clear
- *
- * Purpose: Mark a B+ tree leaf node in memory as non-dirty.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Apr 19 2005
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5BP_cache_leaf_clear(H5F_t *f, H5BP_leaf_t *leaf, hbool_t destroy)
-{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT(H5BP_cache_leaf_clear)
-
- /*
- * Check arguments.
- */
- HDassert(leaf);
-
- /* Reset the dirty flag. */
- leaf->cache_info.is_dirty = FALSE;
-
- if (destroy)
- if (H5BP_cache_leaf_dest(f, leaf) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B+ tree leaf node")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5BP_cache_leaf_clear() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_cache_leaf_size
- *
- * Purpose: Compute the size in bytes of a B+ tree leaf node
- * on disk, and return it in *size_ptr. On failure,
- * the value of *size_ptr is undefined.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Apr 19 2005
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5BP_cache_leaf_size(const H5F_t UNUSED *f, const H5BP_leaf_t *leaf, size_t *size_ptr)
-{
- H5BP_shared_t *shared; /* Shared B+ tree information */
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BP_cache_leaf_size)
-
- /* check arguments */
- HDassert(leaf);
- HDassert(size_ptr);
-
- /* Get the pointer to the shared B+ tree info */
- shared=H5RC_GET_OBJ(leaf->shared);
- HDassert(shared);
-
- /* Set size value */
- *size_ptr = shared->node_size;
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5BP_cache_leaf_size() */
-
diff --git a/src/H5BPdbg.c b/src/H5BPdbg.c
deleted file mode 100644
index 07dd492..0000000
--- a/src/H5BPdbg.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*-------------------------------------------------------------------------
- *
- * Created: H5BPdbg.c
- * Apr 19 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
- *
- * Purpose: Dump debugging information about a B+ tree.
- *
- *-------------------------------------------------------------------------
- */
-
-#define H5BP_PACKAGE /*suppress error about including H5BPpkg */
-
-/* Private headers */
-#include "H5private.h" /* Generic Functions */
-#include "H5BPpkg.h" /* B+ trees */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_hdr_debug
- *
- * Purpose: Prints debugging info about a B+ tree header.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Apr 19 2005
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5BP_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth,
- const H5BP_class_t *type)
-{
- H5BP_t *bpt = NULL;
- H5BP_shared_t *shared; /* Shared B+ tree information */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5BP_hdr_debug, FAIL)
-
- /*
- * Check arguments.
- */
- assert(f);
- assert(H5F_addr_defined(addr));
- assert(stream);
- assert(indent >= 0);
- assert(fwidth >= 0);
-
- /*
- * Load the B+ tree header.
- */
- if (NULL == (bpt = H5AC_protect(f, dxpl_id, H5AC_BPT_HDR, addr, type, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B+ tree header")
-
- /* Get the pointer to the shared B+ tree info */
- shared=H5RC_GET_OBJ(bpt->shared);
- assert(shared);
-
- /*
- * Print the values.
- */
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Tree type ID:",
- (shared->type->id == H5BP_TEST_ID ? "H5BP_TEST_ID" :
- "Unknown!"));
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
- "Size of node:",
- shared->node_size);
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Dirty flag:",
- bpt->cache_info.is_dirty ? "True" : "False");
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Depth:",
- bpt->depth);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
- "Number of records in tree:",
- bpt->root.all_nrec);
- if(H5BP_NODE_OVERSIZE(bpt->root.util))
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Root node size multiplier:",
- (unsigned)(bpt->root.util & 0x7f));
- else
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Root node size utilization:",
- (unsigned)bpt->root.util);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
- "Address of root node:",
- bpt->root.addr);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Split percent:",
- shared->split_percent);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Merge percent:",
- shared->merge_percent);
-
-done:
- if (bpt && H5AC_unprotect(f, dxpl_id, H5AC_BPT_HDR, addr, bpt, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B+ tree header")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5BP_hdr_debug() */
-
diff --git a/src/H5BPpkg.h b/src/H5BPpkg.h
deleted file mode 100644
index 3ec5667..0000000
--- a/src/H5BPpkg.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
- * Thursday, April 14, 2005
- *
- * Purpose: This file contains declarations which are visible only within
- * the H5BP package. Source files outside the H5BP package should
- * include H5BPprivate.h instead.
- */
-#ifndef H5BP_PACKAGE
-#error "Do not include this file outside the H5BP package!"
-#endif
-
-#ifndef _H5BPpkg_H
-#define _H5BPpkg_H
-
-/* Get package's private header */
-#include "H5BPprivate.h"
-
-/* Other private headers needed by this file */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5RCprivate.h" /* Reference counted object functions */
-
-/**************************/
-/* Package Private Macros */
-/**************************/
-
-/* Size of signature information (on disk) */
-#define H5BP_SIZEOF_MAGIC 4
-
-/* B+ tree signatures */
-#define H5BP_HDR_MAGIC "BPHD" /* Header */
-#define H5BP_INT_MAGIC "BPBR" /* Branch node */
-#define H5BP_TWIG_MAGIC "BPTW" /* Twig node */
-#define H5BP_LEAF_MAGIC "BPLF" /* Leaf node */
-#define H5BP_EXTENT_MAGIC "BPEX" /* Extent node */
-
-/* Size of storage for number of separators per node (on disk) */
-#define H5BP_SIZEOF_SEPS_PER_NODE 2
-
-/* Size of storage for "node size multiplier" (on disk) */
-#define H5BP_SIZEOF_NODE_MULT 1
-
-/* Size of a "full" node pointer (on disk) */
-#define H5BP_NODE_POINTER_SIZE(f) (H5F_SIZEOF_ADDR(f)+H5F_SIZEOF_SIZE(f)+H5BP_SIZEOF_NODE_MULT)
-
-/* Size of the B+ tree header on disk */
-#define H5BP_HEADER_SIZE(f) ( \
- 4 + /* Signature */ \
- 1 + /* Version */ \
- 1 + /* Tree type */ \
- 4 + /* Node size, in bytes */ \
- 2 + /* Depth of tree */ \
- 2 + /* Split % of full (as integer, ie. "98" means 98%) */ \
- 2 + /* Merge % of full (as integer, ie. "98" means 98%) */ \
- H5BP_NODE_POINTER_SIZE(f)) /* Node pointer to root node in tree */
-
-/* Determine whether a node is oversized */
-/* The high bit is set in utilization field for oversized nodes */
-#define H5BP_NODE_OVERSIZE(u) ((u) & 0x80)
-
-/* Determine whether a leaf node has variable-length records */
-/* The low bit is set in "flag" field for nodes w/variable-length records */
-#define H5BP_LEAF_REC_VARLEN(u) ((u) & 0x01)
-
-/* Size of memory pool pages for leaf nodes */
-#define H5BP_LEAF_POOL_PAGE H5MP_PAGE_SIZE_DEFAULT
-
-
-/****************************/
-/* Package Private Typedefs */
-/****************************/
-
-/* A "node pointer" to another B+ tree node */
-typedef struct {
- haddr_t addr; /* Address of other node */
- hsize_t all_nrec; /* Number of records in node pointed to and all it's children */
- unsigned char util; /* Percent utilization/page node multiple */
-} H5BP_node_ptr_t;
-
-/* Each B+ tree has certain information that can be shared across all
- * the instances of nodes in that B-tree.
- */
-typedef struct H5BP_shared_t {
- /* Shared internal data structures */
- const H5BP_class_t *type; /* Type of tree */
- uint8_t *page; /* Disk page */
-
- /* Information set by user */
- unsigned split_percent; /* Percent full at which to split the node, when inserting */
- unsigned merge_percent; /* Percent full at which to merge the node, when deleting */
- size_t node_size; /* Size of all nodes, in bytes */
-} H5BP_shared_t;
-
-/* The B+ tree information */
-typedef struct H5BP_t {
- /* Information for H5AC cache functions, _must_ be first field in structure */
- H5AC_info_t cache_info;
-
- /* Internal B+ tree information */
- unsigned depth; /* B+ tree's overall depth */
- H5BP_node_ptr_t root; /* Node pointer to root node in B+ tree */
- H5RC_t *shared; /* Ref-counted shared info */
-} H5BP_t;
-
-/* B+ tree internal branch node information */
-typedef struct H5BP_branch_t {
- /* Information for H5AC cache functions, _must_ be first field in structure */
- H5AC_info_t cache_info;
-
- /* Internal B+ tree information */
- H5RC_t *shared; /* Ref-counted shared info */
- uint8_t *int_native; /* Pointer to native records */
- H5BP_node_ptr_t *node_ptrs; /* Pointer to node pointers */
- unsigned nrec; /* Number of records in node */
-} H5BP_branch_t;
-
-/* B+ tree internal twig node information */
-typedef struct H5BP_twig_t {
- /* Information for H5AC cache functions, _must_ be first field in structure */
- H5AC_info_t cache_info;
-
- /* Internal B+ tree information */
- H5RC_t *shared; /* Ref-counted shared info */
- uint8_t *int_native; /* Pointer to native records */
- H5BP_node_ptr_t *node_ptrs; /* Pointer to node pointers */
- unsigned nrec; /* Number of records in node */
-} H5BP_twig_t;
-
-/* B+ tree leaf node information */
-typedef struct H5BP_leaf_t {
- /* Information for H5AC cache functions, _must_ be first field in structure */
- H5AC_info_t cache_info;
-
- /* Internal B+ tree information */
- H5RC_t *shared; /* Ref-counted shared info */
- H5MP_pool_t *rec_pool; /* Pool containing records for node */
- void **rec_ptr; /* Array of pointers to records in pool */
- unsigned nrec; /* Number of records in node */
- unsigned char flags; /* Status flags for leaf node */
-} H5BP_leaf_t;
-
-#ifdef H5BP_TESTING
-/* Record for testing B+ trees */
-typedef struct {
- hsize_t count;
- char *name;
-} H5BP_test_rec_t;
-#endif /* H5BP_TESTING */
-
-
-/*****************************/
-/* Package Private Variables */
-/*****************************/
-
-/* H5BP header inherits cache-like properties from H5AC */
-H5_DLLVAR const H5AC_class_t H5AC_BPT_HDR[1];
-
-/* H5BP branch node inherits cache-like properties from H5AC */
-H5_DLLVAR const H5AC_class_t H5AC_BPT_BRANCH[1];
-
-/* H5BP twig node inherits cache-like properties from H5AC */
-H5_DLLVAR const H5AC_class_t H5AC_BPT_TWIG[1];
-
-/* H5BP leaf node inherits cache-like properties from H5AC */
-H5_DLLVAR const H5AC_class_t H5AC_BPT_LEAF[1];
-
-/* Declare a free list to manage the H5BP_t struct */
-H5FL_EXTERN(H5BP_t);
-
-/* Declare a free list to manage the H5BP_branch_t struct */
-H5FL_EXTERN(H5BP_branch_t);
-
-/* Declare a free list to manage the H5BP_twig_t struct */
-H5FL_EXTERN(H5BP_twig_t);
-
-/* Declare a free list to manage the H5BP_leaf_t struct */
-H5FL_EXTERN(H5BP_leaf_t);
-
-/* Internal B+ tree testing class */
-#ifdef H5BP_TESTING
-H5_DLLVAR const H5BP_class_t H5BP_TEST[1];
-#endif /* H5BP_TESTING */
-
-
-/******************************/
-/* Package Private Prototypes */
-/******************************/
-H5_DLL herr_t H5BP_shared_free (void *_shared);
-H5_DLL herr_t H5BP_shared_init (H5BP_t *bpt, const H5BP_class_t *type,
- size_t node_size, unsigned split_percent, unsigned merge_percent);
-H5_DLL herr_t H5BP_cache_hdr_dest(H5F_t *f, H5BP_t *bpt);
-H5_DLL herr_t H5BP_cache_leaf_dest(H5F_t UNUSED *f, H5BP_leaf_t *leaf);
-H5_DLL herr_t H5BP_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- FILE *stream, int indent, int fwidth, const H5BP_class_t *type);
-
-#endif /* _H5BPpkg_H */
-
diff --git a/src/H5BPprivate.h b/src/H5BPprivate.h
deleted file mode 100644
index 9921a73..0000000
--- a/src/H5BPprivate.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*-------------------------------------------------------------------------
- *
- * Created: H5BPprivate.h
- * Apr 14 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
- *
- * Purpose: Private header for library accessible B+ tree routines.
- *
- *-------------------------------------------------------------------------
- */
-
-#ifndef _H5BPprivate_H
-#define _H5BPprivate_H
-
-/* Include package's public header */
-#include "H5BPpublic.h"
-
-/* Private headers needed by this file */
-#include "H5Fprivate.h" /* File access */
-#include "H5MPprivate.h" /* Memory Pools */
-
-/**************************/
-/* Library Private Macros */
-/**************************/
-
-
-/****************************/
-/* Library Private Typedefs */
-/****************************/
-
-/* B+ tree IDs for various internal things. */
-typedef enum H5BP_subid_t {
- H5BP_TEST_ID = 0, /* B+ tree is for testing (do not use for actual data) */
- H5BP_NUM_BTREE_ID /* Number of B-tree IDs (must be last) */
-} H5BP_subid_t;
-
-/*
- * Each class of object that can be pointed to by a B+ tree has a
- * variable of this type that contains class variables and methods.
- */
-typedef struct H5BP_class_t {
- H5BP_subid_t id; /*id as found in file*/
-
- /* Copy native application record */
- void * (*copy)(const void *record); /* Copy native record */
-
- /* Compare key */
- herr_t (*compare)(const void *key1, const void *key2); /* Compare two native keys */
-
- /* Encode & decode record values */
- /* (i.e. native application form <-> disk form) */
- herr_t (*raw_len)(const H5F_t *f, const void *record, size_t *len); /* Determine length of raw (disk) form from native form */
- herr_t (*encode)(const H5F_t *f, const uint8_t *native, uint8_t *raw, size_t *rec_len); /* Encode record from native form to disk storage form */
- void * (*decode)(const H5F_t *f, H5MP_pool_t *pool, const uint8_t *raw, size_t rec_len); /* Decode record from disk storage form to native form */
-
- /* Debug record values */
- herr_t (*debug) (FILE *stream, const H5F_t *f, hid_t dxpl_id, /* Print a record for debugging */
- int indent, int fwidth, const void *record, const void *udata);
-
-} H5BP_class_t;
-
-/***************************************/
-/* Library-private Function Prototypes */
-/***************************************/
-H5_DLL herr_t H5BP_create(H5F_t *f, hid_t dxpl_id, const H5BP_class_t *type,
- size_t node_size, unsigned split_percent, unsigned merge_percent,
- haddr_t *addr_p);
-H5_DLL herr_t H5BP_insert(H5F_t *f, hid_t dxpl_id, const H5BP_class_t *type,
- haddr_t addr, void *udata);
-
-#endif /* _H5BPprivate_H */
-
diff --git a/src/H5BPpublic.h b/src/H5BPpublic.h
deleted file mode 100644
index 8f3dd25..0000000
--- a/src/H5BPpublic.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*-------------------------------------------------------------------------
- *
- * Created: H5BPpublic.h
- * Apr 19 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
- *
- * Purpose: Public declarations for the H5BP package.
- *
- *-------------------------------------------------------------------------
- */
-#ifndef _H5BPpublic_H
-#define _H5BPpublic_H
-
-/* Public headers needed by this file */
-#include "H5public.h"
-
-/*****************/
-/* Public Macros */
-/*****************/
-
-/*******************/
-/* Public Typedefs */
-/*******************/
-
-/**********************************/
-/* Public API Function Prototypes */
-/**********************************/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _H5BPpublic_H */
-
-
diff --git a/src/H5BPtest.c b/src/H5BPtest.c
deleted file mode 100644
index 025bdf7..0000000
--- a/src/H5BPtest.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
- * Thursday, April 19, 2005
- *
- * Purpose: B+ tree testing functions.
- */
-
-#define H5BP_PACKAGE /*suppress error about including H5BPpkg */
-#define H5BP_TESTING /*suppress warning about H5BP testing funcs*/
-
-/* Private headers */
-#include "H5private.h" /* Generic Functions */
-#include "H5BPpkg.h" /* B+ trees */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MMprivate.h" /* Memory management */
-
-/* Static Prototypes */
-static void *H5BP_test_copy(const void *rec);
-static herr_t H5BP_test_compare(const void *rec1, const void *rec2);
-static herr_t H5BP_test_raw_len(const H5F_t *f, const void *record, size_t *len);
-static herr_t H5BP_test_encode(const H5F_t *f, const uint8_t *native,
- uint8_t *raw, size_t *rec_len);
-static void *H5BP_test_decode(const H5F_t *f, H5MP_pool_t *pool,
- const uint8_t *raw, size_t rec_len);
-static herr_t H5BP_test_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
- int indent, int fwidth, const void *record, const void *_udata);
-
-/* Package variables */
-const H5BP_class_t H5BP_TEST[1]={{ /* B+ tree class information */
- H5BP_TEST_ID, /* Type of B+ tree */
- H5BP_test_copy, /* Record copy callback */
- H5BP_test_compare, /* Record comparison callback */
- H5BP_test_raw_len, /* Record 'raw len' callback */
- H5BP_test_encode, /* Record encoding callback */
- H5BP_test_decode, /* Record decoding callback */
- H5BP_test_debug /* Record debugging callback */
-}};
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_test_copy
- *
- * Purpose: Copy native information record
- *
- * Return: Pointer to new record on success, NULL on failure
- *
- * Programmer: Quincey Koziol
- * Monday, April 25, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5BP_test_copy(const void *rec)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BP_test_copy)
-
- /* Copy record */
- FUNC_LEAVE_NOAPI(HDstrdup(rec));
-} /* H5BP_test_copy() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_test_compare
- *
- * Purpose: Compare two native information records, according to some key
- *
- * Return: <0 if rec1 < rec2
- * =0 if rec1 == rec2
- * >0 if rec1 > rec2
- *
- * Programmer: Quincey Koziol
- * Tuesday, April 19, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5BP_test_compare(const void *rec1, const void *rec2)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BP_test_compare)
-
- FUNC_LEAVE_NOAPI(HDstrcmp(*(const char **)rec1, *(const char **)rec2));
-} /* H5BP_test_compare() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_test_raw_len
- *
- * Purpose: Determine the length of the raw form of a record
- *
- * Return: <0 if rec1 < rec2
- * =0 if rec1 == rec2
- * >0 if rec1 > rec2
- *
- * Programmer: Quincey Koziol
- * Tuesday, April 19, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5BP_test_raw_len(const H5F_t UNUSED *f, const void *record, size_t *len)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BP_test_raw_len)
-
- *len = HDstrlen((const char *)record);
-
- FUNC_LEAVE_NOAPI(SUCCEED);
-} /* H5BP_test_raw_len() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_test_encode
- *
- * Purpose: Encode native information into raw form for storing on disk
- *
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Tuesday, April 19, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5BP_test_encode(const H5F_t *f, const uint8_t *native, uint8_t *raw, size_t *rec_len)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BP_test_encode)
-
- /* Sanity check */
- HDassert(f);
- HDassert(native);
- HDassert(raw);
- HDassert(rec_len);
-
- /* Get the record length */
- *rec_len = HDstrlen((const char *)native);
-
- /* "Encode" the record */
- HDmemcpy(raw, native, *rec_len);
-
- FUNC_LEAVE_NOAPI(SUCCEED);
-} /* H5BP_test_encode() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_test_decode
- *
- * Purpose: Decode raw disk form of record into native form
- *
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Tuesday, April 19, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5BP_test_decode(const H5F_t *f, H5MP_pool_t *pool, const uint8_t *raw, size_t rec_len)
-{
- void *ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT(H5BP_test_decode)
-
- /* Sanity check */
- HDassert(f);
- HDassert(pool);
- HDassert(raw);
- HDassert(rec_len > 0);
-
- /* Allocate space for the record */
- if((ret_value = H5MP_malloc(pool, rec_len + 1)) == NULL)
- HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, NULL, "Can't allocate space for record")
-
- /* "Decode" the record */
- HDmemcpy(ret_value, raw, rec_len);
- *((unsigned char *)ret_value + rec_len) = '\0';
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5BP_test_decode() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BP_test_debug
- *
- * Purpose: Debug native form of record
- *
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Tuesday, April 19, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5BP_test_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, int fwidth,
- const void *record, const void UNUSED *_udata)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BP_test_debug)
-
- HDassert (record);
-
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Record:",
- *(const char *)record);
-
- FUNC_LEAVE_NOAPI(SUCCEED);
-} /* H5BP_test_debug() */
-
diff --git a/src/H5BT.c b/src/H5BT.c
deleted file mode 100644
index 84d13dc..0000000
--- a/src/H5BT.c
+++ /dev/null
@@ -1,1016 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*-------------------------------------------------------------------------
- *
- * Created: H5BT.c
- * Mar 9 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
- *
- * Purpose: Tracks blocks of bytes in a file
- *
- *-------------------------------------------------------------------------
- */
-
-#define H5BT_PACKAGE /*suppress error about including H5BTpkg */
-
-/* Private headers */
-#include "H5private.h" /* Generic Functions */
-#include "H5BTpkg.h" /* Block tracker */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MFprivate.h" /* File memory management */
-
-/* Local macros */
-
-/* v2 B-tree settings */
-#define H5BT_BT2_NODE_SIZE 512
-#define H5BT_BT2_RREC_SIZE(f) (H5F_SIZEOF_ADDR(f) + H5F_SIZEOF_SIZE(f)) /* Offset & length of block tracked */
-#define H5BT_BT2_SPLIT_PERC 100
-#define H5BT_BT2_MERGE_PERC 40
-
-/* Local typedefs */
-
-/* Struct for locating blocks */
-typedef struct {
- hsize_t search_size; /* Size of block to search for */
- H5BT_blk_info_t found; /* Information for block found */
-} H5BT_locate_t;
-
-/* Local prototypes */
-
-/* Package variables */
-
-/* Declare a free list to manage the H5BT_t struct */
-H5FL_DEFINE(H5BT_t);
-
-/* Static variables */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_create
- *
- * Purpose: Creates a new empty block tracker in the file.
- *
- * Return: Non-negative on success (with address of new block tracker
- * filled in), negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 10 2005
- *
- * Modifications:
- *
- *
- * John Mainzer 6/8/05
- * Removed code setting the is_dirty field of the cache info.
- * This is no longer pemitted, as the cache code is now
- * manageing this field. Since this function uses a call to
- * H5AC_set() (which marks the entry dirty automaticly), no
- * other change is required.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5BT_create(H5F_t *f, hid_t dxpl_id, haddr_t *addr_p)
-{
- H5BT_t *bt = NULL; /* The new B-tree header information */
- herr_t ret_value=SUCCEED;
-
- FUNC_ENTER_NOAPI(H5BT_create, FAIL)
-
- /*
- * Check arguments.
- */
- HDassert(f);
-
- /*
- * Allocate file and memory data structures.
- */
- if (NULL==(bt = H5FL_CALLOC(H5BT_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for block tracker info")
-
- /* Assign internal information */
- bt->max_block_size = 0; /* Indicate that the value is invalid */
- bt->min_block_size = HSIZET_MAX; /* Indicate that the value is invalid */
-
- /* Allocate space for the header on disk */
- if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_BLKTRK, dxpl_id, (hsize_t)H5BT_SIZE(f))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for block tracker info")
-
- /* Create a B-tree for storing the block info records */
- if (H5B2_create(f, dxpl_id, H5B2_BLKTRK, H5BT_BT2_NODE_SIZE, H5BT_BT2_RREC_SIZE(f), H5BT_BT2_SPLIT_PERC, H5BT_BT2_MERGE_PERC, &bt->bt2_addr/*out*/)<0)
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTINIT, FAIL, "can't create B-tree for storing block info")
-
- /* Cache the new block tracker node */
- if (H5AC_set(f, dxpl_id, H5AC_BLTR, *addr_p, bt, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTINIT, FAIL, "can't add block tracker info to cache")
-
-done:
- if (ret_value<0) {
- if (bt)
- (void)H5BT_cache_dest(f,bt);
- } /* end if */
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5BT_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_insert_neighbor_cb
- *
- * Purpose: v2 B-tree neighbor callback for H5BT_insert()
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Thursday, March 10, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5BT_insert_neighbor_cb(const void *_record, void *_op_data)
-{
- const H5BT_blk_info_t *record = (const H5BT_blk_info_t *)_record;
- H5BT_blk_info_t *search = (H5BT_blk_info_t *)_op_data;
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BT_insert_neighbor_cb)
-
- *search = *record;
-
- FUNC_LEAVE_NOAPI(0)
-} /* end H5BT_insert_neighbor_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_insert_modify_cb
- *
- * Purpose: v2 B-tree modify callback for H5BT_insert()
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Friday, March 11, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5BT_insert_modify_cb(void *_record, void *_op_data, hbool_t *changed)
-{
- H5BT_blk_info_t *record = (H5BT_blk_info_t *)_record;
- H5BT_blk_info_t *modify = (H5BT_blk_info_t *)_op_data;
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BT_insert_modify_cb)
-
- *record = *modify;
- *changed = TRUE;
-
- FUNC_LEAVE_NOAPI(0)
-} /* end H5BT_insert_modify_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_insert
- *
- * Purpose: Insert new block (offset/length) into a block tracker.
- * Duplicate and overlapping blocks are rejected.
- *
- * Return: Non-negative on success, negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 10 2005
- *
- * Modifications:
- *
- * John Mainzer, 6/8/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5BT_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, haddr_t offset, hsize_t length)
-{
- unsigned bt_flags = H5AC__NO_FLAGS_SET;
- H5BT_t *bt = NULL; /* The new B-tree header information */
- H5BT_blk_info_t lower, upper; /* Info for blocks less than & greater than new block */
- hbool_t lower_valid = FALSE, upper_valid = FALSE; /* Lower & upper blocks valid? */
- H5BT_blk_info_t new_block; /* Info for new block */
- hsize_t nblks; /* Number of blocks tracked */
- unsigned merged = 0; /* How many blocks were merged with */
- herr_t ret_value=SUCCEED;
-
- FUNC_ENTER_NOAPI(H5BT_insert, FAIL)
-
- /*
- * Check arguments.
- */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
-
- /* Look up the block tracker header */
- if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BLTR, addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTPROTECT, FAIL, "unable to load block tracker info")
-
- /* Check for block at this address already */
- if (H5B2_find(f, dxpl_id, H5B2_BLKTRK, bt->bt2_addr, &offset, NULL, NULL) >= 0)
- HGOTO_ERROR(H5E_BLKTRK, H5E_EXISTS, FAIL, "block at address already exists")
- /* Clear any errors from H5B2_find() */
- H5E_clear_stack(NULL);
-
- /* Find next block lower than the new block */
- if ( H5B2_neighbor(f, dxpl_id, H5B2_BLKTRK, bt->bt2_addr, H5B2_COMPARE_LESS, &offset, H5BT_insert_neighbor_cb, &lower) >= 0) {
- if ( H5F_addr_overlap(lower.addr, lower.len, offset, length) )
- HGOTO_ERROR(H5E_BLKTRK, H5E_OVERLAPS, FAIL, "new block overlaps existing block")
-
- /* Set flag to indicate lower bound found */
- lower_valid = TRUE;
- } /* end if */
- /* Clear any errors from H5B2_neighbor() */
- H5E_clear_stack(NULL);
-
- /* Find next block higher than the new block */
- if ( H5B2_neighbor(f, dxpl_id, H5B2_BLKTRK, bt->bt2_addr, H5B2_COMPARE_GREATER, &offset, H5BT_insert_neighbor_cb, &upper) >= 0) {
- if ( H5F_addr_overlap(upper.addr, upper.len, offset, length) )
- HGOTO_ERROR(H5E_BLKTRK, H5E_OVERLAPS, FAIL, "new block overlaps existing block")
-
- /* Set flag to indicate upper bound found */
- upper_valid = TRUE;
- } /* end if */
- /* Clear any errors from H5B2_neighbor() */
- H5E_clear_stack(NULL);
-
- /* Check for merged blocks */
- if(lower_valid || upper_valid) {
- H5BT_blk_info_t *old_block=NULL; /* Pointer to info for block merged with */
-
- /* Check if the new block should merge with both the lower & upper blocks */
- if((lower_valid && (lower.addr+lower.len) == offset)
- && (upper_valid && (offset+length) == upper.addr)) {
- /* Delete upper block */
- if(H5B2_remove(f, dxpl_id, H5B2_BLKTRK, bt->bt2_addr, &upper)<0)
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTDELETE, FAIL, "can't remove block")
-
- /* Update existing lower block */
- new_block.addr = lower.addr;
- new_block.len = lower.len + length + upper.len;
- if(H5B2_modify(f, dxpl_id, H5B2_BLKTRK, bt->bt2_addr, &lower, H5BT_insert_modify_cb, &new_block) < 0)
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTMODIFY, FAIL, "can't change block size")
-
- /* Merged with 2 blocks */
- merged = 2;
- } /* end if */
- /* Check if the new block should merge with just the lower block */
- else if(lower_valid && (lower.addr+lower.len) == offset) {
- /* Update existing lower block */
- new_block.addr = lower.addr;
- new_block.len = lower.len + length;
- if(H5B2_modify(f, dxpl_id, H5B2_BLKTRK, bt->bt2_addr, &lower, H5BT_insert_modify_cb, &new_block) < 0)
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTMODIFY, FAIL, "can't change block size")
-
- /* Indicate which block we merged with */
- old_block = &lower;
-
- /* Merged with 1 block */
- merged = 1;
- } /* end else */
- /* Check if the new block should merge with just the upper block */
- else if(upper_valid && (offset+length) == upper.addr) {
- /* Update existing upper block */
- new_block.addr = offset;
- new_block.len = length + upper.len;
- if(H5B2_modify(f, dxpl_id, H5B2_BLKTRK, bt->bt2_addr, &upper, H5BT_insert_modify_cb, &new_block) < 0)
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTMODIFY, FAIL, "can't change block size")
-
- /* Indicate which block we merged with */
- old_block = &upper;
-
- /* Merged with 1 block */
- merged = 1;
- } /* end else */
-
- /* Check for adjusting the block tracking metadata */
- if(merged == 1) {
- /* Check for adjusting the max. block size tracked */
- if(new_block.len > bt->max_block_size) {
- bt->max_block_size = new_block.len;
- bt->max_block_cnt = 1;
- bt_flags |= H5AC__DIRTIED_FLAG;
- } /* end if */
- else if(new_block.len == bt->max_block_size) {
- bt->max_block_cnt++;
- bt_flags |= H5AC__DIRTIED_FLAG;
- }
-
- /* Check for adjusting the min. block size tracked */
- if(old_block->len < bt->min_block_size) {
- /* This should only happen if we don't have full knowledge of all the blocks' sizes */
- HDassert((bt->status & H5BT_STATUS_MIN_VALID) == 0);
-
- if(new_block.len < bt->min_block_size) {
- bt->min_block_size = new_block.len;
- bt->min_block_cnt = 1;
- bt_flags |= H5AC__DIRTIED_FLAG;
- } /* end if */
- } /* end if */
- else if(old_block->len == bt->min_block_size) {
- /* If this was the minimum block, indicate that the min. size
- * is no longer guaranteed valid over the whole set of blocks
- * tracked and use the new block size as the minimum value */
- if(bt->min_block_cnt == 1) {
- bt->min_block_size = new_block.len;
- bt->status &= ~H5BT_STATUS_MIN_VALID;
- bt_flags |= H5AC__DIRTIED_FLAG;
- } /* end if */
- else {
- /* Decrement the ref. count for the min. block size */
- bt->min_block_cnt--;
- bt_flags |= H5AC__DIRTIED_FLAG;
- } /* end else */
- } /* end if */
- } /* end if */
- else if(merged == 2) {
- /* Check for adjusting the max. block size tracked */
- if(new_block.len > bt->max_block_size) {
- bt->max_block_size = new_block.len;
- bt->max_block_cnt = 1;
- bt_flags |= H5AC__DIRTIED_FLAG;
- } /* end if */
- else if(new_block.len == bt->max_block_size) {
- bt->max_block_cnt++;
- bt_flags |= H5AC__DIRTIED_FLAG;
- } /* end else */
-
- /* Check for adjusting the min. block size tracked */
- if(upper.len < bt->min_block_size || lower.len < bt->min_block_size) {
- /* This should only happen if we don't have full knowledge of all the blocks' sizes */
- HDassert((bt->status & H5BT_STATUS_MIN_VALID) == 0);
-
- if(new_block.len < bt->min_block_size) {
- bt->min_block_size = new_block.len;
- bt->min_block_cnt = 1;
- bt_flags |= H5AC__DIRTIED_FLAG;
- } /* end if */
- } /* end if */
- else if(upper.len == bt->min_block_size || lower.len == bt->min_block_size) {
- /* If this was the minimum block, indicate that the min. size
- * is no longer guaranteed valid over the whole set of blocks
- * tracked and use the new block size as the minimum value */
- if(bt->min_block_cnt == 1) {
- bt->min_block_size = new_block.len;
- bt->status &= ~H5BT_STATUS_MIN_VALID;
- bt_flags |= H5AC__DIRTIED_FLAG;
- } /* end if */
- else {
- /* Decrement the ref. count for the min. block size */
- bt->min_block_cnt--;
- bt_flags |= H5AC__DIRTIED_FLAG;
- } /* end else */
- } /* end if */
- } /* end if */
- } /* end if */
-
- /* Insert new block into B-tree, if it wasn't marged already*/
- if(!merged) {
- new_block.addr = offset;
- new_block.len = length;
- if(H5B2_insert(f, dxpl_id, H5B2_BLKTRK, bt->bt2_addr, &new_block) < 0)
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTINSERT, FAIL, "unable to insert block")
-
- /* Update block tracker metadata */
-
- /* Determine the number of blocks being tracked */
- if(H5B2_get_nrec(f, dxpl_id, H5B2_BLKTRK, bt->bt2_addr, &nblks) < 0)
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTINSERT, FAIL, "unable to determine # of blocks")
-
- /* This is the only block tracked so far */
- if(nblks == 1) {
- bt->max_block_size = length;
- bt->max_block_cnt = 1;
- bt->status |= H5BT_STATUS_MAX_VALID;
- bt->min_block_size = length;
- bt->min_block_cnt = 1;
- bt->status |= H5BT_STATUS_MIN_VALID;
- bt_flags |= H5AC__DIRTIED_FLAG;
- } /* end if */
- else {
- /* Update maximum block size */
- if (length > bt->max_block_size) {
- bt->max_block_size = length;
- bt->max_block_cnt = 1;
- bt_flags |= H5AC__DIRTIED_FLAG;
- } /* end if */
- else if (length == bt->max_block_size) {
- bt->max_block_cnt++;
- bt_flags |= H5AC__DIRTIED_FLAG;
- } /* end if */
-
- /* Update minimum block size */
- if (length < bt->min_block_size) {
- bt->min_block_size = length;
- bt->min_block_cnt = 1;
- bt_flags |= H5AC__DIRTIED_FLAG;
- } /* end if */
- else if (length == bt->min_block_size) {
- bt->min_block_cnt++;
- bt_flags |= H5AC__DIRTIED_FLAG;
- } /* end if */
- } /* end if */
- } /* end if */
-
- /* Increment total number of bytes tracked in all blocks */
- bt->tot_block_size += length;
-
-done:
- /* Release the block tracker info */
- if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_flags) < 0)
- HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5BT_insert() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_get_total_size
- *
- * Purpose: Query the total amount of bytes tracked
- *
- * Return: Non-negative on success, negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 10 2005
- *
- * Modifications:
- *
- * John Mainzer, 6/17/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5BT_get_total_size(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *tot_size)
-{
- H5BT_t *bt = NULL; /* The new B-tree header information */
- herr_t ret_value=SUCCEED;
-
- FUNC_ENTER_NOAPI(H5BT_get_total_size, FAIL)
-
- /*
- * Check arguments.
- */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
- HDassert(tot_size);
-
- /* Look up the block tracker header */
- if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BLTR, addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTPROTECT, FAIL, "unable to load block tracker info")
-
- /* Save total number of bytes tracked in all blocks */
- *tot_size = bt->tot_block_size;
-
-done:
- /* Release the block tracker info */
- if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5BT_get_total_size() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_remove_find_cb
- *
- * Purpose: v2 B-tree find callback
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Friday, March 11, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5BT_remove_find_cb(const void *_record, void *_op_data)
-{
- const H5BT_blk_info_t *record = (const H5BT_blk_info_t *)_record;
- H5BT_blk_info_t *search = (H5BT_blk_info_t *)_op_data;
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BT_remove_find_cb)
-
- /* Copy the data out */
- *search = *record;
-
- FUNC_LEAVE_NOAPI(0);
-} /* end H5BT_remove_find_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_remove
- *
- * Purpose: Remove a block (offset/length) from a block tracker.
- *
- * Return: Non-negative on success, negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 11 2005
- *
- * Modifications:
- *
- * John Mainzer, 6/8/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5BT_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, haddr_t offset, hsize_t length)
-{
- unsigned bt_flags = H5AC__NO_FLAGS_SET;
- H5BT_t *bt = NULL; /* The new B-tree header information */
- H5BT_blk_info_t found; /* Block info found */
- hsize_t nblks; /* Number of blocks tracked */
- herr_t ret_value=SUCCEED;
-
- FUNC_ENTER_NOAPI(H5BT_remove, FAIL)
-
- /*
- * Check arguments.
- */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
-
- /* Look up the block tracker header */
- if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BLTR, addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTPROTECT, FAIL, "unable to load block tracker info")
-
- /* Check for block at this address already */
- if (H5B2_find(f, dxpl_id, H5B2_BLKTRK, bt->bt2_addr, &offset, H5BT_remove_find_cb, &found) < 0) {
- /* Clear any errors from H5B2_find() */
- H5E_clear_stack(NULL);
-
- /* Find next block lower */
-HDfprintf(stderr,"%s: Need to search for lower & upper block!\n",FUNC);
-HGOTO_ERROR(H5E_BLKTRK, H5E_UNSUPPORTED, FAIL, "Couldn't find block to remove")
- } /* end if */
- else {
- /* Found block at address */
-
- /* Check for exact fit */
- if(found.len == length) {
- /* Delete record from B-tree */
- if(H5B2_remove(f, dxpl_id, H5B2_BLKTRK, bt->bt2_addr, &found)<0)
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTDELETE, FAIL, "can't remove block")
-
- /* Determine the number of blocks being tracked */
- if(H5B2_get_nrec(f, dxpl_id, H5B2_BLKTRK, bt->bt2_addr, &nblks) < 0)
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTINSERT, FAIL, "unable to determine # of blocks")
-
- /* Check for no blocks left */
- if(nblks == 0) {
- bt->max_block_size = 0; /* Indicate that the value is invalid */
- bt->max_block_cnt = 0;
- bt->min_block_size = HSIZET_MAX; /* Indicate that the value is invalid */
- bt->min_block_cnt = 0;
- bt->status = 0;
- } /* end if */
- else {
- /* Update max. block metadata */
- if(found.len == bt->max_block_size) {
- /* Decrement maximum block count */
- bt->max_block_cnt--;
-
- /* Check if we don't know the maximum size any longer */
- if(bt->max_block_cnt==0) {
- if(bt->min_block_size < HSIZET_MAX) {
- bt->max_block_size = bt->min_block_size;
- bt->max_block_cnt = bt->min_block_cnt;
- } /* end if */
- else
- bt->max_block_size = 0;
- bt->status &= ~H5BT_STATUS_MAX_VALID;
- } /* end if */
- } /* end if */
-
- /* Update min. block metadata */
- if(found.len == bt->min_block_size) {
- /* Decrement minimum block count */
- bt->min_block_cnt--;
-
- /* Check if we don't know the minimum size any longer */
- if(bt->min_block_cnt==0) {
- if(bt->max_block_size > 0) {
- bt->min_block_size = bt->max_block_size;
- bt->min_block_cnt = bt->max_block_cnt;
- } /* end if */
- else
- bt->min_block_size = HSIZET_MAX;
- bt->status &= ~H5BT_STATUS_MIN_VALID;
- } /* end if */
- } /* end if */
- } /* end else */
-
- /* Decrement total amount of blocks tracked */
- bt->tot_block_size -= length;
-
- /* Flag block tracker info as changed */
- bt_flags |= H5AC__DIRTIED_FLAG;
- } /* end if */
- else if(found.len > length) {
- H5BT_blk_info_t new_block; /* Updated block info */
-
- /* Update existing lower block */
- new_block.addr = found.addr + length;
- new_block.len = found.len - length;
- if(H5B2_modify(f, dxpl_id, H5B2_BLKTRK, bt->bt2_addr, &found, H5BT_insert_modify_cb, &new_block) < 0)
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTMODIFY, FAIL, "can't change block size")
-
- /* Update max. block metadata */
- if(found.len == bt->max_block_size) {
- /* Decrement maximum block count */
- bt->max_block_cnt--;
-
- /* Check if we don't know the maximum size any longer */
- if(bt->max_block_cnt==0) {
- bt->max_block_size = new_block.len;
- bt->max_block_cnt = 1;
- bt->status &= ~H5BT_STATUS_MAX_VALID;
- } /* end if */
- } /* end if */
- else if(new_block.len > bt->max_block_size) {
- /* Should only happen if we have partial knowledge */
- HDassert((bt->status & H5BT_STATUS_MAX_VALID) == 0);
-
- /* Track the newly discovered max. block size */
- bt->max_block_size = new_block.len;
- bt->max_block_cnt = 1;
- } /* end if */
- else if(new_block.len == bt->max_block_size) {
- /* Should only happen if we have partial knowledge */
- HDassert((bt->status & H5BT_STATUS_MAX_VALID) == 0);
-
- bt->max_block_cnt++;
- } /* end if */
-
- /* Update min. block metadata */
- if(new_block.len < bt->min_block_size) {
- bt->min_block_size = new_block.len;
- bt->min_block_cnt = 1;
- } /* end if */
- else if(new_block.len == bt->min_block_size)
- bt->min_block_cnt++;
-
- /* Decrement total amount of blocks tracked */
- bt->tot_block_size -= length;
-
- /* Flag block tracker info as changed */
- bt_flags |= H5AC__DIRTIED_FLAG;
- } /* end if */
- else {
- /* Check for blocks at higher address, if necessary */
-HDfprintf(stderr,"%s: found={%a/%Hu}\n",FUNC,found.addr,found.len);
-HGOTO_ERROR(H5E_BLKTRK, H5E_UNSUPPORTED, FAIL, "Couldn't find block to remove")
- } /* end else */
- } /* end else */
-
-done:
- /* Release the block tracker info */
- if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_flags) < 0)
- HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5BT_remove() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_locate_cb
- *
- * Purpose: Block tracker "locate" callback
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Friday, March 25, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5BT_locate_cb(const void *_record, void *_op_data)
-{
- const H5BT_blk_info_t *record = (const H5BT_blk_info_t *)_record;
- H5BT_locate_t *search = (H5BT_locate_t *)_op_data;
- int ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BT_locate_cb)
-
- /* Check if we've found a block that's big enough */
- if (record->len >= search->search_size) {
- search->found = *record;
- ret_value = H5B2_ITER_STOP;
- } /* end if */
- else
- ret_value = H5B2_ITER_CONT;
-
- FUNC_LEAVE_NOAPI(ret_value);
-} /* end H5BT_locate_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_locate
- *
- * Purpose: Locate first block that is at least a certain size
- *
- * Return: Non-negative on success, negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 24 2005
- *
- * Modifications:
- *
- * John Mainzer, 6/8/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- *-------------------------------------------------------------------------
- */
-htri_t
-H5BT_locate(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t size, haddr_t *locate_addr, hsize_t *locate_size)
-{
- H5BT_t *bt = NULL; /* The new B-tree header information */
- H5BT_locate_t found; /* Block info found */
- htri_t ret_value=TRUE;
-
- FUNC_ENTER_NOAPI(H5BT_locate, FAIL)
-
- /*
- * Check arguments.
- */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
-
- /* Look up the block tracker header */
- if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BLTR, addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTPROTECT, FAIL, "unable to load block tracker info")
-
- /* Iterate through blocks, looking for first one that is large enough */
- found.search_size = size;
- found.found.addr = HADDR_UNDEF;
- if (H5B2_iterate(f, dxpl_id, H5B2_BLKTRK, bt->bt2_addr, H5BT_locate_cb, &found) < 0)
- HGOTO_ERROR(H5E_BLKTRK, H5E_NOTFOUND, FAIL, "unable to iterate over blocks")
-
- /* Update user's information, if block was found */
- if(H5F_addr_defined(found.found.addr)) {
- if(locate_addr)
- *locate_addr = found.found.addr;
- if(locate_size)
- *locate_size = found.found.len;
- } /* end if */
- else
- ret_value = FALSE;
-
-done:
- /* Release the block tracker info */
- if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5BT_locate() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_iterate
- *
- * Purpose: Iterate over blocks in tracker, making callback for each
- *
- * If the callback returns non-zero, the iteration breaks out
- * without finishing all the records.
- *
- * Return: Value from callback: non-negative on success, negative on error
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 25 2005
- *
- * Modifications:
- *
- * John Mainzer, 6/8/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5BT_iterate(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5BT_operator_t op, void *op_data)
-{
- H5BT_t *bt = NULL; /* The new B-tree header information */
- herr_t ret_value;
-
- FUNC_ENTER_NOAPI(H5BT_iterate, FAIL)
-
- /*
- * Check arguments.
- */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
- HDassert(op);
-
- /* Look up the block tracker header */
- if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BLTR, addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTPROTECT, FAIL, "unable to load block tracker info")
-
- /* Iterate through blocks, passing along op & op_data */
- if ((ret_value = H5B2_iterate(f, dxpl_id, H5B2_BLKTRK, bt->bt2_addr, (H5B2_operator_t)op, op_data)) < 0)
- HGOTO_ERROR(H5E_BLKTRK, H5E_NOTFOUND, FAIL, "unable to iterate over blocks")
-
-done:
- /* Release the block tracker info */
- if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5BT_iterate() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_neighbor_cb
- *
- * Purpose: Block tracker "neighbor" callback
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Monday, March 28, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5BT_neighbor_cb(const void *_record, void *_op_data)
-{
- const H5BT_blk_info_t *record = (const H5BT_blk_info_t *)_record;
- H5BT_blk_info_t *search = (H5BT_blk_info_t *)_op_data;
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BT_neighbor_cb)
-
- /* Save block information for later */
- *search = *record;
-
- FUNC_LEAVE_NOAPI(SUCCEED);
-} /* end H5BT_neighbor_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_neighbor
- *
- * Purpose: Locate block that is related to a given address
- *
- * Return: Non-negative on success, negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 28 2005
- *
- * Modifications:
- *
- * John Mainzer, 6/8/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5BT_neighbor(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5BT_compare_t range,
- haddr_t range_addr, H5BT_blk_info_t *found_block)
-{
- H5BT_t *bt = NULL; /* The new B-tree header information */
- H5BT_blk_info_t find; /* Information for locating block */
- H5BT_blk_info_t found; /* Block info found */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(H5BT_neighbor, FAIL)
-
- /*
- * Check arguments.
- */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
-
- /* Look up the block tracker header */
- if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BLTR, addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTPROTECT, FAIL, "unable to load block tracker info")
-
- /* Iterate through blocks, looking for first one that is large enough */
- find.addr = range_addr;
- find.len = 0;
- found.addr = HADDR_UNDEF;
- if (H5B2_neighbor(f, dxpl_id, H5B2_BLKTRK, bt->bt2_addr, (H5B2_compare_t)range,
- &find, H5BT_neighbor_cb, &found) < 0)
- HGOTO_ERROR(H5E_BLKTRK, H5E_NOTFOUND, FAIL, "unable to find neighbor for block")
-
- /* Update user's information, if block was found */
- if(H5F_addr_defined(found.addr))
- *found_block = found;
-
-done:
- /* Release the block tracker info */
- if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5BT_neighbor() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_delete
- *
- * Purpose: Delete a block tracker from a file
- *
- * Return: Non-negative on success, negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 14 2005
- *
- * Modifications:
- *
- * John Mainzer, 6/8/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5BT_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr)
-{
- H5BT_t *bt = NULL; /* The new B-tree header information */
- herr_t ret_value=SUCCEED;
-
- FUNC_ENTER_NOAPI(H5BT_delete, FAIL)
-
- /*
- * Check arguments.
- */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
-
- /* Look up the block tracker header */
- if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BLTR, addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTPROTECT, FAIL, "unable to load block tracker info")
-
- /* Delete B-tree */
- if (H5B2_delete(f, dxpl_id, H5B2_BLKTRK, bt->bt2_addr) < 0)
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTDELETE, FAIL, "Couldn't delete underlying B-tree")
-
- /* Release space for block tracker info on disk */
- if (H5MF_xfree(f, H5FD_MEM_BLKTRK, dxpl_id, addr, (hsize_t)H5BT_SIZE(f))<0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free block tracker info")
-
-done:
- /* Release the block tracker info */
- if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG) < 0)
- HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5BT_remove() */
-
diff --git a/src/H5BTbtree2.c b/src/H5BTbtree2.c
deleted file mode 100644
index 5539b03..0000000
--- a/src/H5BTbtree2.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
- * Thursday, March 10, 2005
- *
- * Purpose: v2 B-tree callback routines for block info records
- */
-
-#define H5BT_PACKAGE /*suppress error about including H5BTpkg */
-
-/* Private headers */
-#include "H5private.h" /* Generic Functions */
-#include "H5BTpkg.h" /* Block tracker */
-#include "H5Eprivate.h" /* Error handling */
-
-/* Static Prototypes */
-static herr_t H5BT_store(void *nrecord, const void *udata);
-static herr_t H5BT_retrieve(void *udata, const void *nrecord);
-static herr_t H5BT_compare(const void *rec1, const void *rec2);
-static herr_t H5BT_encode(const H5F_t *f, uint8_t *raw,
- const void *nrecord);
-static herr_t H5BT_decode(const H5F_t *f, const uint8_t *raw,
- void *nrecord);
-static herr_t H5BT_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
- int indent, int fwidth, const void *record, const void *_udata);
-
-/* Package variables */
-const H5B2_class_t H5B2_BLKTRK[1]={{ /* B-tree class information */
- H5B2_BLK_TRK_ID, /* Type of B-tree */
- sizeof(H5BT_blk_info_t), /* Size of native key */
- H5BT_store, /* Record storage callback */
- H5BT_retrieve, /* Record retrieval callback */
- H5BT_compare, /* Record comparison callback */
- H5BT_encode, /* Record encoding callback */
- H5BT_decode, /* Record decoding callback */
- H5BT_debug /* Record debugging callback */
-}};
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_store
- *
- * Purpose: Store native information into record for B-tree
- *
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Thursday, March 10, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5BT_store(void *nrecord, const void *udata)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BT_store)
-
- *(H5BT_blk_info_t *)nrecord = *(const H5BT_blk_info_t *)udata;
-
- FUNC_LEAVE_NOAPI(SUCCEED);
-} /* H5BT_store() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_retrieve
- *
- * Purpose: Retrieve native information from record for B-tree
- *
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Thursday, March 10, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5BT_retrieve(void *udata, const void *nrecord)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BT_retrieve)
-
- *(H5BT_blk_info_t *)udata = *(const H5BT_blk_info_t *)nrecord;
-
- FUNC_LEAVE_NOAPI(SUCCEED);
-} /* H5BT_retrieve() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_compare
- *
- * Purpose: Compare two native information records, according to some key
- *
- * Return: <0 if rec1 < rec2
- * =0 if rec1 == rec2
- * >0 if rec1 > rec2
- *
- * Programmer: Quincey Koziol
- * Thursday, March 10, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5BT_compare(const void *rec1, const void *rec2)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BT_compare)
-
- FUNC_LEAVE_NOAPI(H5F_addr_cmp(((const H5BT_blk_info_t *)rec1)->addr,((const H5BT_blk_info_t *)rec2)->addr));
-} /* H5BT_compare() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_encode
- *
- * Purpose: Encode native information into raw form for storing on disk
- *
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Thursday, March 10, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5BT_encode(const H5F_t *f, uint8_t *raw, const void *nrecord)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BT_encode)
-
- H5F_addr_encode(f, &raw, ((const H5BT_blk_info_t *)nrecord)->addr);
- H5F_ENCODE_LENGTH(f, raw, ((const H5BT_blk_info_t *)nrecord)->len);
-
- FUNC_LEAVE_NOAPI(SUCCEED);
-} /* H5BT_encode() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_decode
- *
- * Purpose: Decode raw disk form of record into native form
- *
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Thursday, March 10, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5BT_decode(const H5F_t *f, const uint8_t *raw, void *nrecord)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BT_decode)
-
- H5F_addr_decode(f, &raw, &(((H5BT_blk_info_t *)nrecord)->addr));
- H5F_DECODE_LENGTH(f, raw, ((H5BT_blk_info_t *)nrecord)->len);
-
- FUNC_LEAVE_NOAPI(SUCCEED);
-} /* H5BT_decode() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_debug
- *
- * Purpose: Debug native form of record
- *
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Thursday, March 10, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5BT_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, int fwidth,
- const void *record, const void UNUSED *_udata)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BT_debug)
-
- HDassert (record);
-
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Block Address:",
- ((const H5BT_blk_info_t *)record)->addr);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Block Length:",
- ((const H5BT_blk_info_t *)record)->len);
-
- FUNC_LEAVE_NOAPI(SUCCEED);
-} /* H5BT_debug() */
-
diff --git a/src/H5BTcache.c b/src/H5BTcache.c
deleted file mode 100644
index d579c05..0000000
--- a/src/H5BTcache.c
+++ /dev/null
@@ -1,331 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*-------------------------------------------------------------------------
- *
- * Created: H5BTcache.c
- * Mar 10 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
- *
- * Purpose: Implement block tracker metadata cache methods.
- *
- *-------------------------------------------------------------------------
- */
-
-#define H5BT_PACKAGE /*suppress error about including H5SHpkg */
-
-/* Private headers */
-#include "H5private.h" /* Generic Functions */
-#include "H5BTpkg.h" /* Block tracker */
-#include "H5Eprivate.h" /* Error handling */
-
-/* Local macros */
-
-/* Block tracker format version #'s */
-#define H5BT_VERSION 0
-
-
-/* Local typedefs */
-
-/* Local prototypes */
-
-/* Metadata cache callbacks */
-static H5BT_t *H5BT_cache_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata);
-static herr_t H5BT_cache_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5BT_t *b);
-static herr_t H5BT_cache_clear(H5F_t *f, H5BT_t *b, hbool_t destroy);
-static herr_t H5BT_cache_size(const H5F_t *f, const H5BT_t *bt, size_t *size_ptr);
-
-/* Package variables */
-
-/* H5BT inherits cache-like properties from H5AC */
-const H5AC_class_t H5AC_BLTR[1] = {{
- H5AC_BLTR_ID,
- (H5AC_load_func_t)H5BT_cache_load,
- (H5AC_flush_func_t)H5BT_cache_flush,
- (H5AC_dest_func_t)H5BT_cache_dest,
- (H5AC_clear_func_t)H5BT_cache_clear,
- (H5AC_size_func_t)H5BT_cache_size,
-}};
-
-/* Static variables */
-
-/* Declare a free list to manage block tracker data to/from disk */
-H5FL_BLK_DEFINE_STATIC(info_block);
-
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_cache_load
- *
- * Purpose: Loads block tracker info from the disk.
- *
- * Return: Success: Pointer to a new block tracker
- *
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 10 2005
- *
- *-------------------------------------------------------------------------
- */
-static H5BT_t *
-H5BT_cache_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1, void UNUSED *udata2)
-{
- H5BT_t *bt = NULL;
- size_t size;
- uint8_t *buf = NULL;
- uint8_t *p; /* Pointer into raw data buffer */
- H5BT_t *ret_value;
-
- FUNC_ENTER_NOAPI(H5BT_cache_load, NULL)
-
- /* Check arguments */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
-
- if (NULL==(bt = H5FL_MALLOC(H5BT_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemset(&bt->cache_info,0,sizeof(H5AC_info_t));
-
- /* Compute the size of the block tracker on disk */
- size = H5BT_SIZE(f);
-
- /* Allocate temporary buffer */
- if ((buf=H5FL_BLK_MALLOC(info_block,size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
-
- /* Read header from disk */
- if (H5F_block_read(f, H5FD_MEM_BLKTRK, addr, size, dxpl_id, buf)<0)
- HGOTO_ERROR(H5E_BLKTRK, H5E_READERROR, NULL, "can't read block tracker info")
-
- p = buf;
-
- /* magic number */
- if (HDmemcmp(p, H5BT_MAGIC, H5BT_SIZEOF_MAGIC))
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTLOAD, NULL, "wrong block tracker info signature")
- p += H5BT_SIZEOF_MAGIC;
-
- /* version */
- if (*p++ != H5BT_VERSION)
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTLOAD, NULL, "wrong block tracker info version")
-
- /* Size status information */
- bt->status = *p++;
-
- /* Max. block size info */
- H5F_DECODE_LENGTH(f, p, bt->max_block_size);
- UINT32DECODE(p, bt->max_block_cnt);
-
- /* Min. block size info */
- H5F_DECODE_LENGTH(f, p, bt->min_block_size);
- UINT32DECODE(p, bt->min_block_cnt);
-
- /* Total size of all blocks tracked */
- H5F_DECODE_LENGTH(f, p, bt->tot_block_size);
-
- /* Address of B-tree for blocks */
- H5F_addr_decode(f, (const uint8_t **)&p, &(bt->bt2_addr));
-
- /* Set return value */
- ret_value = bt;
-
-done:
- if(buf)
- H5FL_BLK_FREE(info_block,buf);
- if (!ret_value && bt)
- (void)H5BT_cache_dest(f,bt);
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5BT_cache_load() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_cache_flush
- *
- * Purpose: Flushes dirty block tracker info to disk.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 10 2005
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5BT_cache_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5BT_t *bt)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5BT_cache_flush, FAIL)
-
- /* check arguments */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
- HDassert(bt);
-
- if (bt->cache_info.is_dirty) {
- uint8_t *buf = NULL;
- uint8_t *p; /* Pointer into raw data buffer */
- size_t size;
-
- /* Compute the size of the block tracker info on disk */
- size = H5BT_SIZE(f);
-
- /* Allocate temporary buffer */
- if ((buf=H5FL_BLK_MALLOC(info_block,size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
-
- p = buf;
-
- /* magic number */
- HDmemcpy(p, H5BT_MAGIC, H5BT_SIZEOF_MAGIC);
- p += H5BT_SIZEOF_MAGIC;
-
- /* version # */
- *p++ = H5BT_VERSION;
-
- /* Size status information */
- *p++ = bt->status;
-
- /* Max. block size info */
- H5F_ENCODE_LENGTH(f, p, bt->max_block_size);
- UINT32ENCODE(p, bt->max_block_cnt);
-
- /* Min. block size info */
- H5F_ENCODE_LENGTH(f, p, bt->min_block_size);
- UINT32ENCODE(p, bt->min_block_cnt);
-
- /* Total size of all blocks tracked */
- H5F_ENCODE_LENGTH(f, p, bt->tot_block_size);
-
- /* Address of B-tree for blocks */
- H5F_addr_encode(f, &p, bt->bt2_addr);
-
- /* Write the block tracker info. */
- if (H5F_block_write(f, H5FD_MEM_BLKTRK, addr, size, dxpl_id, buf) < 0)
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTFLUSH, FAIL, "unable to save block tracker info to disk")
-
- H5FL_BLK_FREE(info_block,buf);
-
- bt->cache_info.is_dirty = FALSE;
- } /* end if */
-
- if (destroy)
- if (H5BT_cache_dest(f,bt) < 0)
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTFREE, FAIL, "unable to destroy block tracker info")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5BT_cache_flush() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_cache_dest
- *
- * Purpose: Destroys a block tracker in memory.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 10 2005
- *
- *-------------------------------------------------------------------------
- */
-/* ARGSUSED */
-herr_t
-H5BT_cache_dest(H5F_t UNUSED *f, H5BT_t *bt)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BT_cache_dest)
-
- /*
- * Check arguments.
- */
- HDassert(bt);
-
- /* Free block tracker info */
- H5FL_FREE(H5BT_t,bt);
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5BT_cache_dest() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_cache_clear
- *
- * Purpose: Mark a block tracker info in memory as non-dirty.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 10 2005
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5BT_cache_clear(H5F_t *f, H5BT_t *bt, hbool_t destroy)
-{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT(H5BT_cache_clear)
-
- /*
- * Check arguments.
- */
- HDassert(bt);
-
- /* Reset the dirty flag. */
- bt->cache_info.is_dirty = FALSE;
-
- if (destroy)
- if (H5BT_cache_dest(f, bt) < 0)
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTFREE, FAIL, "unable to destroy block tracker info")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5BT_cache_clear() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_cache_size
- *
- * Purpose: Compute the size in bytes of a block tracker info
- * on disk, and return it in *size_ptr. On failure,
- * the value of *size_ptr is undefined.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 10 2005
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5BT_cache_size(const H5F_t *f, const H5BT_t UNUSED *bt, size_t *size_ptr)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5BT_cache_size)
-
- /* check arguments */
- HDassert(f);
- HDassert(size_ptr);
-
- /* Set size value */
- *size_ptr = H5BT_SIZE(f);
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5BT_cache_size() */
-
diff --git a/src/H5BTdbg.c b/src/H5BTdbg.c
deleted file mode 100644
index dbce2b0..0000000
--- a/src/H5BTdbg.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*-------------------------------------------------------------------------
- *
- * Created: H5BTdbg.c
- * Mar 10 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
- *
- * Purpose: Dump debugging information about a block tracker
- *
- *-------------------------------------------------------------------------
- */
-
-#define H5BT_PACKAGE /*suppress error about including H5BTpkg */
-
-/* Private headers */
-#include "H5private.h" /* Generic Functions */
-#include "H5BTpkg.h" /* Block tracker */
-#include "H5Eprivate.h" /* Error handling */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5BT_debug
- *
- * Purpose: Prints debugging info about a block tracker info
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 10 2005
- *
- * Modifications:
- *
- * John Mainzer, 6/17/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5BT_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth)
-{
- H5BT_t *bt = NULL;
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5BT_hdr_debug, FAIL)
-
- /*
- * Check arguments.
- */
- assert(f);
- assert(H5F_addr_defined(addr));
- assert(stream);
- assert(indent >= 0);
- assert(fwidth >= 0);
-
- /*
- * Load the block tracker info
- */
- if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BLTR, addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load block tracker info")
-
- /*
- * Print the values.
- */
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Dirty flag:",
- bt->cache_info.is_dirty ? "True" : "False");
- HDfprintf(stream, "%*s%-*s %x\n", indent, "", fwidth,
- "Status:",
- (unsigned)bt->status);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
- "Max. Size of Block Tracked:",
- bt->max_block_size);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Ref. Count of Max. Block Tracked:",
- (unsigned)bt->max_block_cnt);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
- "Min. Size of Block Tracked:",
- bt->min_block_size);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Ref. Count of Min. Block Tracked:",
- (unsigned)bt->min_block_cnt);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
- "Total Size of All Blocks Tracked:",
- bt->tot_block_size);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
- "Address of v2 B-tree Storing Block Info Records:",
- bt->bt2_addr);
-
-done:
- if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release block tracker info")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5BT_hdr_debug() */
-
diff --git a/src/H5BTpkg.h b/src/H5BTpkg.h
deleted file mode 100644
index 2de481d..0000000
--- a/src/H5BTpkg.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
- * Thursday, March 10, 2005
- *
- * Purpose: This file contains declarations which are visible only within
- * the H5BT package. Source files outside the H5BT package should
- * include H5BTprivate.h instead.
- */
-#ifndef H5BT_PACKAGE
-#error "Do not include this file outside the H5BT package!"
-#endif
-
-#ifndef _H5BTpkg_H
-#define _H5BTpkg_H
-
-/* Get package's private header */
-#include "H5BTprivate.h" /* Block tracker */
-
-/* Other private headers needed by this file */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5FLprivate.h" /* Free Lists */
-
-/**************************/
-/* Package Private Macros */
-/**************************/
-
-/* Size of signature information (on disk) */
-#define H5BT_SIZEOF_MAGIC 4
-
-/* Block Tracker signature */
-#define H5BT_MAGIC "BLTR"
-
-/* Size of the Block Tracker info on disk */
-#define H5BT_SIZE(f) ( \
- 4 + /* Signature */ \
- 1 + /* Version */ \
- 1 + /* Status flags */ \
- H5F_SIZEOF_SIZE(f) + /* Max. size block tracked (can be 0 for "unknown") */ \
- 4 + /* Reference count of max. size block tracked */ \
- H5F_SIZEOF_SIZE(f) + /* Min. size block tracked (can be 0 for "unknown") */ \
- 4 + /* Reference count of min. size block tracked */ \
- H5F_SIZEOF_SIZE(f) + /* Total number of bytes tracked */ \
- H5F_SIZEOF_ADDR(f)) /* Address of v2 B-tree which holds block inf */
-
-/* Bit flags for block tracker size status */
-#define H5BT_STATUS_MAX_VALID 0x01 /* Maximum block size valid over all blocks tracked */
- /* If this flag is not set, then only part of the blocks have been */
- /* searched to determine the current maximum block size. This can happen */
- /* during block shrinks or removals */
-#define H5BT_STATUS_MIN_VALID 0x02 /* Minimum block size valid over all blocks tracked */
- /* If this flag is not set, then only part of the blocks have been */
- /* searched to determine the current minimum block size. This can happen */
- /* during block expansions or removals */
-
-
-/****************************/
-/* Package Private Typedefs */
-/****************************/
-
-/* The block tracker information */
-typedef struct H5BT_t {
- /* Information for H5AC cache functions, _must_ be first field in structure */
- H5AC_info_t cache_info;
-
- /* Internal block tracking information */
- unsigned char status; /* Status flags for max & min values */
- hsize_t max_block_size; /* Maximum size of a block tracked */
- uint32_t max_block_cnt; /* Count of max. block tracked */
- hsize_t min_block_size; /* Minimum size of a block tracked */
- uint32_t min_block_cnt; /* Count of min. block tracked */
- hsize_t tot_block_size; /* Total size of all blocks tracked */
- haddr_t bt2_addr; /* Address of v2 B-tree that holds block info */
-} H5BT_t;
-
-
-/*****************************/
-/* Package Private Variables */
-/*****************************/
-
-/* H5BT inherits cache-like properties from H5AC */
-H5_DLLVAR const H5AC_class_t H5AC_BLTR[1];
-
-/* v2 B-tree class for block info records */
-H5_DLLVAR const H5B2_class_t H5B2_BLKTRK[1];
-
-/* Declare a free list to manage the H5BT_t struct */
-H5FL_EXTERN(H5BT_t);
-
-
-/******************************/
-/* Package Private Prototypes */
-/******************************/
-H5_DLL herr_t H5BT_cache_dest(H5F_t *f, H5BT_t *b);
-H5_DLL herr_t H5BT_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream,
- int indent, int fwidth);
-#ifdef H5BT_TESTING
-H5_DLL herr_t H5BT_get_max_info(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- hsize_t *size, uint32_t *count, hbool_t *valid);
-H5_DLL herr_t H5BT_get_min_info(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- hsize_t *size, uint32_t *count, hbool_t *valid);
-#endif /* H5B2_TESTING */
-
-#endif /* _H5BTpkg_H */
-
diff --git a/src/H5BTprivate.h b/src/H5BTprivate.h
deleted file mode 100644
index e7de549..0000000
--- a/src/H5BTprivate.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*-------------------------------------------------------------------------
- *
- * Created: H5BTprivate.h
- * Mar 10 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
- *
- * Purpose: Private header for library accessible block tracker routines.
- *
- *-------------------------------------------------------------------------
- */
-
-#ifndef _H5BTprivate_H
-#define _H5BTprivate_H
-
-/* Include package's public header */
-#include "H5BTpublic.h"
-
-/* Private headers needed by this file */
-#include "H5B2private.h" /* v2 B-trees */
-#include "H5Fprivate.h" /* File access */
-
-/**************************/
-/* Library Private Macros */
-/**************************/
-
-/* Define return values from operator callback function for H5BT_iterate */
-/* (Actually, any positive value will cause the iterator to stop and pass back
- * that positive value to the function that called the iterator)
- */
-#define H5BT_ITER_ERROR H5B2_ITER_ERROR
-#define H5BT_ITER_CONT H5B2_ITER_CONT
-#define H5BT_ITER_STOP H5B2_ITER_STOP
-
-
-/****************************/
-/* Library Private Typedefs */
-/****************************/
-
-/* Info for a single block (stored as record in B-tree) */
-typedef struct H5BT_blk_info_t {
- haddr_t addr; /* Address (offset) of block in file */
- hsize_t len; /* Length of block in file */
-} H5BT_blk_info_t;
-
-/* Define the operator callback function pointer for H5BT_iterate() */
-typedef int (*H5BT_operator_t)(const H5BT_blk_info_t *record, void *op_data);
-
-/* Comparisons for H5BT_neighbor() call */
-typedef enum H5BT_compare_t {
- H5BT_COMPARE_LESS = H5B2_COMPARE_LESS, /* Records with keys less than query value */
- H5BT_COMPARE_GREATER = H5B2_COMPARE_GREATER /* Records with keys greater than query value */
-} H5BT_compare_t;
-
-
-/***************************************/
-/* Library-private Function Prototypes */
-/***************************************/
-H5_DLL herr_t H5BT_create(H5F_t *f, hid_t dxpl_id, haddr_t *addr_p);
-H5_DLL herr_t H5BT_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, haddr_t offset,
- hsize_t length);
-H5_DLL herr_t H5BT_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, haddr_t offset,
- hsize_t length);
-H5_DLL herr_t H5BT_get_total_size(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- hsize_t *tot_size);
-H5_DLL herr_t H5BT_locate(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t size,
- haddr_t *locate_addr, hsize_t *locate_size);
-H5_DLL herr_t H5BT_iterate(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- H5BT_operator_t op, void *op_data);
-H5_DLL herr_t H5BT_neighbor(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- H5BT_compare_t range, haddr_t range_addr, H5BT_blk_info_t *found_block);
-H5_DLL herr_t H5BT_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr);
-
-#endif /* _H5BTprivate_H */
-
diff --git a/src/H5BTpublic.h b/src/H5BTpublic.h
deleted file mode 100644
index f37f2d1..0000000
--- a/src/H5BTpublic.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*-------------------------------------------------------------------------
- *
- * Created: H5BTpublic.h
- * Mar 10 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
- *
- * Purpose: Public declarations for the H5BT package.
- *
- *-------------------------------------------------------------------------
- */
-#ifndef _H5BTpublic_H
-#define _H5BTpublic_H
-
-/* Public headers needed by this file */
-#include "H5public.h"
-
-/*****************/
-/* Public Macros */
-/*****************/
-
-/*******************/
-/* Public Typedefs */
-/*******************/
-
-/**********************************/
-/* Public API Function Prototypes */
-/**********************************/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _H5BTpublic_H */
-
diff --git a/src/H5BTtest.c b/src/H5BTtest.c
deleted file mode 100644
index cb94ad2..0000000
--- a/src/H5BTtest.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
- * Thursday, March 10, 2005
- *
- * Purpose: Block tracker testing functions.
- */
-
-#define H5BT_PACKAGE /*suppress error about including H5BTpkg */
-#define H5BT_TESTING /*suppress warning about H5BT testing funcs*/
-
-/* Private headers */
-#include "H5private.h" /* Generic Functions */
-#include "H5BTpkg.h" /* Block tracker */
-#include "H5Eprivate.h" /* Error handling */
-
-/* Static Prototypes */
-
-/* Package variables */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5B2_get_max_info
- *
- * Purpose: Retrieve the information about the maximum size block tracked
- *
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Thursday, March 10, 2005
- *
- * Modifications:
- *
- * John Mainzer, 6/17/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5BT_get_max_info(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *size,
- uint32_t *count, hbool_t *valid)
-{
- H5BT_t *bt=NULL; /* Pointer to the block tracker info */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT(H5BT_get_max_info)
-
- /* Check arguments. */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
- HDassert(size);
- HDassert(count);
- HDassert(valid);
-
- /* Look up the block tracker header */
- if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BLTR, addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTPROTECT, FAIL, "unable to load block tracker info")
-
- /* Save max. block size info */
- *size = bt->max_block_size;
- *count = bt->max_block_cnt;
- *valid = (bt->status & H5BT_STATUS_MAX_VALID) > 0;
-
-done:
- /* Release the block tracker info */
- if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5BT_get_max_info() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5B2_get_min_info
- *
- * Purpose: Retrieve the information about the minimum size block tracked
- *
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Thursday, March 10, 2005
- *
- * Modifications:
- *
- * John Mainzer, 6/17/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5BT_get_min_info(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *size,
- uint32_t *count, hbool_t *valid)
-{
- H5BT_t *bt=NULL; /* Pointer to the block tracker info */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT(H5BT_get_min_info)
-
- /* Check arguments. */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
- HDassert(size);
- HDassert(count);
- HDassert(valid);
-
- /* Look up the block tracker header */
- if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BLTR, addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BLKTRK, H5E_CANTPROTECT, FAIL, "unable to load block tracker info")
-
- /* Save min. block size info */
- *size = bt->min_block_size;
- *count = bt->min_block_cnt;
- *valid = (bt->status & H5BT_STATUS_MIN_VALID) > 0;
-
-done:
- /* Release the block tracker info */
- if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5BT_get_min_info() */
-
diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h
index eb8db3a..3e2c049 100644
--- a/src/H5Cpkg.h
+++ b/src/H5Cpkg.h
@@ -609,7 +609,7 @@
****************************************************************************/
#define H5C__H5C_T_MAGIC 0x005CAC0E
-#define H5C__MAX_NUM_TYPE_IDS 13
+#define H5C__MAX_NUM_TYPE_IDS 9
#define H5C__PREFIX_LEN 32
struct H5C_t
diff --git a/src/H5SH.c b/src/H5SH.c
deleted file mode 100644
index 9c8e330..0000000
--- a/src/H5SH.c
+++ /dev/null
@@ -1,337 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*-------------------------------------------------------------------------
- *
- * Created: H5SH.c
- * Mar 9 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
- *
- * Purpose: Implement "segmented heaps". These heaps are
- *
- *-------------------------------------------------------------------------
- */
-
-#define H5SH_PACKAGE /*suppress error about including H5SHpkg */
-
-/* Private headers */
-#include "H5private.h" /* Generic Functions */
-#include "H5BTprivate.h" /* Block tracker */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5SHpkg.h" /* Segmented heap */
-
-/* Local macros */
-
-/* Local typedefs */
-
-/* Information needed for extending a heap block during an allocation */
-typedef struct {
- H5F_t *f; /* File to search for space within */
- hid_t dxpl_id; /* DXPL for allocation operation */
- haddr_t bt_free_addr; /* Location of free space B-tree */
- H5FD_mem_t file_mem_type; /* Type of file memory being used */
- hsize_t max_extend_size; /* Maximum size of a block to consider for extention */
- hsize_t space_needed; /* Amount of space to allocate */
- haddr_t loc; /* Location of space allocated */
- haddr_t extend_addr; /* Extended space address */
- hsize_t extend_size; /* Extended space size */
-} H5SH_extend_t;
-
-/* Local prototypes */
-
-/* Package variables */
-
-/* Declare a free list to manage the H5SH_t struct */
-H5FL_DEFINE(H5SH_t);
-
-/* Static variables */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5SH_create
- *
- * Purpose: Creates a new empty segmented heap in the file.
- *
- * Return: Non-negative on success (with address of new segmented heap
- * filled in), negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 23 2005
- *
- * Changes: John Mainzer -- 6/7/05
- * Removed code modifying the is_dirty field of the cache
- * info. Management of this field is in the process of
- * being moved to the H5C code.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5SH_create(H5F_t *f, hid_t dxpl_id, haddr_t *addr_p, H5SH_data_type_t heap_type,
- hsize_t min_size, hsize_t max_extend_size)
-{
- H5SH_t *sh = NULL; /* Segmented heap info */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5SH_create, FAIL)
-
- /*
- * Check arguments.
- */
- HDassert(f);
- HDassert(min_size > 0);
- HDassert(max_extend_size >= min_size);
-
- /*
- * Allocate file and memory data structures.
- */
- if (NULL == (sh = H5FL_CALLOC(H5SH_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for segmented heap info")
-
- /* Assign internal information */
- sh->heap_type = heap_type;
- if(sh->heap_type == H5SH_RAW)
- sh->file_mem_type = H5FD_MEM_DRAW;
- else
- sh->file_mem_type = H5FD_MEM_SHEAP_BLOCK;
- sh->min_size = min_size;
- sh->max_extend_size = max_extend_size;
-
- /* Allocate space for the header on disk */
- if (HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_SHEAP_HDR, dxpl_id, (hsize_t)H5SH_SIZE(f))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for segmented heap info")
-
- /* Create a block tracker for storing heap block info */
- if (H5BT_create(f, dxpl_id, &sh->bt_heap_addr/*out*/) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create block tracker for storing heap block info")
-
- /* Create a block tracker for storing free space info */
- if (H5BT_create(f, dxpl_id, &sh->bt_free_addr/*out*/) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create block tracker for storing free space info")
-
- /* Cache the new segmented heap node */
- if (H5AC_set(f, dxpl_id, H5AC_SGHP, *addr_p, sh, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add segmented heap info to cache")
-
-done:
- if (ret_value<0) {
- if (sh)
- (void)H5SH_cache_dest(f, sh);
- } /* end if */
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5SH_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5SH_alloc_extend_cb
- *
- * Purpose: Extend an existing heap block if possible
- *
- * Return: Non-negative on success (setting flag to indicate block
- * was extended), negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 25 2005
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5SH_alloc_extend_cb(const H5BT_blk_info_t *record, void *_op_data)
-{
- H5SH_extend_t *ex_info = (H5SH_extend_t *)_op_data;
- htri_t extendable; /* Is block extendable */
- int ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT(H5SH_alloc_extend_cb)
-
- /* Check if we are allowed to extend this heap block */
- if(record->len < ex_info->max_extend_size) {
- H5BT_blk_info_t free_block; /* Block info for free space */
- hsize_t space_needed; /* Space needed to extend block */
- hbool_t use_free_space = FALSE; /* Flag to indicate that free space should be used */
-
- /* Set the amount of space needed */
- space_needed = ex_info->space_needed;
-
- /* Find first free space block before end of extendable block */
- free_block.addr = HADDR_UNDEF;
- if(H5BT_neighbor(ex_info->f, ex_info->dxpl_id, ex_info->bt_free_addr,
- H5BT_COMPARE_LESS, (record->addr + record->len + 1),
- &free_block) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, H5BT_ITER_ERROR, "can't search for free space")
-
- /* Check if we can use free space for part of block to allocate */
- if(H5F_addr_defined(free_block.addr) &&
- (free_block.addr + free_block.len) == (record->addr + record->len)) {
- use_free_space = TRUE;
- space_needed -= free_block.len;
- } /* end if */
-
- /* Check if this heap block can be extended */
- if((extendable = H5MF_can_extend(ex_info->f, ex_info->file_mem_type,
- record->addr, record->len, space_needed)) == TRUE) {
-
- /* Extend heap block in the file */
- if(H5MF_extend(ex_info->f, ex_info->file_mem_type,
- record->addr, record->len, space_needed) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, H5BT_ITER_ERROR, "can't extend extendable heap block?")
-
- /* Set information to return from iterator */
- if(use_free_space) {
- /* Remove block from free space tracker */
- if(H5BT_remove(ex_info->f, ex_info->dxpl_id, ex_info->bt_free_addr,
- free_block.addr, free_block.len) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't remove free space block")
-
- ex_info->loc = free_block.addr;
- } /* end if */
- else
- ex_info->loc = record->addr + record->len;
-
- /* Set information about extension to block */
- ex_info->extend_addr = record->addr + record->len;
- ex_info->extend_size = space_needed;
-
- ret_value = H5BT_ITER_STOP;
- } /* end if */
- else if(extendable == FALSE)
- ret_value = H5BT_ITER_CONT;
- else
- HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPARE, H5BT_ITER_ERROR, "can't check if heap block is extendable")
- } /* end if */
- else
- ret_value = H5BT_ITER_CONT;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5SH_alloc_extend_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5SH_alloc
- *
- * Purpose: Allocate space for a new object in a segmented heap
- *
- * Return: Non-negative on success (with address of new object
- * filled in), negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 25 2005
- *
- * Modifications:
- *
- * John Mainzer, 6/16/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5SH_alloc(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t size, haddr_t *obj_addr_p)
-{
- H5SH_t *sh = NULL; /* Segmented heap info */
- haddr_t free_addr; /* Address of free block */
- hsize_t free_len; /* Address of free block */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5SH_alloc, FAIL)
-
- /*
- * Check arguments.
- */
- HDassert(f);
-
- /* Look up the segmented heap */
- if (NULL == (sh = H5AC_protect(f, dxpl_id, H5AC_SGHP, addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load segmented heap info")
-
- /* Check for block of at least 'size' bytes in free list */
- free_addr = HADDR_UNDEF;
- if (H5BT_locate(f, dxpl_id, sh->bt_free_addr, size, &free_addr, &free_len) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "error searching segmented heap free list")
-
- /* Check for finding large enough free block */
- if (H5F_addr_defined(free_addr)) {
- /* Remove block from free list */
- if (H5BT_remove(f, dxpl_id, sh->bt_free_addr, free_addr, size) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't remove block")
-
- /* Set address to return */
- *obj_addr_p = free_addr;
- } /* end if */
- else {
- H5SH_extend_t ex_info;
-
- /* Iterate over the existing heap blocks, to check for extending one */
- ex_info.f = f;
- ex_info.dxpl_id = dxpl_id;
- ex_info.file_mem_type = sh->file_mem_type;
- ex_info.bt_free_addr = sh->bt_free_addr;
- ex_info.max_extend_size = sh->max_extend_size;
- ex_info.space_needed = size;
- ex_info.loc = HADDR_UNDEF;
- if(H5BT_iterate(f, dxpl_id, sh->bt_heap_addr, H5SH_alloc_extend_cb, &ex_info) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't iterate over heap blocks")
-
- /* Check if we managed to extend a heap block */
- if(H5F_addr_defined(ex_info.loc)) {
- if(H5BT_insert(f, dxpl_id, sh->bt_heap_addr, ex_info.extend_addr, ex_info.extend_size) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't extend tracked block")
-
- /* Set address to return */
- *obj_addr_p = ex_info.loc;
- } /* end if */
- else {
- haddr_t block_addr; /* Address of new heap block */
- hsize_t block_size; /* Size of heap block */
-
- /* Determine how large to make the heap block initially */
- if(size <= sh->min_size)
- block_size = sh->min_size;
- else
- block_size = size;
-
- /* There's no internal or external space available, allocate a new heap block */
- if(HADDR_UNDEF == (block_addr = H5MF_alloc(f, sh->file_mem_type, dxpl_id, sh->min_size)))
- HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "failed to allocate space for new heap block")
-
- /* Add heap block to tracker */
- if(H5BT_insert(f, dxpl_id, sh->bt_heap_addr, block_addr, block_size) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't insert heap block")
-
- /* Check if there is free space */
- if(size < sh->min_size) {
- /* Add free space to tracker */
- if(H5BT_insert(f, dxpl_id, sh->bt_free_addr, block_addr + size, sh->min_size - size) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't insert free space")
- } /* end if */
-
- /* Set address to return */
- *obj_addr_p = block_addr;
- } /* end else */
- } /* end else */
-
-done:
- /* Release the block tracker info */
- if (sh && H5AC_unprotect(f, dxpl_id, H5AC_SGHP, addr, sh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release segmented heap info")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5SH_alloc() */
-
diff --git a/src/H5SHcache.c b/src/H5SHcache.c
deleted file mode 100644
index aa4c981..0000000
--- a/src/H5SHcache.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*-------------------------------------------------------------------------
- *
- * Created: H5SHcache.c
- * Mar 10 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
- *
- * Purpose: Implement segmented heap metadata cache methods.
- *
- *-------------------------------------------------------------------------
- */
-
-#define H5SH_PACKAGE /*suppress error about including H5SHpkg */
-
-/* Private headers */
-#include "H5private.h" /* Generic Functions */
-#include "H5SHpkg.h" /* Segmented heap */
-#include "H5Eprivate.h" /* Error handling */
-
-/* Local macros */
-
-/* Segmented heap format version #'s */
-#define H5SH_VERSION 0
-
-
-/* Local typedefs */
-
-/* Local prototypes */
-
-/* Metadata cache callbacks */
-static H5SH_t *H5SH_cache_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata);
-static herr_t H5SH_cache_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SH_t *s);
-static herr_t H5SH_cache_clear(H5F_t *f, H5SH_t *s, hbool_t destroy);
-static herr_t H5SH_cache_size(const H5F_t *f, const H5SH_t *s, size_t *size_ptr);
-
-/* Package variables */
-
-/* H5SH inherits cache-like properties from H5AC */
-const H5AC_class_t H5AC_SGHP[1] = {{
- H5AC_SHEAP_ID,
- (H5AC_load_func_t)H5SH_cache_load,
- (H5AC_flush_func_t)H5SH_cache_flush,
- (H5AC_dest_func_t)H5SH_cache_dest,
- (H5AC_clear_func_t)H5SH_cache_clear,
- (H5AC_size_func_t)H5SH_cache_size,
-}};
-
-/* Static variables */
-
-/* Declare a free list to manage segmented heap data to/from disk */
-H5FL_BLK_DEFINE_STATIC(info_block);
-
-
-
-/*-------------------------------------------------------------------------
- * Function: H5SH_cache_load
- *
- * Purpose: Loads segmented heap info from the disk.
- *
- * Return: Success: Pointer to a new segmented heap
- *
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 23 2005
- *
- *-------------------------------------------------------------------------
- */
-static H5SH_t *
-H5SH_cache_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1, void UNUSED *udata2)
-{
- H5SH_t *sh = NULL;
- size_t size;
- uint8_t *buf = NULL;
- uint8_t *p; /* Pointer into raw data buffer */
- H5SH_t *ret_value;
-
- FUNC_ENTER_NOAPI(H5SH_cache_load, NULL)
-
- /* Check arguments */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
-
- if (NULL==(sh = H5FL_MALLOC(H5SH_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemset(&sh->cache_info,0,sizeof(H5AC_info_t));
-
- /* Compute the size of the segmented heap info on disk */
- size = H5SH_SIZE(f);
-
- /* Allocate temporary buffer */
- if ((buf=H5FL_BLK_MALLOC(info_block,size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
-
- /* Read info from disk */
- if (H5F_block_read(f, H5FD_MEM_SHEAP_HDR, addr, size, dxpl_id, buf)<0)
- HGOTO_ERROR(H5E_HEAP, H5E_READERROR, NULL, "can't read segmented heap info")
-
- p = buf;
-
- /* magic number */
- if (HDmemcmp(p, H5SH_MAGIC, H5SH_SIZEOF_MAGIC))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong segmented heap info signature")
- p += H5SH_SIZEOF_MAGIC;
-
- /* version */
- if (*p++ != H5SH_VERSION)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong segmented heap info version")
-
- /* Type of data in heap blocks */
- sh->heap_type = (H5SH_data_type_t)*p++;
- if(sh->heap_type == H5SH_RAW)
- sh->file_mem_type = H5FD_MEM_DRAW;
- else
- sh->file_mem_type = H5FD_MEM_SHEAP_BLOCK;
-
- /* Total heap block minimum size */
- H5F_DECODE_LENGTH(f, p, sh->min_size);
-
- /* Total heap block max. expand size */
- H5F_DECODE_LENGTH(f, p, sh->max_extend_size);
-
- /* Address of block tracker for heap blocks */
- H5F_addr_decode(f, (const uint8_t **)&p, &(sh->bt_heap_addr));
-
- /* Address of block tracker for free space */
- H5F_addr_decode(f, (const uint8_t **)&p, &(sh->bt_free_addr));
-
- /* Set return value */
- ret_value = sh;
-
-done:
- if(buf)
- H5FL_BLK_FREE(info_block,buf);
- if (!ret_value && sh)
- (void)H5SH_cache_dest(f,sh);
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5SH_cache_load() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5SH_cache_flush
- *
- * Purpose: Flushes dirty segmented heap info to disk.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 23 2005
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5SH_cache_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SH_t *sh)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5SH_cache_flush, FAIL)
-
- /* check arguments */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
- HDassert(sh);
-
- if (sh->cache_info.is_dirty) {
- uint8_t *buf = NULL;
- uint8_t *p; /* Pointer into raw data buffer */
- size_t size;
-
- /* Compute the size of the segmented heap info on disk */
- size = H5SH_SIZE(f);
-
- /* Allocate temporary buffer */
- if ((buf=H5FL_BLK_MALLOC(info_block,size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
-
- p = buf;
-
- /* magic number */
- HDmemcpy(p, H5SH_MAGIC, H5SH_SIZEOF_MAGIC);
- p += H5SH_SIZEOF_MAGIC;
-
- /* version # */
- *p++ = H5SH_VERSION;
-
- /* Type of data in heap blocks */
- *p++ = (uint8_t)sh->heap_type;
-
- /* Min. size of heap block */
- H5F_ENCODE_LENGTH(f, p, sh->min_size);
-
- /* Max. size to expand heap block */
- H5F_ENCODE_LENGTH(f, p, sh->max_extend_size);
-
- /* Address of block tracker for heap blocks */
- H5F_addr_encode(f, &p, sh->bt_heap_addr);
-
- /* Address of block tracker for free space */
- H5F_addr_encode(f, &p, sh->bt_free_addr);
-
- /* Write the segmented heap info. */
- if (H5F_block_write(f, H5FD_MEM_SHEAP_HDR, addr, size, dxpl_id, buf) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTFLUSH, FAIL, "unable to save segmented heap info to disk")
-
- H5FL_BLK_FREE(info_block,buf);
-
- sh->cache_info.is_dirty = FALSE;
- } /* end if */
-
- if (destroy)
- if (H5SH_cache_dest(f,sh) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy segmented heap info")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5SH_cache_flush() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5SH_cache_dest
- *
- * Purpose: Destroys a segmented heap in memory.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 23 2005
- *
- *-------------------------------------------------------------------------
- */
-/* ARGSUSED */
-herr_t
-H5SH_cache_dest(H5F_t UNUSED *f, H5SH_t *sh)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SH_cache_dest)
-
- /*
- * Check arguments.
- */
- HDassert(sh);
-
- /* Free segmented heap info */
- H5FL_FREE(H5SH_t,sh);
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5SH_cache_dest() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5SH_cache_clear
- *
- * Purpose: Mark a segmented heap info in memory as non-dirty.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 23 2005
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5SH_cache_clear(H5F_t *f, H5SH_t *sh, hbool_t destroy)
-{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT(H5SH_cache_clear)
-
- /*
- * Check arguments.
- */
- HDassert(sh);
-
- /* Reset the dirty flag. */
- sh->cache_info.is_dirty = FALSE;
-
- if (destroy)
- if (H5SH_cache_dest(f, sh) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy segmented heap info")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5SH_cache_clear() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5SH_cache_size
- *
- * Purpose: Compute the size in bytes of a segmented heap info
- * on disk, and return it in *size_ptr. On failure,
- * the value of *size_ptr is undefined.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 23 2005
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5SH_cache_size(const H5F_t *f, const H5SH_t UNUSED *sh, size_t *size_ptr)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SH_cache_size)
-
- /* check arguments */
- HDassert(f);
- HDassert(size_ptr);
-
- /* Set size value */
- *size_ptr = H5SH_SIZE(f);
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5SH_cache_size() */
-
-
diff --git a/src/H5SHdbg.c b/src/H5SHdbg.c
deleted file mode 100644
index 85dea67..0000000
--- a/src/H5SHdbg.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*-------------------------------------------------------------------------
- *
- * Created: H5SHdbg.c
- * Mar 24 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
- *
- * Purpose: Dump debugging information about a segmented heap
- *
- *-------------------------------------------------------------------------
- */
-
-#define H5SH_PACKAGE /*suppress error about including H5SHpkg */
-
-/* Private headers */
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5SHpkg.h" /* Segmented heap */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5SH_debug
- *
- * Purpose: Prints debugging info about a segmented heap
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 24 2005
- *
- * Modifications:
- *
- * John Mainzer, 6/16/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5SH_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth)
-{
- H5SH_t *sh = NULL;
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5SH_debug, FAIL)
-
- /*
- * Check arguments.
- */
- assert(f);
- assert(H5F_addr_defined(addr));
- assert(stream);
- assert(indent >= 0);
- assert(fwidth >= 0);
-
- /*
- * Load the segmented heap info
- */
- if (NULL == (sh = H5AC_protect(f, dxpl_id, H5AC_SGHP, addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load segmented heap info")
-
- /*
- * Print the values.
- */
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Dirty flag:",
- sh->cache_info.is_dirty ? "True" : "False");
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
- "Minimum Size Of Heap Blocks:",
- sh->min_size);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
- "Maximum Size To Extend Heap Blocks:",
- sh->max_extend_size);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
- "Address of Block Tracker For Heap Blocks:",
- sh->bt_heap_addr);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
- "Address of Block Tracker For Free Space:",
- sh->bt_free_addr);
-
-done:
- if (sh && H5AC_unprotect(f, dxpl_id, H5AC_SGHP, addr, sh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release segmented heap info")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5SH_debug() */
-
-
diff --git a/src/H5SHpkg.h b/src/H5SHpkg.h
deleted file mode 100644
index 9b38a4f..0000000
--- a/src/H5SHpkg.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
- * Thursday, March 10, 2005
- *
- * Purpose: This file contains declarations which are visible only within
- * the H5SH package. Source files outside the H5SH package should
- * include H5SHprivate.h instead.
- */
-#ifndef H5SH_PACKAGE
-#error "Do not include this file outside the H5SH package!"
-#endif
-
-#ifndef _H5SHpkg_H
-#define _H5SHpkg_H
-
-/* Get package's private header */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5SHprivate.h" /* Segmented heap */
-
-/* Other private headers needed by this file */
-
-/**************************/
-/* Package Private Macros */
-/**************************/
-
-/* Size of signature information (on disk) */
-#define H5SH_SIZEOF_MAGIC 4
-
-/* Segmented heap signature */
-#define H5SH_MAGIC "SGHP"
-
-/* Size of the segmented heap info on disk */
-#define H5SH_SIZE(f) ( \
- 4 + /* Signature */ \
- 1 + /* Version */ \
- 1 + /* Heap data type */ \
- H5F_SIZEOF_SIZE(f) + /* Min. size of heap blocks */ \
- H5F_SIZEOF_SIZE(f) + /* Max. expand size of heap blocks */ \
- H5F_SIZEOF_ADDR(f) + /* Address of block tracker for actual heap blocks */ \
- H5F_SIZEOF_ADDR(f)) /* Address of block tracker for free blocks */
-
-/****************************/
-/* Package Private Typedefs */
-/****************************/
-
-/* The segmented heap information */
-typedef struct H5SH_t {
- /* Information for H5AC cache functions, _must_ be first field in structure */
- H5AC_info_t cache_info;
-
- /* Information set by user */
- H5SH_data_type_t heap_type; /* Type of data stored in heap */
- hsize_t min_size; /* Minimum size of heap block */
- hsize_t max_extend_size;/* Maximum size to expand heap block to */
- /* (Objects larger than this size will get
- * placed into their own heap block)
- */
-
- /* Derived information from user's information */
- H5FD_mem_t file_mem_type; /* Type of memory to store heap blocks in the file */
-
- /* Internal block tracking information */
- haddr_t bt_heap_addr; /* Address of block tracker for heap blocks */
- haddr_t bt_free_addr; /* Address of block tracker for free space */
-} H5SH_t;
-
-
-/*****************************/
-/* Package Private Variables */
-/*****************************/
-
-/* H5SH inherits cache-like properties from H5AC */
-H5_DLLVAR const H5AC_class_t H5AC_SGHP[1];
-
-/* Declare a free list to manage the H5SH_t struct */
-H5FL_EXTERN(H5SH_t);
-
-
-/******************************/
-/* Package Private Prototypes */
-/******************************/
-H5_DLL herr_t H5SH_cache_dest(H5F_t *f, H5SH_t *b);
-H5_DLL herr_t H5SH_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream,
- int indent, int fwidth);
-
-#endif /* _H5SHpkg_H */
-
-
diff --git a/src/H5SHprivate.h b/src/H5SHprivate.h
deleted file mode 100644
index 375be19..0000000
--- a/src/H5SHprivate.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*-------------------------------------------------------------------------
- *
- * Created: H5SHprivate.h
- * Mar 10 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
- *
- * Purpose: Private header for library accessible segmented heap routines.
- *
- *-------------------------------------------------------------------------
- */
-
-#ifndef _H5SHprivate_H
-#define _H5SHprivate_H
-
-/* Include package's public header */
-#include "H5SHpublic.h"
-
-/* Private headers needed by this file */
-#include "H5Fprivate.h" /* File access */
-
-/**************************/
-/* Library Private Macros */
-/**************************/
-
-
-/****************************/
-/* Library Private Typedefs */
-/****************************/
-
-/* Type of data in heap */
-typedef enum H5SH_data_type_t {
- H5SH_RAW, /* Heap data is "raw data" from dataset */
- H5SH_META /* Heap data is metadata about file's structure */
-} H5SH_data_type_t;
-
-/***************************************/
-/* Library-private Function Prototypes */
-/***************************************/
-H5_DLL herr_t H5SH_create(H5F_t *f, hid_t dxpl_id, haddr_t *addr_p,
- H5SH_data_type_t heap_type, hsize_t min_size, hsize_t max_extend_size);
-H5_DLL herr_t H5SH_alloc(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t size,
- haddr_t *obj_addr_p);
-
-#endif /* _H5SHprivate_H */
-
diff --git a/src/H5SHpublic.h b/src/H5SHpublic.h
deleted file mode 100644
index 2bab6bf..0000000
--- a/src/H5SHpublic.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*-------------------------------------------------------------------------
- *
- * Created: H5SHpublic.h
- * Mar 23 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
- *
- * Purpose: Public declarations for the H5SH package.
- *
- *-------------------------------------------------------------------------
- */
-#ifndef _H5SHpublic_H
-#define _H5SHpublic_H
-
-/* Public headers needed by this file */
-#include "H5public.h"
-
-/*****************/
-/* Public Macros */
-/*****************/
-
-/*******************/
-/* Public Typedefs */
-/*******************/
-
-/**********************************/
-/* Public API Function Prototypes */
-/**********************************/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _H5SHpublic_H */
-
-
diff --git a/src/Makefile.am b/src/Makefile.am
index 48e86c7..d8c82d0 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -39,8 +39,8 @@ MOSTLYCLEANFILES=H5Tinit.c
# library sources
libhdf5_la_SOURCES= H5.c H5A.c H5AC.c H5B.c H5Bcache.c H5B2.c H5B2cache.c \
H5B2dbg.c \
- H5B2test.c H5BP.c H5BPcache.c H5BPdbg.c H5BPtest.c \
- H5BT.c H5BTbtree2.c H5BTcache.c H5BTdbg.c H5BTtest.c H5C.c \
+ H5B2test.c \
+ H5C.c \
H5D.c \
H5Dcompact.c \
H5Dcontig.c \
@@ -67,7 +67,7 @@ libhdf5_la_SOURCES= H5.c H5A.c H5AC.c H5B.c H5Bcache.c H5B2.c H5B2cache.c \
H5P.c H5Pacpl.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 \
+ H5Sselect.c H5Stest.c \
H5SL.c H5ST.c H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c \
H5Tcompound.c H5Tconv.c H5Tcset.c H5Tenum.c H5Tfields.c H5Tfixed.c \
H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c H5Topaque.c \
@@ -79,13 +79,12 @@ libhdf5_la_SOURCES= H5.c H5A.c H5AC.c H5B.c H5Bcache.c H5B2.c H5B2cache.c \
# Public headers
include_HEADERS =H5public.h H5Apublic.h H5ACpublic.h H5Bpublic.h H5B2public.h \
- H5BPpublic.h H5BTpublic.h H5Cpublic.h H5Dpublic.h \
+ H5Cpublic.h H5Dpublic.h \
H5Epubgen.h H5Epublic.h H5Fpublic.h H5FDpublic.h H5FDcore.h H5FDfamily.h \
H5FDfphdf5.h H5FDlog.h H5FDmpi.h H5FDmpio.h H5FDmpiposix.h \
H5FDmulti.h H5FDsec2.h H5FDstdio.h H5FDstream.h H5FPpublic.h \
H5Gpublic.h H5HGpublic.h H5HLpublic.h H5Ipublic.h \
H5MMpublic.h H5Opublic.h H5Ppublic.h H5Rpublic.h H5Spublic.h \
- H5SHpublic.h \
H5Tpublic.h H5Zpublic.h H5pubconf.h hdf5.h H5api_adpt.h
# install libhdf5.settings in lib directory
diff --git a/src/Makefile.in b/src/Makefile.in
index 8ba3688..7a58aa4 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -83,9 +83,7 @@ libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
libhdf5_la_LIBADD =
am_libhdf5_la_OBJECTS = H5.lo H5A.lo H5AC.lo H5B.lo H5Bcache.lo \
- H5B2.lo H5B2cache.lo H5B2dbg.lo H5B2test.lo H5BP.lo \
- H5BPcache.lo H5BPdbg.lo H5BPtest.lo H5BT.lo H5BTbtree2.lo \
- H5BTcache.lo H5BTdbg.lo H5BTtest.lo H5C.lo H5D.lo \
+ H5B2.lo H5B2cache.lo H5B2dbg.lo H5B2test.lo H5C.lo H5D.lo \
H5Dcompact.lo H5Dcontig.lo H5Defl.lo H5Dio.lo H5Distore.lo \
H5Dmpio.lo H5Doh.lo H5Dselect.lo H5Dtest.lo H5E.lo H5F.lo \
H5Fdbg.lo H5Fmount.lo H5Fsfile.lo H5Fsuper.lo H5FD.lo \
@@ -103,14 +101,13 @@ am_libhdf5_la_OBJECTS = H5.lo H5A.lo H5AC.lo H5B.lo H5Bcache.lo \
H5P.lo H5Pacpl.lo H5Pdcpl.lo H5Pdxpl.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 H5Tcommit.lo \
- H5Tcompound.lo H5Tconv.lo H5Tcset.lo H5Tenum.lo H5Tfields.lo \
- H5Tfixed.lo H5Tfloat.lo H5Tinit.lo H5Tnative.lo H5Toffset.lo \
- H5Toh.lo H5Topaque.lo H5Torder.lo H5Tpad.lo H5Tprecis.lo \
- H5Tstrpad.lo H5Tvlen.lo H5TS.lo H5V.lo H5Z.lo H5Zdeflate.lo \
- H5Zfletcher32.lo H5Znbit.lo H5Zshuffle.lo H5Zszip.lo \
- H5Zscaleoffset.lo H5Ztrans.lo
+ H5Sselect.lo H5Stest.lo H5SL.lo H5ST.lo H5T.lo H5Tarray.lo \
+ H5Tbit.lo H5Tcommit.lo H5Tcompound.lo H5Tconv.lo H5Tcset.lo \
+ H5Tenum.lo H5Tfields.lo H5Tfixed.lo H5Tfloat.lo H5Tinit.lo \
+ H5Tnative.lo H5Toffset.lo H5Toh.lo H5Topaque.lo H5Torder.lo \
+ H5Tpad.lo H5Tprecis.lo H5Tstrpad.lo H5Tvlen.lo H5TS.lo H5V.lo \
+ H5Z.lo H5Zdeflate.lo H5Zfletcher32.lo H5Znbit.lo H5Zshuffle.lo \
+ H5Zszip.lo H5Zscaleoffset.lo H5Ztrans.lo
libhdf5_la_OBJECTS = $(am_libhdf5_la_OBJECTS)
PROGRAMS = $(noinst_PROGRAMS)
H5detect_SOURCES = H5detect.c
@@ -393,8 +390,8 @@ MOSTLYCLEANFILES = H5Tinit.c
# library sources
libhdf5_la_SOURCES = H5.c H5A.c H5AC.c H5B.c H5Bcache.c H5B2.c H5B2cache.c \
H5B2dbg.c \
- H5B2test.c H5BP.c H5BPcache.c H5BPdbg.c H5BPtest.c \
- H5BT.c H5BTbtree2.c H5BTcache.c H5BTdbg.c H5BTtest.c H5C.c \
+ H5B2test.c \
+ H5C.c \
H5D.c \
H5Dcompact.c \
H5Dcontig.c \
@@ -421,7 +418,7 @@ libhdf5_la_SOURCES = H5.c H5A.c H5AC.c H5B.c H5Bcache.c H5B2.c H5B2cache.c \
H5P.c H5Pacpl.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 \
+ H5Sselect.c H5Stest.c \
H5SL.c H5ST.c H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c \
H5Tcompound.c H5Tconv.c H5Tcset.c H5Tenum.c H5Tfields.c H5Tfixed.c \
H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c H5Topaque.c \
@@ -433,13 +430,12 @@ libhdf5_la_SOURCES = H5.c H5A.c H5AC.c H5B.c H5Bcache.c H5B2.c H5B2cache.c \
# Public headers
include_HEADERS = H5public.h H5Apublic.h H5ACpublic.h H5Bpublic.h H5B2public.h \
- H5BPpublic.h H5BTpublic.h H5Cpublic.h H5Dpublic.h \
+ H5Cpublic.h H5Dpublic.h \
H5Epubgen.h H5Epublic.h H5Fpublic.h H5FDpublic.h H5FDcore.h H5FDfamily.h \
H5FDfphdf5.h H5FDlog.h H5FDmpi.h H5FDmpio.h H5FDmpiposix.h \
H5FDmulti.h H5FDsec2.h H5FDstdio.h H5FDstream.h H5FPpublic.h \
H5Gpublic.h H5HGpublic.h H5HLpublic.h H5Ipublic.h \
H5MMpublic.h H5Opublic.h H5Ppublic.h H5Rpublic.h H5Spublic.h \
- H5SHpublic.h \
H5Tpublic.h H5Zpublic.h H5pubconf.h hdf5.h H5api_adpt.h
@@ -570,15 +566,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2cache.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2dbg.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2test.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5BP.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5BPcache.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5BPdbg.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5BPtest.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5BT.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5BTbtree2.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5BTcache.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5BTdbg.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5BTtest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Bcache.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5C.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5D.Plo@am__quote@
@@ -668,9 +655,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5RC.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5RS.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5S.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5SH.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5SHcache.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5SHdbg.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5SL.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5ST.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Sall.Plo@am__quote@
diff --git a/test/Makefile.am b/test/Makefile.am
index 0b1f7f2..8e22514 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -32,7 +32,7 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT)
# executed, generally most specific tests to least specific tests.
# As an exception, long-running tests should occur earlier in the list.
# This gives them more time to run when tests are executing in parallel.
-TEST_PROG=testhdf5 lheap ohdr stab gheap btree2 cache cache_api b+tree blocktrack sheap \
+TEST_PROG=testhdf5 lheap ohdr stab gheap btree2 cache cache_api \
pool hyperslab istore bittests dt_arith \
dtypes dsets cmpd_dset extend external objcopy links unlink big mtime \
fillval mount flush1 flush2 enum \
@@ -107,7 +107,7 @@ CHECK_CLEANFILES+=cmpd_dset.h5 compact_dataset.h5 dataset.h5 extend.h5 istore.h5
family_file000[0-3][0-9].h5 multi_file-[rs].h5 core_file \
new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 err_compat.h5 \
dtransform.h5 test_filters.h5 get_file_name.h5 tstint[1-2].h5 \
- unlink_chunked.h5 btree2.h5 blocktrack.h5 sheap.h5 b+tree.h5 \
+ unlink_chunked.h5 btree2.h5 \
objcopy_src.h5 objcopy_dst.h5 objcopy_ext.dat
# Sources for testhdf5 executable
diff --git a/test/Makefile.in b/test/Makefile.in
index f8dac31..2be16e9 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -31,7 +31,7 @@
#
-SOURCES = $(libh5test_la_SOURCES) b+tree.c big.c bittests.c blocktrack.c btree2.c cache.c cache_api.c cmpd_dset.c dangle.c dsets.c dt_arith.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.c fillval.c flush1.c flush2.c gen_deflate.c gen_filters.c gen_new_array.c gen_new_fill.c gen_new_group.c gen_new_mtime.c gen_new_super.c gen_noencoder.c gen_nullspace.c getname.c gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c reserved.c set_extent.c sheap.c space_overflow.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c
+SOURCES = $(libh5test_la_SOURCES) big.c bittests.c btree2.c cache.c cache_api.c cmpd_dset.c dangle.c dsets.c dt_arith.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.c fillval.c flush1.c flush2.c gen_deflate.c gen_filters.c gen_new_array.c gen_new_fill.c gen_new_group.c gen_new_mtime.c gen_new_super.c gen_noencoder.c gen_nullspace.c getname.c gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c reserved.c set_extent.c space_overflow.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c
srcdir = @srcdir@
top_srcdir = @top_srcdir@
@@ -75,8 +75,7 @@ am_libh5test_la_OBJECTS = h5test.lo testframe.lo cache_common.lo
libh5test_la_OBJECTS = $(am_libh5test_la_OBJECTS)
am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \
stab$(EXEEXT) gheap$(EXEEXT) btree2$(EXEEXT) cache$(EXEEXT) \
- cache_api$(EXEEXT) b+tree$(EXEEXT) blocktrack$(EXEEXT) \
- sheap$(EXEEXT) pool$(EXEEXT) hyperslab$(EXEEXT) \
+ cache_api$(EXEEXT) pool$(EXEEXT) hyperslab$(EXEEXT) \
istore$(EXEEXT) bittests$(EXEEXT) dt_arith$(EXEEXT) \
dtypes$(EXEEXT) dsets$(EXEEXT) cmpd_dset$(EXEEXT) \
extend$(EXEEXT) external$(EXEEXT) objcopy$(EXEEXT) \
@@ -97,23 +96,15 @@ am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \
@BUILD_ALL_CONDITIONAL_TRUE@ gen_nullspace$(EXEEXT) \
@BUILD_ALL_CONDITIONAL_TRUE@ space_overflow$(EXEEXT)
PROGRAMS = $(noinst_PROGRAMS)
-b_tree_SOURCES = b+tree.c
-b_tree_OBJECTS = b+tree.$(OBJEXT)
-b_tree_LDADD = $(LDADD)
-am__DEPENDENCIES_1 = $(top_builddir)/src/libhdf5.la
-b_tree_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1)
big_SOURCES = big.c
big_OBJECTS = big.$(OBJEXT)
big_LDADD = $(LDADD)
+am__DEPENDENCIES_1 = $(top_builddir)/src/libhdf5.la
big_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1)
bittests_SOURCES = bittests.c
bittests_OBJECTS = bittests.$(OBJEXT)
bittests_LDADD = $(LDADD)
bittests_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1)
-blocktrack_SOURCES = blocktrack.c
-blocktrack_OBJECTS = blocktrack.$(OBJEXT)
-blocktrack_LDADD = $(LDADD)
-blocktrack_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1)
btree2_SOURCES = btree2.c
btree2_OBJECTS = btree2.$(OBJEXT)
btree2_LDADD = $(LDADD)
@@ -274,10 +265,6 @@ set_extent_SOURCES = set_extent.c
set_extent_OBJECTS = set_extent.$(OBJEXT)
set_extent_LDADD = $(LDADD)
set_extent_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1)
-sheap_SOURCES = sheap.c
-sheap_OBJECTS = sheap.$(OBJEXT)
-sheap_LDADD = $(LDADD)
-sheap_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1)
space_overflow_SOURCES = space_overflow.c
space_overflow_OBJECTS = space_overflow.$(OBJEXT)
space_overflow_LDADD = $(LDADD)
@@ -330,28 +317,28 @@ LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(libh5test_la_SOURCES) b+tree.c big.c bittests.c \
- blocktrack.c btree2.c cache.c cache_api.c cmpd_dset.c dangle.c \
- dsets.c dt_arith.c dtransform.c dtypes.c enum.c err_compat.c \
- error_test.c extend.c external.c fillval.c flush1.c flush2.c \
- gen_deflate.c gen_filters.c gen_new_array.c gen_new_fill.c \
- gen_new_group.c gen_new_mtime.c gen_new_super.c \
- gen_noencoder.c gen_nullspace.c getname.c gheap.c hyperslab.c \
- istore.c lheap.c links.c mount.c mtime.c ntypes.c objcopy.c \
- ohdr.c pool.c reserved.c set_extent.c sheap.c space_overflow.c \
- stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c \
- $(ttsafe_SOURCES) unlink.c vfd.c
-DIST_SOURCES = $(libh5test_la_SOURCES) b+tree.c big.c bittests.c \
- blocktrack.c btree2.c cache.c cache_api.c cmpd_dset.c dangle.c \
- dsets.c dt_arith.c dtransform.c dtypes.c enum.c err_compat.c \
- error_test.c extend.c external.c fillval.c flush1.c flush2.c \
- gen_deflate.c gen_filters.c gen_new_array.c gen_new_fill.c \
- gen_new_group.c gen_new_mtime.c gen_new_super.c \
- gen_noencoder.c gen_nullspace.c getname.c gheap.c hyperslab.c \
- istore.c lheap.c links.c mount.c mtime.c ntypes.c objcopy.c \
- ohdr.c pool.c reserved.c set_extent.c sheap.c space_overflow.c \
- stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c \
- $(ttsafe_SOURCES) unlink.c vfd.c
+SOURCES = $(libh5test_la_SOURCES) big.c bittests.c btree2.c cache.c \
+ cache_api.c cmpd_dset.c dangle.c dsets.c dt_arith.c \
+ dtransform.c dtypes.c enum.c err_compat.c error_test.c \
+ extend.c external.c fillval.c flush1.c flush2.c gen_deflate.c \
+ gen_filters.c gen_new_array.c gen_new_fill.c gen_new_group.c \
+ gen_new_mtime.c gen_new_super.c gen_noencoder.c \
+ gen_nullspace.c getname.c gheap.c hyperslab.c istore.c lheap.c \
+ links.c mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c \
+ reserved.c set_extent.c space_overflow.c stab.c stream_test.c \
+ $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c \
+ vfd.c
+DIST_SOURCES = $(libh5test_la_SOURCES) big.c bittests.c btree2.c \
+ cache.c cache_api.c cmpd_dset.c dangle.c dsets.c dt_arith.c \
+ dtransform.c dtypes.c enum.c err_compat.c error_test.c \
+ extend.c external.c fillval.c flush1.c flush2.c gen_deflate.c \
+ gen_filters.c gen_new_array.c gen_new_fill.c gen_new_group.c \
+ gen_new_mtime.c gen_new_super.c gen_noencoder.c \
+ gen_nullspace.c getname.c gheap.c hyperslab.c istore.c lheap.c \
+ links.c mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c \
+ reserved.c set_extent.c space_overflow.c stab.c stream_test.c \
+ $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c \
+ vfd.c
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -612,9 +599,8 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog cmpd_dset.h5 \
family_file000[0-3][0-9].h5 multi_file-[rs].h5 core_file \
new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 \
err_compat.h5 dtransform.h5 test_filters.h5 get_file_name.h5 \
- tstint[1-2].h5 unlink_chunked.h5 btree2.h5 blocktrack.h5 \
- sheap.h5 b+tree.h5 objcopy_src.h5 objcopy_dst.h5 \
- objcopy_ext.dat
+ tstint[1-2].h5 unlink_chunked.h5 btree2.h5 objcopy_src.h5 \
+ objcopy_dst.h5 objcopy_ext.dat
INCLUDES = -I$(top_srcdir)/src -I$(top_builddir)/src
# Test script for error_test and err_compat
@@ -626,7 +612,7 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT)
# executed, generally most specific tests to least specific tests.
# As an exception, long-running tests should occur earlier in the list.
# This gives them more time to run when tests are executing in parallel.
-TEST_PROG = testhdf5 lheap ohdr stab gheap btree2 cache cache_api b+tree blocktrack sheap \
+TEST_PROG = testhdf5 lheap ohdr stab gheap btree2 cache cache_api \
pool hyperslab istore bittests dt_arith \
dtypes dsets cmpd_dset extend external objcopy links unlink big mtime \
fillval mount flush1 flush2 enum \
@@ -739,18 +725,12 @@ clean-noinstPROGRAMS:
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
-b+tree$(EXEEXT): $(b_tree_OBJECTS) $(b_tree_DEPENDENCIES)
- @rm -f b+tree$(EXEEXT)
- $(LINK) $(b_tree_LDFLAGS) $(b_tree_OBJECTS) $(b_tree_LDADD) $(LIBS)
big$(EXEEXT): $(big_OBJECTS) $(big_DEPENDENCIES)
@rm -f big$(EXEEXT)
$(LINK) $(big_LDFLAGS) $(big_OBJECTS) $(big_LDADD) $(LIBS)
bittests$(EXEEXT): $(bittests_OBJECTS) $(bittests_DEPENDENCIES)
@rm -f bittests$(EXEEXT)
$(LINK) $(bittests_LDFLAGS) $(bittests_OBJECTS) $(bittests_LDADD) $(LIBS)
-blocktrack$(EXEEXT): $(blocktrack_OBJECTS) $(blocktrack_DEPENDENCIES)
- @rm -f blocktrack$(EXEEXT)
- $(LINK) $(blocktrack_LDFLAGS) $(blocktrack_OBJECTS) $(blocktrack_LDADD) $(LIBS)
btree2$(EXEEXT): $(btree2_OBJECTS) $(btree2_DEPENDENCIES)
@rm -f btree2$(EXEEXT)
$(LINK) $(btree2_LDFLAGS) $(btree2_OBJECTS) $(btree2_LDADD) $(LIBS)
@@ -871,9 +851,6 @@ reserved$(EXEEXT): $(reserved_OBJECTS) $(reserved_DEPENDENCIES)
set_extent$(EXEEXT): $(set_extent_OBJECTS) $(set_extent_DEPENDENCIES)
@rm -f set_extent$(EXEEXT)
$(LINK) $(set_extent_LDFLAGS) $(set_extent_OBJECTS) $(set_extent_LDADD) $(LIBS)
-sheap$(EXEEXT): $(sheap_OBJECTS) $(sheap_DEPENDENCIES)
- @rm -f sheap$(EXEEXT)
- $(LINK) $(sheap_LDFLAGS) $(sheap_OBJECTS) $(sheap_LDADD) $(LIBS)
space_overflow$(EXEEXT): $(space_overflow_OBJECTS) $(space_overflow_DEPENDENCIES)
@rm -f space_overflow$(EXEEXT)
$(LINK) $(space_overflow_LDFLAGS) $(space_overflow_OBJECTS) $(space_overflow_LDADD) $(LIBS)
@@ -905,10 +882,8 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/b+tree.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/big.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bittests.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blocktrack.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/btree2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache_api.Po@am__quote@
@@ -951,7 +926,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pool.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reserved.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_extent.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sheap.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/space_overflow.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stab.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_test.Po@am__quote@
diff --git a/test/b+tree.c b/test/b+tree.c
deleted file mode 100644
index b29c192..0000000
--- a/test/b+tree.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
- * Tuesday, April 19, 2005
- */
-#include "h5test.h"
-
-/*
- * This file needs to access private datatypes from the H5BP package.
- * This file also needs to access the B+ tree testing code.
- */
-#define H5BP_PACKAGE
-#define H5BP_TESTING
-#include "H5BPpkg.h"
-
-/* Other private headers that this test requires */
-#include "H5Iprivate.h"
-
-const char *FILENAME[] = {
- "b+tree",
- NULL
-};
-
-#define NODE_SIZE 512
-
-
-/*-------------------------------------------------------------------------
- * Function: test_create
- *
- * Purpose: Basic tests for the B+ tree code
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Tuesday, April 19, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_create(hid_t fapl)
-{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- haddr_t bpt_addr; /* Address of B+ tree created */
-
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if (NULL==(f=H5I_object(file)))
- STACK_ERROR
-
- /*
- * Test B+ tree creation
- */
- TESTING("B+ tree creation");
- if (H5BP_create(f, H5P_DATASET_XFER_DEFAULT, H5BP_TEST, NODE_SIZE, 100, 40, &bpt_addr/*out*/)<0)
- FAIL_STACK_ERROR
-
- PASSED();
-
- if (H5Fclose(file)<0)
- STACK_ERROR
-
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-} /* test_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: test_insert_basic
- *
- * Purpose: Basic tests for the B+ tree code
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Tuesday, April 19, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-#ifdef QAK
-static int
-test_insert_basic(hid_t fapl)
-{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- char *record; /* Record to insert into tree */
- haddr_t bpt_addr; /* Address of B+ tree created */
-
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if (NULL==(f=H5I_object(file)))
- STACK_ERROR
-
- /* Create B+ tree */
- if (H5BP_create(f, H5P_DATASET_XFER_DEFAULT, H5BP_TEST, NODE_SIZE, 100, 40, &bpt_addr/*out*/)<0)
- FAIL_STACK_ERROR
-
- /*
- * Test B+ tree creation
- */
- TESTING("B+ tree single record insert");
- record="Foo!";
- if (H5BP_insert(f, H5P_DATASET_XFER_DEFAULT, H5BP_TEST, bpt_addr, &record)<0)
- FAIL_STACK_ERROR
-
- PASSED();
-
- if (H5Fclose(file)<0)
- STACK_ERROR
-
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-} /* test_insert_basic() */
-#endif /* QAK */
-
-
-/*-------------------------------------------------------------------------
- * Function: main
- *
- * Purpose: Test the B+ tree code
- *
- * Return: Success:
- *
- * Failure:
- *
- * Programmer: Quincey Koziol
- * Tuesday, April 19, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-int
-main(void)
-{
- hid_t fapl=-1;
- int nerrors=0;
-
- /* Reset library */
- h5_reset();
- fapl = h5_fileaccess();
-
- /* Test B+ tree creation */
- nerrors += test_create(fapl);
-
- /* Test B+ tree record insertion */
- /* Iteration, find & index routines tested in these routines as well */
-#ifdef QAK
- nerrors += test_insert_basic(fapl);
-#endif /* QAK */
-
- if (nerrors) goto error;
- puts("All B+ tree tests passed.");
-#ifndef QAK
- h5_cleanup(FILENAME, fapl);
-#else /* QAK */
-HDfprintf(stderr,"Uncomment cleanup!\n");
-#endif /* QAK */
- return 0;
-
-error:
- puts("*** TESTS FAILED ***");
- H5E_BEGIN_TRY {
- H5Pclose(fapl);
- } H5E_END_TRY;
- return 1;
-}
-
diff --git a/test/blocktrack.c b/test/blocktrack.c
deleted file mode 100644
index 28d9c28..0000000
--- a/test/blocktrack.c
+++ /dev/null
@@ -1,1949 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
- * Wednesday, March 9, 2005
- */
-#include "h5test.h"
-
-/*
- * This file needs to access private datatypes from the H5BT package.
- * This file also needs to access the block tracker testing code.
- */
-#define H5BT_PACKAGE
-#define H5BT_TESTING
-#include "H5BTpkg.h"
-
-/* Other private headers that this test requires */
-#include "H5Iprivate.h"
-
-const char *FILENAME[] = {
- "blocktrack",
- NULL
-};
-
-#define INSERT_MANY 100
-
-
-/*-------------------------------------------------------------------------
- * Function: iter_cb
- *
- * Purpose: Block tracker iterator callback
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Friday, March 25, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-iter_cb(const H5BT_blk_info_t *record, void *_op_data)
-{
- haddr_t *addr = (haddr_t *)_op_data;
-
- if(record->addr != *addr)
- return(H5B2_ITER_ERROR);
-
- *addr *= 2;
- return(H5B2_ITER_CONT);
-} /* end iter_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: test_create
- *
- * Purpose: Basic tests for the block tracker code
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Wednesday, March 9, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_create(hid_t fapl)
-{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- haddr_t bt_addr; /* Address of block tracker created */
- hsize_t tot_size; /* Total size of blocks tracked */
- hsize_t max_size; /* Max. size of blocks tracked */
- uint32_t max_count; /* Ref. count of max. size of blocks tracked */
- hbool_t max_valid; /* Is max. size valid over all blocks? */
- hsize_t min_size; /* Min. size of blocks tracked */
- uint32_t min_count; /* Ref. count of min. size of blocks tracked */
- hbool_t min_valid; /* Is min. size valid over all blocks? */
-
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
-
- /* Get a pointer to the internal file object */
- if (NULL==(f=H5I_object(file))) {
- H5Eprint_stack(H5E_DEFAULT, stdout);
- TEST_ERROR;
- } /* end if */
-
- /*
- * Test block tracker creation
- */
- TESTING("block tracker creation");
- if (H5BT_create(f, H5P_DATASET_XFER_DEFAULT, &bt_addr/*out*/)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_get_total_size(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &tot_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the size is correct */
- if(tot_size != 0) TEST_ERROR;
-
- if (H5BT_get_max_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &max_size, &max_count, &max_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(max_size != 0) TEST_ERROR;
- if(max_count != 0) TEST_ERROR;
- if(max_valid != 0) TEST_ERROR;
-
- if (H5BT_get_min_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &min_size, &min_count, &min_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(min_size != HSIZET_MAX) TEST_ERROR;
- if(min_count != 0) TEST_ERROR;
- if(min_valid != 0) TEST_ERROR;
-
- PASSED();
-
- if (H5Fclose(file)<0) TEST_ERROR;
-
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-} /* test_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: test_insert_one
- *
- * Purpose: Basic tests for the block tracker code
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Thursday, March 10, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_insert_one(hid_t fapl)
-{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- haddr_t bt_addr; /* Address of block tracker created */
- hsize_t tot_size; /* Total size of blocks tracked */
- hsize_t max_size; /* Max. size of blocks tracked */
- uint32_t max_count; /* Ref. count of max. size of blocks tracked */
- hbool_t max_valid; /* Is max. size valid over all blocks? */
- hsize_t min_size; /* Min. size of blocks tracked */
- uint32_t min_count; /* Ref. count of min. size of blocks tracked */
- hbool_t min_valid; /* Is min. size valid over all blocks? */
-
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
-
- /* Get a pointer to the internal file object */
- if (NULL==(f=H5I_object(file))) {
- H5Eprint_stack(H5E_DEFAULT, stdout);
- TEST_ERROR;
- } /* end if */
-
- /*
- * Test inserting one block
- */
- TESTING("insert 1 block");
- if (H5BT_create(f, H5P_DATASET_XFER_DEFAULT, &bt_addr/*out*/)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)10, (hsize_t)20)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_get_total_size(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &tot_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the size is correct */
- if(tot_size != 20) TEST_ERROR;
-
- if (H5BT_get_max_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &max_size, &max_count, &max_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(max_size != 20) TEST_ERROR;
- if(max_count != 1) TEST_ERROR;
- if(max_valid != 1) TEST_ERROR;
-
- if (H5BT_get_min_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &min_size, &min_count, &min_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(min_size != 20) TEST_ERROR;
- if(min_count != 1) TEST_ERROR;
- if(min_valid != 1) TEST_ERROR;
-
- PASSED();
-
- if (H5Fclose(file)<0) TEST_ERROR;
-
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-} /* test_insert_one() */
-
-
-/*-------------------------------------------------------------------------
- * Function: test_insert_few
- *
- * Purpose: Basic tests for the block tracker code
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Thursday, March 10, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_insert_few(hid_t fapl)
-{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- haddr_t bt_addr; /* Address of block tracker created */
- hsize_t tot_size; /* Total size of blocks tracked */
- hsize_t max_size; /* Max. size of blocks tracked */
- uint32_t max_count; /* Ref. count of max. size of blocks tracked */
- hbool_t max_valid; /* Is max. size valid over all blocks? */
- hsize_t min_size; /* Min. size of blocks tracked */
- uint32_t min_count; /* Ref. count of min. size of blocks tracked */
- hbool_t min_valid; /* Is min. size valid over all blocks? */
-
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
-
- /* Get a pointer to the internal file object */
- if (NULL==(f=H5I_object(file))) {
- H5Eprint_stack(H5E_DEFAULT, stdout);
- TEST_ERROR;
- } /* end if */
-
- /*
- * Test inserting one block
- */
- TESTING("insert several blocks");
- if (H5BT_create(f, H5P_DATASET_XFER_DEFAULT, &bt_addr/*out*/)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)10, (hsize_t)20)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_get_total_size(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &tot_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the size is correct */
- if(tot_size != 20) TEST_ERROR;
-
- if (H5BT_get_max_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &max_size, &max_count, &max_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(max_size != 20) TEST_ERROR;
- if(max_count != 1) TEST_ERROR;
- if(max_valid != 1) TEST_ERROR;
-
- if (H5BT_get_min_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &min_size, &min_count, &min_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the min. info is correct */
- if(min_size != 20) TEST_ERROR;
- if(min_count != 1) TEST_ERROR;
- if(min_valid != 1) TEST_ERROR;
-
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)50, (hsize_t)30)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_get_total_size(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &tot_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the size is correct */
- if(tot_size != 50) TEST_ERROR;
-
- if (H5BT_get_max_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &max_size, &max_count, &max_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(max_size != 30) TEST_ERROR;
- if(max_count != 1) TEST_ERROR;
- if(max_valid != 1) TEST_ERROR;
-
- if (H5BT_get_min_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &min_size, &min_count, &min_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the min. info is correct */
- if(min_size != 20) TEST_ERROR;
- if(min_count != 1) TEST_ERROR;
- if(min_valid != 1) TEST_ERROR;
-
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)90, (hsize_t)30)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_get_total_size(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &tot_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the size is correct */
- if(tot_size != 80) TEST_ERROR;
-
- if (H5BT_get_max_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &max_size, &max_count, &max_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(max_size != 30) TEST_ERROR;
- if(max_count != 2) TEST_ERROR;
- if(max_valid != 1) TEST_ERROR;
-
- if (H5BT_get_min_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &min_size, &min_count, &min_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the min. info is correct */
- if(min_size != 20) TEST_ERROR;
- if(min_count != 1) TEST_ERROR;
- if(min_valid != 1) TEST_ERROR;
-
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)130, (hsize_t)20)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_get_total_size(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &tot_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the size is correct */
- if(tot_size != 100) TEST_ERROR;
-
- if (H5BT_get_max_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &max_size, &max_count, &max_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(max_size != 30) TEST_ERROR;
- if(max_count != 2) TEST_ERROR;
- if(max_valid != 1) TEST_ERROR;
-
- if (H5BT_get_min_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &min_size, &min_count, &min_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the min. info is correct */
- if(min_size != 20) TEST_ERROR;
- if(min_count != 2) TEST_ERROR;
- if(min_valid != 1) TEST_ERROR;
-
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)160, (hsize_t)10)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_get_total_size(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &tot_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the size is correct */
- if(tot_size != 110) TEST_ERROR;
-
- if (H5BT_get_max_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &max_size, &max_count, &max_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(max_size != 30) TEST_ERROR;
- if(max_count != 2) TEST_ERROR;
- if(max_valid != 1) TEST_ERROR;
-
- if (H5BT_get_min_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &min_size, &min_count, &min_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the min. info is correct */
- if(min_size != 10) TEST_ERROR;
- if(min_count != 1) TEST_ERROR;
- if(min_valid != 1) TEST_ERROR;
-
- PASSED();
-
- if (H5Fclose(file)<0) TEST_ERROR;
-
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-} /* test_insert_one() */
-
-
-/*-------------------------------------------------------------------------
- * Function: test_insert_many
- *
- * Purpose: Basic tests for the block tracker code
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Thursday, March 10, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_insert_many(hid_t fapl)
-{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- haddr_t bt_addr; /* Address of block tracker created */
- unsigned u; /* Local index variable */
- hsize_t tot_size; /* Total size of blocks tracked */
- hsize_t max_size; /* Max. size of blocks tracked */
- uint32_t max_count; /* Ref. count of max. size of blocks tracked */
- hbool_t max_valid; /* Is max. size valid over all blocks? */
- hsize_t min_size; /* Min. size of blocks tracked */
- uint32_t min_count; /* Ref. count of min. size of blocks tracked */
- hbool_t min_valid; /* Is min. size valid over all blocks? */
-
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
-
- /* Get a pointer to the internal file object */
- if (NULL==(f=H5I_object(file))) {
- H5Eprint_stack(H5E_DEFAULT, stdout);
- TEST_ERROR;
- } /* end if */
-
- if (H5BT_create(f, H5P_DATASET_XFER_DEFAULT, &bt_addr/*out*/)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- /*
- * Test inserting many, non-overlapping, non-mergeable blocks
- */
- TESTING("insert many blocks");
- for(u = 0; u < INSERT_MANY; u++) {
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)(u*50), (hsize_t)20)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_get_total_size(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &tot_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the size is correct */
- if(tot_size != ((u+1)*20)) TEST_ERROR;
-
- if (H5BT_get_max_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &max_size, &max_count, &max_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(max_size != 20) TEST_ERROR;
- if(max_count != (u+1)) TEST_ERROR;
- if(max_valid != 1) TEST_ERROR;
-
- if (H5BT_get_min_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &min_size, &min_count, &min_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the min. info is correct */
- if(min_size != 20) TEST_ERROR;
- if(min_count != (u+1)) TEST_ERROR;
- if(min_valid != 1) TEST_ERROR;
-
- } /* end for */
-
- PASSED();
-
- if (H5Fclose(file)<0) TEST_ERROR;
-
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-} /* test_insert_many() */
-
-
-/*-------------------------------------------------------------------------
- * Function: test_insert_overlap
- *
- * Purpose: Basic tests for the block tracker code
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Thursday, March 10, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_insert_overlap(hid_t fapl)
-{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- haddr_t bt_addr; /* Address of block tracker created */
- herr_t ret; /* Generic return value */
-
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
-
- /* Get a pointer to the internal file object */
- if (NULL==(f=H5I_object(file))) {
- H5Eprint_stack(H5E_DEFAULT, stdout);
- TEST_ERROR;
- } /* end if */
-
- if (H5BT_create(f, H5P_DATASET_XFER_DEFAULT, &bt_addr/*out*/)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- /* Insert first block */
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)10, (hsize_t)20)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- /*
- * Test inserting overlapping blocks
- */
- TESTING("insert overlapping blocks");
-
- /* Insert same block again (should fail) */
- H5E_BEGIN_TRY {
- ret = H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)10, (hsize_t)20);
- } H5E_END_TRY;
- if (ret != FAIL) TEST_ERROR;
-
- /* Insert block of different size at same address (should fail) */
- H5E_BEGIN_TRY {
- ret = H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)10, (hsize_t)10);
- } H5E_END_TRY;
- if (ret != FAIL) TEST_ERROR;
-
- /* Insert block which overlaps beginning of existing block (should fail) */
- H5E_BEGIN_TRY {
- ret = H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)5, (hsize_t)10);
- } H5E_END_TRY;
- if (ret != FAIL) TEST_ERROR;
-
- /* Insert block which overlaps end of existing block (should fail) */
- H5E_BEGIN_TRY {
- ret = H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)25, (hsize_t)10);
- } H5E_END_TRY;
- if (ret != FAIL) TEST_ERROR;
-
- /* Insert block which includes existing block (should fail) */
- H5E_BEGIN_TRY {
- ret = H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)5, (hsize_t)30);
- } H5E_END_TRY;
- if (ret != FAIL) TEST_ERROR;
-
- /* Insert block which is inside existing block (should fail) */
- H5E_BEGIN_TRY {
- ret = H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)15, (hsize_t)10);
- } H5E_END_TRY;
- if (ret != FAIL) TEST_ERROR;
-
- PASSED();
-
- if (H5Fclose(file)<0) TEST_ERROR;
-
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-} /* test_insert_overlap() */
-
-
-/*-------------------------------------------------------------------------
- * Function: test_insert_merge
- *
- * Purpose: Basic tests for the block tracker code
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Thursday, March 10, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_insert_merge(hid_t fapl)
-{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- haddr_t bt_addr; /* Address of block tracker created */
- hsize_t tot_size; /* Total size of blocks tracked */
- hsize_t max_size; /* Max. size of blocks tracked */
- uint32_t max_count; /* Ref. count of max. size of blocks tracked */
- hbool_t max_valid; /* Is max. size valid over all blocks? */
- hsize_t min_size; /* Min. size of blocks tracked */
- uint32_t min_count; /* Ref. count of min. size of blocks tracked */
- hbool_t min_valid; /* Is min. size valid over all blocks? */
-
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
-
- /* Get a pointer to the internal file object */
- if (NULL==(f=H5I_object(file))) {
- H5Eprint_stack(H5E_DEFAULT, stdout);
- TEST_ERROR;
- } /* end if */
-
- if (H5BT_create(f, H5P_DATASET_XFER_DEFAULT, &bt_addr/*out*/)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- /* Insert first block */
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)10, (hsize_t)20)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- /*
- * Test inserting blocks which should merge into existing block(s)
- */
- TESTING("insert block which merges with existing upper block");
-
- /* Insert block which should merge with beginning of existing block */
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)8, (hsize_t)2)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_get_total_size(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &tot_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the size is correct */
- if(tot_size != 22) TEST_ERROR;
-
- if (H5BT_get_max_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &max_size, &max_count, &max_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(max_size != 22) TEST_ERROR;
- if(max_count != 1) TEST_ERROR;
- if(max_valid != 1) TEST_ERROR;
-
- if (H5BT_get_min_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &min_size, &min_count, &min_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the min. info is correct */
- if(min_size != 22) TEST_ERROR;
- if(min_count != 1) TEST_ERROR;
- if(min_valid != 0) TEST_ERROR;
-
- PASSED();
-
- /*
- * Test inserting blocks which should merge into existing block(s)
- */
- TESTING("insert block which merges with existing lower block");
-
- /* Insert block which should merge with end of existing block */
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)30, (hsize_t)4)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_get_total_size(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &tot_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the size is correct */
- if(tot_size != 26) TEST_ERROR;
-
- if (H5BT_get_max_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &max_size, &max_count, &max_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(max_size != 26) TEST_ERROR;
- if(max_count != 1) TEST_ERROR;
- if(max_valid != 1) TEST_ERROR;
-
- if (H5BT_get_min_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &min_size, &min_count, &min_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the min. info is correct */
- if(min_size != 26) TEST_ERROR;
- if(min_count != 1) TEST_ERROR;
- if(min_valid != 0) TEST_ERROR;
-
- PASSED();
-
- /*
- * Test inserting blocks which should merge into existing block(s)
- */
- TESTING("insert block which merges with existing upper & lower blocks");
-
- /* Insert block to merge with */
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)40, (hsize_t)10) < 0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- /* Insert block which should merge with end of existing block */
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)34, (hsize_t)6) < 0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_get_total_size(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &tot_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the size is correct */
- if(tot_size != 42) TEST_ERROR;
-
- if (H5BT_get_max_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &max_size, &max_count, &max_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(max_size != 42) TEST_ERROR;
- if(max_count != 1) TEST_ERROR;
- if(max_valid != 1) TEST_ERROR;
-
- if (H5BT_get_min_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &min_size, &min_count, &min_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the min. info is correct */
- if(min_size != 42) TEST_ERROR;
- if(min_count != 1) TEST_ERROR;
- if(min_valid != 0) TEST_ERROR;
-
- PASSED();
-
- if (H5Fclose(file)<0) TEST_ERROR;
-
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-} /* test_insert_merge() */
-
-
-/*-------------------------------------------------------------------------
- * Function: test_remove_whole
- *
- * Purpose: Basic tests for the block tracker code
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Friday, March 11, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_remove_whole(hid_t fapl)
-{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- haddr_t bt_addr; /* Address of block tracker created */
- hsize_t tot_size; /* Total size of blocks tracked */
- hsize_t max_size; /* Max. size of blocks tracked */
- uint32_t max_count; /* Ref. count of max. size of blocks tracked */
- hbool_t max_valid; /* Is max. size valid over all blocks? */
- hsize_t min_size; /* Min. size of blocks tracked */
- uint32_t min_count; /* Ref. count of min. size of blocks tracked */
- hbool_t min_valid; /* Is min. size valid over all blocks? */
-
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
-
- /* Get a pointer to the internal file object */
- if (NULL==(f=H5I_object(file))) {
- H5Eprint_stack(H5E_DEFAULT, stdout);
- TEST_ERROR;
- } /* end if */
-
- if (H5BT_create(f, H5P_DATASET_XFER_DEFAULT, &bt_addr/*out*/)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- /* Insert several blocks */
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)50, (hsize_t)20)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)100, (hsize_t)15)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)150, (hsize_t)15)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)200, (hsize_t)35)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)250, (hsize_t)35)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- /*
- * Test removing blocks
- */
- TESTING("remove entire block, in middle of block size range");
- if (H5BT_remove(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)50, (hsize_t)20)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_get_total_size(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &tot_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the size is correct */
- if(tot_size != 100) TEST_ERROR;
-
- if (H5BT_get_max_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &max_size, &max_count, &max_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(max_size != 35) TEST_ERROR;
- if(max_count != 2) TEST_ERROR;
- if(max_valid != 1) TEST_ERROR;
-
- if (H5BT_get_min_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &min_size, &min_count, &min_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the min. info is correct */
- if(min_size != 15) TEST_ERROR;
- if(min_count != 2) TEST_ERROR;
- if(min_valid != 1) TEST_ERROR;
-
- PASSED();
-
- TESTING("remove entire block, at bottom of block size range");
-
- /* Remove first block at min. size */
- if (H5BT_remove(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)100, (hsize_t)15)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_get_total_size(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &tot_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the size is correct */
- if(tot_size != 85) TEST_ERROR;
-
- if (H5BT_get_max_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &max_size, &max_count, &max_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(max_size != 35) TEST_ERROR;
- if(max_count != 2) TEST_ERROR;
- if(max_valid != 1) TEST_ERROR;
-
- if (H5BT_get_min_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &min_size, &min_count, &min_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the min. info is correct */
- if(min_size != 15) TEST_ERROR;
- if(min_count != 1) TEST_ERROR;
- if(min_valid != 1) TEST_ERROR;
-
- /* Remove last block at min. size */
- if (H5BT_remove(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)150, (hsize_t)15)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_get_total_size(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &tot_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the size is correct */
- if(tot_size != 70) TEST_ERROR;
-
- if (H5BT_get_max_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &max_size, &max_count, &max_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(max_size != 35) TEST_ERROR;
- if(max_count != 2) TEST_ERROR;
- if(max_valid != 1) TEST_ERROR;
-
- if (H5BT_get_min_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &min_size, &min_count, &min_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the min. info is correct */
- if(min_size != 35) TEST_ERROR;
- if(min_count != 2) TEST_ERROR;
- if(min_valid != 0) TEST_ERROR;
-
- PASSED();
-
- TESTING("remove entire block, at top of block size range");
-
- /* Remove first block at max. size */
- if (H5BT_remove(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)200, (hsize_t)35)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_get_total_size(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &tot_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the size is correct */
- if(tot_size != 35) TEST_ERROR;
-
- if (H5BT_get_max_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &max_size, &max_count, &max_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(max_size != 35) TEST_ERROR;
- if(max_count != 1) TEST_ERROR;
- if(max_valid != 1) TEST_ERROR;
-
- if (H5BT_get_min_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &min_size, &min_count, &min_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the min. info is correct */
- if(min_size != 35) TEST_ERROR;
- if(min_count != 1) TEST_ERROR;
- if(min_valid != 0) TEST_ERROR;
-
- /* Remove last block at max. size */
- if (H5BT_remove(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)250, (hsize_t)35)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_get_total_size(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &tot_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the size is correct */
- if(tot_size != 0) TEST_ERROR;
-
- if (H5BT_get_max_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &max_size, &max_count, &max_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(max_size != 0) TEST_ERROR;
- if(max_count != 0) TEST_ERROR;
- if(max_valid != 0) TEST_ERROR;
-
- if (H5BT_get_min_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &min_size, &min_count, &min_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the min. info is correct */
- if(min_size != HSIZET_MAX) TEST_ERROR;
- if(min_count != 0) TEST_ERROR;
- if(min_valid != 0) TEST_ERROR;
-
- PASSED();
-
- if (H5Fclose(file)<0) TEST_ERROR;
-
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-} /* test_remove_whole() */
-
-
-/*-------------------------------------------------------------------------
- * Function: test_remove_partial_begin
- *
- * Purpose: Basic tests for the block tracker code
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Friday, March 11, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_remove_partial_begin(hid_t fapl)
-{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- haddr_t bt_addr; /* Address of block tracker created */
- hsize_t tot_size; /* Total size of blocks tracked */
- hsize_t max_size; /* Max. size of blocks tracked */
- uint32_t max_count; /* Ref. count of max. size of blocks tracked */
- hbool_t max_valid; /* Is max. size valid over all blocks? */
- hsize_t min_size; /* Min. size of blocks tracked */
- uint32_t min_count; /* Ref. count of min. size of blocks tracked */
- hbool_t min_valid; /* Is min. size valid over all blocks? */
-
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
-
- /* Get a pointer to the internal file object */
- if (NULL==(f=H5I_object(file))) {
- H5Eprint_stack(H5E_DEFAULT, stdout);
- TEST_ERROR;
- } /* end if */
-
- if (H5BT_create(f, H5P_DATASET_XFER_DEFAULT, &bt_addr/*out*/)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- /* Insert several blocks */
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)50, (hsize_t)20)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)100, (hsize_t)15)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)150, (hsize_t)15)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)200, (hsize_t)35)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)250, (hsize_t)35)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- /*
- * Test removing blocks
- */
- TESTING("remove partial block, at beginning of existing block");
-
-/* Remove piece from block in middle of size range */
- /* Remove partial block */
- if (H5BT_remove(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)50, (hsize_t)3)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_get_total_size(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &tot_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the size is correct */
- if(tot_size != 117) TEST_ERROR;
-
- if (H5BT_get_max_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &max_size, &max_count, &max_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(max_size != 35) TEST_ERROR;
- if(max_count != 2) TEST_ERROR;
- if(max_valid != 1) TEST_ERROR;
-
- if (H5BT_get_min_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &min_size, &min_count, &min_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the min. info is correct */
- if(min_size != 15) TEST_ERROR;
- if(min_count != 2) TEST_ERROR;
- if(min_valid != 1) TEST_ERROR;
-
-/* Remove piece from blocks at max. of size range */
- /* Remove partial block */
- if (H5BT_remove(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)200, (hsize_t)5)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_get_total_size(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &tot_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the size is correct */
- if(tot_size != 112) TEST_ERROR;
-
- if (H5BT_get_max_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &max_size, &max_count, &max_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(max_size != 35) TEST_ERROR;
- if(max_count != 1) TEST_ERROR;
- if(max_valid != 1) TEST_ERROR;
-
- if (H5BT_get_min_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &min_size, &min_count, &min_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the min. info is correct */
- if(min_size != 15) TEST_ERROR;
- if(min_count != 2) TEST_ERROR;
- if(min_valid != 1) TEST_ERROR;
-
- /* Remove partial block */
- if (H5BT_remove(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)250, (hsize_t)5)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_get_total_size(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &tot_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the size is correct */
- if(tot_size != 107) TEST_ERROR;
-
- if (H5BT_get_max_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &max_size, &max_count, &max_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(max_size != 30) TEST_ERROR;
- if(max_count != 1) TEST_ERROR;
- if(max_valid != 0) TEST_ERROR;
-
- if (H5BT_get_min_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &min_size, &min_count, &min_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the min. info is correct */
- if(min_size != 15) TEST_ERROR;
- if(min_count != 2) TEST_ERROR;
- if(min_valid != 1) TEST_ERROR;
-
-/* Remove piece from blocks at min. of size range */
- /* Remove partial block */
- if (H5BT_remove(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)100, (hsize_t)5)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_get_total_size(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &tot_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the size is correct */
- if(tot_size != 102) TEST_ERROR;
-
- if (H5BT_get_max_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &max_size, &max_count, &max_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(max_size != 30) TEST_ERROR;
- if(max_count != 1) TEST_ERROR;
- if(max_valid != 0) TEST_ERROR;
-
- if (H5BT_get_min_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &min_size, &min_count, &min_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the min. info is correct */
- if(min_size != 10) TEST_ERROR;
- if(min_count != 1) TEST_ERROR;
- if(min_valid != 1) TEST_ERROR;
-
- /* Remove partial block */
- if (H5BT_remove(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)150, (hsize_t)5)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5BT_get_total_size(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &tot_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the size is correct */
- if(tot_size != 97) TEST_ERROR;
-
- if (H5BT_get_max_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &max_size, &max_count, &max_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the max. info is correct */
- if(max_size != 30) TEST_ERROR;
- if(max_count != 1) TEST_ERROR;
- if(max_valid != 0) TEST_ERROR;
-
- if (H5BT_get_min_info(f, H5P_DATASET_XFER_DEFAULT, bt_addr, &min_size, &min_count, &min_valid)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- /* Make certain that the min. info is correct */
- if(min_size != 10) TEST_ERROR;
- if(min_count != 2) TEST_ERROR;
- if(min_valid != 1) TEST_ERROR;
-
- PASSED();
-
- if (H5Fclose(file)<0) TEST_ERROR;
-
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-} /* test_remove_partial_begin() */
-
-
-/*-------------------------------------------------------------------------
- * Function: test_locate
- *
- * Purpose: Basic tests for the block tracker code
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Thursday, March 24, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_locate(hid_t fapl)
-{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- haddr_t bt_addr; /* Address of block tracker created */
- haddr_t block_addr; /* Address of block to insert */
- hsize_t block_size; /* Size of block to insert */
- hsize_t search_size; /* Size of block to search for */
- unsigned u; /* Local index variable */
-
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
-
- /* Get a pointer to the internal file object */
- if (NULL==(f=H5I_object(file))) {
- H5Eprint_stack(H5E_DEFAULT, stdout);
- TEST_ERROR;
- } /* end if */
-
- if (H5BT_create(f, H5P_DATASET_XFER_DEFAULT, &bt_addr/*out*/)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- /* Insert blocks */
- block_addr = 2048;
- block_size = 8;
- for(u = 0; u < 10; u++) {
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, block_addr, block_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- /* Increment block address & size for next insertion */
- block_addr *= 2;
- block_size *= 2;
- } /* end for */
-
- TESTING("attempt to locate too large of a block");
-
- search_size = block_size * 2;
- block_addr = HADDR_UNDEF;
- if (H5BT_locate(f, H5P_DATASET_XFER_DEFAULT, bt_addr, search_size, &block_addr, &block_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- if(H5F_addr_defined(block_addr)) TEST_ERROR;
-
- PASSED();
-
- TESTING("locate blocks");
-
- search_size = 8;
- if (H5BT_locate(f, H5P_DATASET_XFER_DEFAULT, bt_addr, search_size, &block_addr, &block_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- if(block_addr != 2048) TEST_ERROR;
- if(block_size != 8) TEST_ERROR;
-
- search_size = 10;
- if (H5BT_locate(f, H5P_DATASET_XFER_DEFAULT, bt_addr, search_size, &block_addr, &block_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- if(block_addr != 4096) TEST_ERROR;
- if(block_size != 16) TEST_ERROR;
-
- search_size = 100;
- if (H5BT_locate(f, H5P_DATASET_XFER_DEFAULT, bt_addr, search_size, &block_addr, &block_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- if(block_addr != 32768) TEST_ERROR;
- if(block_size != 128) TEST_ERROR;
-
- PASSED();
-
- if (H5Fclose(file)<0) TEST_ERROR;
-
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-} /* test_locate() */
-
-
-/*-------------------------------------------------------------------------
- * Function: test_neighbor
- *
- * Purpose: Basic tests for the block tracker code
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Monday, March 28, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_neighbor(hid_t fapl)
-{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- haddr_t bt_addr; /* Address of block tracker created */
- H5BT_blk_info_t block; /* Block located */
- haddr_t search_addr; /* Address of block to search for neighbor of */
- unsigned u; /* Local index variable */
-
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
-
- /* Get a pointer to the internal file object */
- if (NULL==(f=H5I_object(file))) {
- H5Eprint_stack(H5E_DEFAULT, stdout);
- TEST_ERROR;
- } /* end if */
-
- if (H5BT_create(f, H5P_DATASET_XFER_DEFAULT, &bt_addr/*out*/)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- /* Insert blocks */
- block.addr = 2048;
- block.len = 8;
- for(u = 0; u < 10; u++) {
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, block.addr, block.len)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- /* Increment block address & size for next insertion */
- block.addr *= 2;
- block.len *= 2;
- } /* end for */
-
- TESTING("attempt to find neighbor of a block");
-
- search_addr = 4097;
- if (H5BT_neighbor(f, H5P_DATASET_XFER_DEFAULT, bt_addr, H5BT_COMPARE_LESS, search_addr, &block)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- if(block.addr != 4096) TEST_ERROR;
- if(block.len != 16) TEST_ERROR;
-
- search_addr = 4096;
- if (H5BT_neighbor(f, H5P_DATASET_XFER_DEFAULT, bt_addr, H5BT_COMPARE_LESS, search_addr, &block)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- if(block.addr != 2048) TEST_ERROR;
- if(block.len != 8) TEST_ERROR;
-
- PASSED();
-
- if (H5Fclose(file)<0) TEST_ERROR;
-
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-} /* test_locate() */
-
-
-/*-------------------------------------------------------------------------
- * Function: test_iterate
- *
- * Purpose: Basic tests for the block tracker code
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Friday, March 25, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_iterate(hid_t fapl)
-{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- haddr_t bt_addr; /* Address of block tracker created */
- haddr_t block_addr; /* Address of block to insert */
- hsize_t block_size; /* Size of block to insert */
- unsigned u; /* Local index variable */
-
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
-
- /* Get a pointer to the internal file object */
- if (NULL==(f=H5I_object(file))) {
- H5Eprint_stack(H5E_DEFAULT, stdout);
- TEST_ERROR;
- } /* end if */
-
- if (H5BT_create(f, H5P_DATASET_XFER_DEFAULT, &bt_addr/*out*/)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- /* Insert blocks */
- block_addr = 2048;
- block_size = 8;
- for(u = 0; u < 10; u++) {
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, block_addr, block_size)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- /* Increment block address & size for next insertion */
- block_addr *= 2;
- block_size *= 2;
- } /* end for */
-
- TESTING("iterating over blocks");
-
- block_addr = 2048;
- if (H5BT_iterate(f, H5P_DATASET_XFER_DEFAULT, bt_addr, iter_cb, &block_addr)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- PASSED();
-
- if (H5Fclose(file)<0) TEST_ERROR;
-
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-} /* test_iterate() */
-
-
-/*-------------------------------------------------------------------------
- * Function: test_delete
- *
- * Purpose: Basic tests for the block tracker code
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Monday, March 14, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_delete(hid_t fapl)
-{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- off_t empty_size; /* Size of an empty file */
- off_t file_size; /* Size of each file created */
- haddr_t bt_addr; /* Address of block tracker created */
- unsigned u; /* Local index variable */
-
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
-/* Create empty file for size comparisons later */
-
- /* Create the file to work on */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
-
- /* Close file */
- if(H5Fclose(file)<0) TEST_ERROR;
-
- /* Get the size of an empty file */
- if((empty_size=h5_get_file_size(filename))==0) TEST_ERROR;
-
- TESTING("delete empty block tracker");
-
- /* Create the file to work on */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
-
- /* Get a pointer to the internal file object */
- if (NULL==(f=H5I_object(file))) {
- H5Eprint_stack(H5E_DEFAULT, stdout);
- TEST_ERROR;
- } /* end if */
-
- if (H5BT_create(f, H5P_DATASET_XFER_DEFAULT, &bt_addr/*out*/)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- /*
- * Delete block tracker
- */
- if (H5BT_delete(f, H5P_DATASET_XFER_DEFAULT, bt_addr)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5Fclose(file)<0) TEST_ERROR;
-
- /* Get the size of the file */
- if((file_size=h5_get_file_size(filename))==0) TEST_ERROR;
-
- /* Verify the file is correct size */
- if(file_size!=empty_size) TEST_ERROR;
-
- PASSED();
-
- TESTING("delete block tracker with many blocks");
-
- /* Create the file to work on */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
-
- /* Get a pointer to the internal file object */
- if (NULL==(f=H5I_object(file))) {
- H5Eprint_stack(H5E_DEFAULT, stdout);
- TEST_ERROR;
- } /* end if */
-
- if (H5BT_create(f, H5P_DATASET_XFER_DEFAULT, &bt_addr/*out*/)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- /* Insert many blocks */
- for(u = 0; u < INSERT_MANY; u++) {
- if (H5BT_insert(f, H5P_DATASET_XFER_DEFAULT, bt_addr, (haddr_t)(u*50), (hsize_t)20)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
- } /* end for */
-
- /*
- * Delete block tracker
- */
- if (H5BT_delete(f, H5P_DATASET_XFER_DEFAULT, bt_addr)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- if (H5Fclose(file)<0) TEST_ERROR;
-
- /* Get the size of the file */
- if((file_size=h5_get_file_size(filename))==0) TEST_ERROR;
-
- /* Verify the file is correct size */
- if(file_size!=empty_size) TEST_ERROR;
-
- PASSED();
-
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-} /* test_delete() */
-
-
-/*-------------------------------------------------------------------------
- * Function: main
- *
- * Purpose: Test the block tracker code
- *
- * Return: Success:
- *
- * Failure:
- *
- * Programmer: Quincey Koziol
- * Wednesday, March 9, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-int
-main(void)
-{
- hid_t fapl=-1;
- int nerrors=0;
-
- /* Reset library */
- h5_reset();
- fapl = h5_fileaccess();
-
- /* Test block tracker creation */
- nerrors += test_create(fapl);
-
- /* Test block tracker insertion */
- nerrors += test_insert_one(fapl);
- nerrors += test_insert_few(fapl);
- nerrors += test_insert_many(fapl);
- nerrors += test_insert_overlap(fapl);
- nerrors += test_insert_merge(fapl);
-
- /* Test block tracker removal */
- nerrors += test_remove_whole(fapl);
- nerrors += test_remove_partial_begin(fapl);
-
- /* Test block tracker search functions */
- nerrors += test_locate(fapl);
- nerrors += test_neighbor(fapl);
-
- /* Test block tracker iterate */
- nerrors += test_iterate(fapl);
-
- /* Test block tracker deletion */
- nerrors += test_delete(fapl);
-
- if (nerrors) goto error;
- puts("All block tracker tests passed.");
-#ifndef QAK
- h5_cleanup(FILENAME, fapl);
-#else /* QAK */
-HDfprintf(stderr,"Uncomment cleanup!\n");
-#endif /* QAK */
- return 0;
-
-error:
- puts("*** TESTS FAILED ***");
- H5E_BEGIN_TRY {
- H5Pclose(fapl);
- } H5E_END_TRY;
- return 1;
-}
-
diff --git a/test/sheap.c b/test/sheap.c
deleted file mode 100644
index 9b3362c..0000000
--- a/test/sheap.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
- * Wednesday, March 23, 2005
- */
-#include "h5test.h"
-
-/*
- * This file needs to access private datatypes from the H5SH package.
- * This file also needs to access the segmented heap testing code.
- */
-#define H5SH_PACKAGE
-#define H5SH_TESTING
-#include "H5SHpkg.h"
-
-/* Other private headers that this test requires */
-#include "H5Iprivate.h"
-
-const char *FILENAME[] = {
- "sheap",
- NULL
-};
-
-#define SHEAP_TYPE H5SH_META
-#define SHEAP_MIN_SIZE 4096
-#define SHEAP_MAX_EXPAND_SIZE 65536
-
-
-/*-------------------------------------------------------------------------
- * Function: test_create
- *
- * Purpose: Basic tests for the segmented heap code
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Wednesday, March 23, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_create(hid_t fapl)
-{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- haddr_t sh_addr; /* Address of block tracker created */
-
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
-
- /* Get a pointer to the internal file object */
- if (NULL==(f=H5I_object(file))) {
- H5Eprint_stack(H5E_DEFAULT, stdout);
- TEST_ERROR;
- } /* end if */
-
- /*
- * Test segmented heap creation
- */
- TESTING("segmented heap creation");
- if (H5SH_create(f, H5P_DATASET_XFER_DEFAULT, &sh_addr/*out*/, SHEAP_TYPE, (hsize_t)SHEAP_MIN_SIZE, (hsize_t)SHEAP_MAX_EXPAND_SIZE)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- PASSED();
-
- if (H5Fclose(file)<0) TEST_ERROR;
-
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-} /* test_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: test_allocate_simple
- *
- * Purpose: Basic tests for the segmented heap code
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Thursday, March 24, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_allocate_simple(hid_t fapl)
-{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- haddr_t sh_addr; /* Address of block tracker created */
- haddr_t obj_addr; /* Address for object */
- hsize_t obj_len; /* Length of object */
-
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
-
- /* Get a pointer to the internal file object */
- if (NULL==(f=H5I_object(file))) {
- H5Eprint_stack(H5E_DEFAULT, stdout);
- TEST_ERROR;
- } /* end if */
-
- /* Create segmented heap */
- if (H5SH_create(f, H5P_DATASET_XFER_DEFAULT, &sh_addr/*out*/, SHEAP_TYPE, (hsize_t)SHEAP_MIN_SIZE, (hsize_t)SHEAP_MAX_EXPAND_SIZE)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- /*
- * Test segmented heap allocation
- */
- TESTING("segmented heap allocate first block");
-
- /* Allocate space for a simple object */
- obj_len = 10;
- if (H5SH_alloc(f, H5P_DATASET_XFER_DEFAULT, sh_addr, obj_len, &obj_addr/*out*/)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-#ifdef H5_HAVE_LARGE_HSIZET
- if(obj_addr != 530) TEST_ERROR;
-#else /* H5_HAVE_LARGE_HSIZET */
- if(obj_addr != 478) TEST_ERROR;
-#endif /* H5_HAVE_LARGE_HSIZET */
-
- PASSED();
-
- TESTING("segmented heap allocate into free space");
-
- /* Allocate space for a simple object */
- obj_len = 3800;
- if (H5SH_alloc(f, H5P_DATASET_XFER_DEFAULT, sh_addr, obj_len, &obj_addr/*out*/)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-#ifdef H5_HAVE_LARGE_HSIZET
- if(obj_addr != 540) TEST_ERROR;
-#else /* H5_HAVE_LARGE_HSIZET */
- if(obj_addr != 488) TEST_ERROR;
-#endif /* H5_HAVE_LARGE_HSIZET */
-
- PASSED();
-
- TESTING("segmented heap allocate another heap block");
-
- /* Allocate space for a simple object */
- obj_len = 512;
- if (H5SH_alloc(f, H5P_DATASET_XFER_DEFAULT, sh_addr, obj_len, &obj_addr/*out*/)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-#ifdef H5_HAVE_LARGE_HSIZET
- if(obj_addr != 5650) TEST_ERROR;
-#else /* H5_HAVE_LARGE_HSIZET */
- if(obj_addr != 5598) TEST_ERROR;
-#endif /* H5_HAVE_LARGE_HSIZET */
-
- PASSED();
-
- TESTING("segmented heap extend heap block");
-
- /* Allocate space for a simple object */
- obj_len = 4096;
- if (H5SH_alloc(f, H5P_DATASET_XFER_DEFAULT, sh_addr, obj_len, &obj_addr/*out*/)<0) {
- H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-#ifdef H5_HAVE_LARGE_HSIZET
- if(obj_addr != 6162) TEST_ERROR;
-#else /* H5_HAVE_LARGE_HSIZET */
- if(obj_addr != 6110) TEST_ERROR;
-#endif /* H5_HAVE_LARGE_HSIZET */
-
- PASSED();
-
- if (H5Fclose(file)<0) TEST_ERROR;
-
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-} /* test_allocate_simple() */
-
-
-/*-------------------------------------------------------------------------
- * Function: main
- *
- * Purpose: Test the segmented heap code
- *
- * Return: Success:
- *
- * Failure:
- *
- * Programmer: Quincey Koziol
- * Wednesday, March 23, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-int
-main(void)
-{
- hid_t fapl=-1;
- int nerrors=0;
-
- /* Reset library */
- h5_reset();
- fapl = h5_fileaccess();
-
- /* Test segmented heap creation */
- nerrors += test_create(fapl);
-
- /* Test segmented heap allocation */
- nerrors += test_allocate_simple(fapl);
-
- if (nerrors) goto error;
- puts("All segmented heap tests passed.");
-#ifndef QAK
- h5_cleanup(FILENAME, fapl);
-#else /* QAK */
-HDfprintf(stderr,"Uncomment cleanup!\n");
-#endif /* QAK */
- return 0;
-
-error:
- puts("*** TESTS FAILED ***");
- H5E_BEGIN_TRY {
- H5Pclose(fapl);
- } H5E_END_TRY;
- return 1;
-}
-
diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c
index 9eb2d49..0228d98 100644
--- a/tools/misc/h5debug.c
+++ b/tools/misc/h5debug.c
@@ -28,16 +28,10 @@
#define H5O_PACKAGE /*suppress error about including H5Opkg */
#define H5B2_PACKAGE /*suppress error about including H5B2pkg */
#define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/
-#define H5BP_PACKAGE /*suppress error about including H5BPpkg */
-#define H5BP_TESTING /*suppress warning about H5BP testing funcs*/
-#define H5BT_PACKAGE /*suppress error about including H5BTpkg */
-#define H5SH_PACKAGE /*suppress error about including H5SHpkg */
#include "H5private.h" /* Generic Functions */
#include "H5Bprivate.h"
#include "H5B2pkg.h" /* B-trees */
-#include "H5BPpkg.h" /* B+ trees */
-#include "H5BTpkg.h" /* Block tracker */
#include "H5Dprivate.h"
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h"
@@ -47,7 +41,6 @@
#include "H5Iprivate.h"
#include "H5Opkg.h"
#include "H5Pprivate.h"
-#include "H5SHpkg.h" /* Segmented heap */
/* File drivers */
#include "H5FDfamily.h"
@@ -200,10 +193,6 @@ main(int argc, char *argv[])
status = H5B2_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5B2_TEST);
break;
- case H5B2_BLK_TRK_ID:
- status = H5B2_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5B2_BLKTRK);
- break;
-
default:
fprintf(stderr, "Unknown B-tree subtype %u\n", (unsigned)(subtype));
HDexit(4);
@@ -222,10 +211,6 @@ main(int argc, char *argv[])
status = H5B2_int_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5B2_TEST, extra, (unsigned)extra2);
break;
- case H5B2_BLK_TRK_ID:
- status = H5B2_int_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5B2_BLKTRK, extra, (unsigned)extra2);
- break;
-
default:
fprintf(stderr, "Unknown B-tree subtype %u\n", (unsigned)(subtype));
HDexit(4);
@@ -244,45 +229,11 @@ main(int argc, char *argv[])
status = H5B2_leaf_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5B2_TEST, extra, (unsigned)extra2);
break;
- case H5B2_BLK_TRK_ID:
- status = H5B2_leaf_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5B2_BLKTRK, extra, (unsigned)extra2);
- break;
-
default:
fprintf(stderr, "Unknown B-tree subtype %u\n", (unsigned)(subtype));
HDexit(4);
} /* end switch */
- } else if (!HDmemcmp(sig, H5BT_MAGIC, H5BT_SIZEOF_MAGIC)) {
- /*
- * Debug a block tracker info
- */
- status = H5BT_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL);
-
- } else if (!HDmemcmp(sig, H5SH_MAGIC, H5SH_SIZEOF_MAGIC)) {
- /*
- * Debug a segmented heap info
- */
- status = H5SH_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL);
-
- } else if (!HDmemcmp(sig, H5BP_HDR_MAGIC, H5BP_SIZEOF_MAGIC)) {
- /*
- * Debug a B+ tree. B+ trees are debugged through the B+ tree
- * subclass. The subclass identifier is two bytes after the
- * B+ tree signature.
- */
- H5BP_subid_t subtype = (H5BP_subid_t)sig[H5BP_SIZEOF_MAGIC+1];
-
- switch (subtype) {
- case H5BP_TEST_ID:
- status = H5BP_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5BP_TEST);
- break;
-
- default:
- fprintf(stderr, "Unknown B+ tree subtype %u\n", (unsigned)(subtype));
- HDexit(4);
- } /* end switch */
-
} else if (sig[0] == H5O_VERSION) {
/*
* This could be an object header. Since they don't have a signature