summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-03-11 00:44:03 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-03-11 00:44:03 (GMT)
commit5b7ebc2ff95e1dea0bd9517e360b7af98dbd0a4d (patch)
tree14e1c52be4efa2294208450fb6fe778cafddf6cd /src
parent134d7ed4f0de170ab361a6a88622cead5a49dd84 (diff)
downloadhdf5-5b7ebc2ff95e1dea0bd9517e360b7af98dbd0a4d.zip
hdf5-5b7ebc2ff95e1dea0bd9517e360b7af98dbd0a4d.tar.gz
hdf5-5b7ebc2ff95e1dea0bd9517e360b7af98dbd0a4d.tar.bz2
[svn-r10184] Purpose:
New feature Description: Add new "block tracker" data structure to library, for tracking blocks of bytes in a file. Block trackers will be used to keep track of the blocks belonging to the soon-to-be-implemented "segmented heap" which is designed to replace the current local & global heaps (starting with the local heap). Block trackers will also keep track of the free space in the segmented heap and someday could be used to track the free space in the entire HDF5 file. They are implemented as a small header of information to cache the state of the blocks (max & min sizes of blocks tracked, etc.) and the records of the blocks themselves are stored in a v2 B-tree. Platforms tested: FreeBSD 4.11 (sleipnir) Solaris 2.9 (shanti) h5committest
Diffstat (limited to 'src')
-rw-r--r--src/H5AC.c3
-rw-r--r--src/H5ACprivate.h3
-rw-r--r--src/H5B2dbg.c12
-rw-r--r--src/H5B2private.h2
-rw-r--r--src/H5BT.c110
-rw-r--r--src/H5BTbtree2.c218
-rw-r--r--src/H5BTcache.c331
-rw-r--r--src/H5BTdbg.c104
-rw-r--r--src/H5BTpkg.h109
-rw-r--r--src/H5BTprivate.h52
-rw-r--r--src/H5BTpublic.h52
-rw-r--r--src/H5Edefin.h1
-rw-r--r--src/H5Einit.h5
-rw-r--r--src/H5Epubgen.h2
-rw-r--r--src/H5Eterm.h1
-rw-r--r--src/H5FDpublic.h5
-rw-r--r--src/H5err.txt1
-rwxr-xr-xsrc/Makefile.am5
-rw-r--r--src/Makefile.in12
19 files changed, 1014 insertions, 14 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index 2f717ad..ac38aa0 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -346,7 +346,8 @@ static const char * H5AC_entry_type_names[H5AC_NTYPES] =
"object headers",
"v2 B-tree headers",
"v2 B-tree internal nodes",
- "v2 B-tree leaf nodes"
+ "v2 B-tree leaf nodes",
+ "block tracker nodes"
};
herr_t
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index 44bd862..bdfc57b 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -47,7 +47,8 @@
#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_NTYPES 8
+#define H5AC_BLTR_ID 8 /*block tracker */
+#define H5AC_NTYPES 9
/* 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 0801a6f..b73bf49 100644
--- a/src/H5B2dbg.c
+++ b/src/H5B2dbg.c
@@ -80,7 +80,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_GRP_NAME_ID ? "H5B2_GRP_NAME_ID" :
+ ((shared->type->id)==H5B2_BLK_TRK_ID ? "H5B2_BLK_TRK_ID" :
"Unknown!")));
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Size of node:",
@@ -133,7 +133,7 @@ done:
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header")
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5B2_hdr_debug() */
/*-------------------------------------------------------------------------
@@ -198,7 +198,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_GRP_NAME_ID ? "H5B2_GRP_NAME_ID" :
+ ((shared->type->id)==H5B2_BLK_TRK_ID ? "H5B2_BLK_TRK_ID" :
"Unknown!")));
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Size of node:",
@@ -245,7 +245,7 @@ done:
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree internal node")
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5B2_int_debug() */
/*-------------------------------------------------------------------------
@@ -310,7 +310,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_GRP_NAME_ID ? "H5B2_GRP_NAME_ID" :
+ ((shared->type->id)==H5B2_BLK_TRK_ID ? "H5B2_BLK_TRK_ID" :
"Unknown!")));
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Size of node:",
@@ -341,5 +341,5 @@ done:
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree leaf node")
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5B2_leaf_debug() */
diff --git a/src/H5B2private.h b/src/H5B2private.h
index 5c71674..c0abff9 100644
--- a/src/H5B2private.h
+++ b/src/H5B2private.h
@@ -52,7 +52,7 @@
/* 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_GRP_NAME_ID, /* B-tree is for group links, ordered by name */
+ 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/H5BT.c b/src/H5BT.c
new file mode 100644
index 0000000..c24ce06
--- /dev/null
+++ b/src/H5BT.c
@@ -0,0 +1,110 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 info */
+#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 */
+
+/* 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
+ *
+ *-------------------------------------------------------------------------
+ */
+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->cache_info.is_dirty = TRUE;
+
+ /* 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 B-tree 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() */
+
diff --git a/src/H5BTbtree2.c b/src/H5BTbtree2.c
new file mode 100644
index 0000000..4c37004
--- /dev/null
+++ b/src/H5BTbtree2.c
@@ -0,0 +1,218 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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(hsize_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
new file mode 100644
index 0000000..60c31b3
--- /dev/null
+++ b/src/H5BTcache.c
@@ -0,0 +1,331 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 H5B2pkg */
+
+/* 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 B-tree header 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 B-tree header 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: H5B_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
new file mode 100644
index 0000000..a926801
--- /dev/null
+++ b/src/H5BTdbg.c
@@ -0,0 +1,104 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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" /* B-trees */
+#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
+ *
+ *-------------------------------------------------------------------------
+ */
+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_debug() */
+
diff --git a/src/H5BTpkg.h b/src/H5BTpkg.h
new file mode 100644
index 0000000..83dfbe0
--- /dev/null
+++ b/src/H5BTpkg.h
@@ -0,0 +1,109 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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"
+
+/* Other private headers needed by this file */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5B2private.h" /* v2 B-trees */
+#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 */
+
+
+/****************************/
+/* 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;
+
+/* Info for a single block */
+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;
+
+
+/*****************************/
+/* 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);
+
+#endif /* _H5BTpkg_H */
+
diff --git a/src/H5BTprivate.h b/src/H5BTprivate.h
new file mode 100644
index 0000000..e506051
--- /dev/null
+++ b/src/H5BTprivate.h
@@ -0,0 +1,52 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 "H5Fprivate.h" /* File access */
+
+/**************************/
+/* Library Private Macros */
+/**************************/
+
+
+/****************************/
+/* Library Private Typedefs */
+/****************************/
+
+
+/***************************************/
+/* Library-private Function Prototypes */
+/***************************************/
+H5_DLL herr_t H5BT_create(H5F_t *f, hid_t dxpl_id, haddr_t *addr_p);
+
+#endif /* _H5BTprivate_H */
+
+
diff --git a/src/H5BTpublic.h b/src/H5BTpublic.h
new file mode 100644
index 0000000..f37f2d1
--- /dev/null
+++ b/src/H5BTpublic.h
@@ -0,0 +1,52 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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/H5Edefin.h b/src/H5Edefin.h
index b081b16..d911107 100644
--- a/src/H5Edefin.h
+++ b/src/H5Edefin.h
@@ -41,6 +41,7 @@ hid_t H5E_TBBT_g = FAIL; /* Threaded, Balanced, Binary Trees */
hid_t H5E_ATOM_g = FAIL; /* Object atom */
hid_t H5E_ATTR_g = FAIL; /* Attribute */
hid_t H5E_IO_g = FAIL; /* Low-level I/O */
+hid_t H5E_BLKTRK_g = FAIL; /* Block tracker */
hid_t H5E_SLIST_g = FAIL; /* Skip Lists */
hid_t H5E_EFL_g = FAIL; /* External file list */
hid_t H5E_TST_g = FAIL; /* Ternary Search Trees */
diff --git a/src/H5Einit.h b/src/H5Einit.h
index 8164584..bb8a04d 100644
--- a/src/H5Einit.h
+++ b/src/H5Einit.h
@@ -128,6 +128,11 @@ if((msg = H5E_create_msg(cls, H5E_MAJOR, "Low-level I/O"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
if((H5E_IO_g = H5I_register(H5I_ERROR_MSG, msg))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_BLKTRK_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Block tracker"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_BLKTRK_g = H5I_register(H5I_ERROR_MSG, msg))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
assert(H5E_SLIST_g==(-1));
if((msg = H5E_create_msg(cls, H5E_MAJOR, "Skip Lists"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
diff --git a/src/H5Epubgen.h b/src/H5Epubgen.h
index 6a4fcd1..773368f 100644
--- a/src/H5Epubgen.h
+++ b/src/H5Epubgen.h
@@ -44,6 +44,7 @@
#define H5E_ATOM (H5OPEN H5E_ATOM_g)
#define H5E_ATTR (H5OPEN H5E_ATTR_g)
#define H5E_IO (H5OPEN H5E_IO_g)
+#define H5E_BLKTRK (H5OPEN H5E_BLKTRK_g)
#define H5E_SLIST (H5OPEN H5E_SLIST_g)
#define H5E_EFL (H5OPEN H5E_EFL_g)
#define H5E_TST (H5OPEN H5E_TST_g)
@@ -72,6 +73,7 @@ H5_DLLVAR hid_t H5E_TBBT_g; /* Threaded, Balanced, Binary Trees */
H5_DLLVAR hid_t H5E_ATOM_g; /* Object atom */
H5_DLLVAR hid_t H5E_ATTR_g; /* Attribute */
H5_DLLVAR hid_t H5E_IO_g; /* Low-level I/O */
+H5_DLLVAR hid_t H5E_BLKTRK_g; /* Block tracker */
H5_DLLVAR hid_t H5E_SLIST_g; /* Skip Lists */
H5_DLLVAR hid_t H5E_EFL_g; /* External file list */
H5_DLLVAR hid_t H5E_TST_g; /* Ternary Search Trees */
diff --git a/src/H5Eterm.h b/src/H5Eterm.h
index 67b3415..6bef264 100644
--- a/src/H5Eterm.h
+++ b/src/H5Eterm.h
@@ -42,6 +42,7 @@ H5E_TBBT_g=
H5E_ATOM_g=
H5E_ATTR_g=
H5E_IO_g=
+H5E_BLKTRK_g=
H5E_SLIST_g=
H5E_EFL_g=
H5E_TST_g=
diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h
index 596e0f1..6606b80 100644
--- a/src/H5FDpublic.h
+++ b/src/H5FDpublic.h
@@ -43,6 +43,11 @@ typedef enum H5FD_mem_t {
H5FD_MEM_NTYPES /*must be last*/
} H5FD_mem_t;
+/* Map "block tracker" header blocks to 'ohdr' type file memory, since its
+ * a fair amount of work to add a new kind of file memory, they are similar
+ * enough to object headers and probably too minor to deserve their own type. -QAK */
+#define H5FD_MEM_BLKTRK H5FD_MEM_OHDR
+
/*
* A free-list map which maps all types of allocation requests to a single
* free list. This is useful for drivers that don't really care about
diff --git a/src/H5err.txt b/src/H5err.txt
index dcfb5b0..61bb74c 100644
--- a/src/H5err.txt
+++ b/src/H5err.txt
@@ -72,6 +72,7 @@ MAJOR, H5E_TST, Ternary Search Trees
MAJOR, H5E_RS, Reference Counted Strings
MAJOR, H5E_ERROR, Error API
MAJOR, H5E_SLIST, Skip Lists
+MAJOR, H5E_BLKTRK, Block tracker
# Sections (for grouping minor errors)
SECTION, ARGS, Argument errors
diff --git a/src/Makefile.am b/src/Makefile.am
index 08e7364..8d65b31 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -37,7 +37,7 @@ DISTCLEAN=libhdf5.settings
# library sources
libhdf5_la_SOURCES= H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2cache.c H5B2dbg.c \
- H5B2test.c H5C.c \
+ H5B2test.c H5BT.c H5BTbtree2.c H5BTcache.c H5BTdbg.c H5C.c \
H5D.c \
H5Dcontig.c \
H5Dcompact.c \
@@ -63,7 +63,7 @@ libhdf5_la_SOURCES= H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2cache.c H5B2dbg.c \
# Public headers
include_HEADERS =H5public.h H5Apublic.h H5ACpublic.h H5Bpublic.h H5B2public.h \
- H5Cpublic.h H5Dpublic.h \
+ H5BTpublic.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 H5FDsrb.h H5FDstdio.h H5FDstream.h H5FPpublic.h \
@@ -74,6 +74,7 @@ include_HEADERS =H5public.h H5Apublic.h H5ACpublic.h H5Bpublic.h H5B2public.h \
# Private headers
#noinst_HEADERS =H5private.h H5Aprivate.h H5Apkg.h H5ACprivate.h H5Bprivate.h \
# H5B2private.h \
+# H5BTprivate.h \
# H5Dprivate.h H5Eprivate.h H5Fprivate.h H5FDprivate.h H5FLprivate.h \
# H5FOprivate.h H5FSprivate.h H5Gprivate.h H5Gpkg.h \
# H5HGprivate.h H5HLprivate.h H5HPprivate.h H5Iprivate.h H5MFprivate.h \
diff --git a/src/Makefile.in b/src/Makefile.in
index 84006b4..e096942 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -82,7 +82,8 @@ libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
libhdf5_la_LIBADD =
am_libhdf5_la_OBJECTS = H5.lo H5A.lo H5AC.lo H5B.lo H5B2.lo \
- H5B2cache.lo H5B2dbg.lo H5B2test.lo H5C.lo H5D.lo H5Dcontig.lo \
+ H5B2cache.lo H5B2dbg.lo H5B2test.lo H5BT.lo H5BTbtree2.lo \
+ H5BTcache.lo H5BTdbg.lo H5C.lo H5D.lo H5Dcontig.lo \
H5Dcompact.lo H5Defl.lo H5Dio.lo H5Distore.lo H5Dmpio.lo \
H5Dselect.lo H5Dtest.lo H5E.lo H5F.lo H5Fdbg.lo H5FD.lo \
H5FDcore.lo H5FDfamily.lo H5FDfphdf5.lo H5FDlog.lo H5FDmpi.lo \
@@ -332,7 +333,7 @@ DISTCLEAN = libhdf5.settings
# library sources
libhdf5_la_SOURCES = H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2cache.c H5B2dbg.c \
- H5B2test.c H5C.c \
+ H5B2test.c H5BT.c H5BTbtree2.c H5BTcache.c H5BTdbg.c H5C.c \
H5D.c \
H5Dcontig.c \
H5Dcompact.c \
@@ -358,7 +359,7 @@ libhdf5_la_SOURCES = H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2cache.c H5B2dbg.c \
# Public headers
include_HEADERS = H5public.h H5Apublic.h H5ACpublic.h H5Bpublic.h H5B2public.h \
- H5Cpublic.h H5Dpublic.h \
+ H5BTpublic.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 H5FDsrb.h H5FDstdio.h H5FDstream.h H5FPpublic.h \
@@ -370,6 +371,7 @@ include_HEADERS = H5public.h H5Apublic.h H5ACpublic.h H5Bpublic.h H5B2public.h \
# Private headers
#noinst_HEADERS =H5private.h H5Aprivate.h H5Apkg.h H5ACprivate.h H5Bprivate.h \
# H5B2private.h \
+# H5BTprivate.h \
# H5Dprivate.h H5Eprivate.h H5Fprivate.h H5FDprivate.h H5FLprivate.h \
# H5FOprivate.h H5FSprivate.h H5Gprivate.h H5Gpkg.h \
# H5HGprivate.h H5HLprivate.h H5HPprivate.h H5Iprivate.h H5MFprivate.h \
@@ -501,6 +503,10 @@ 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)/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)/H5C.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5D.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dcompact.Plo@am__quote@
ass="hl kwd">LZ4_DEPRECATED("use LZ4_decompress_safe_usingDict() instead") LZ4LIB_API int LZ4_decompress_safe_withPrefix64k (const char* src, char* dst, int compressedSize, int maxDstSize); LZ4_DEPRECATED("use LZ4_decompress_fast_usingDict() instead") LZ4LIB_API int LZ4_decompress_fast_withPrefix64k (const char* src, char* dst, int originalSize); /*! LZ4_decompress_fast() : **unsafe!** * These functions used to be faster than LZ4_decompress_safe(), * but it has changed, and they are now slower than LZ4_decompress_safe(). * This is because LZ4_decompress_fast() doesn't know the input size, * and therefore must progress more cautiously in the input buffer to not read beyond the end of block. * On top of that `LZ4_decompress_fast()` is not protected vs malformed or malicious inputs, making it a security liability. * As a consequence, LZ4_decompress_fast() is strongly discouraged, and deprecated. * * The last remaining LZ4_decompress_fast() specificity is that * it can decompress a block without knowing its compressed size. * Such functionality could be achieved in a more secure manner, * by also providing the maximum size of input buffer, * but it would require new prototypes, and adaptation of the implementation to this new use case. * * Parameters: * originalSize : is the uncompressed size to regenerate. * `dst` must be already allocated, its size must be >= 'originalSize' bytes. * @return : number of bytes read from source buffer (== compressed size). * The function expects to finish at block's end exactly. * If the source stream is detected malformed, the function stops decoding and returns a negative result. * note : LZ4_decompress_fast*() requires originalSize. Thanks to this information, it never writes past the output buffer. * However, since it doesn't know its 'src' size, it may read an unknown amount of input, past input buffer bounds. * Also, since match offsets are not validated, match reads from 'src' may underflow too. * These issues never happen if input (compressed) data is correct. * But they may happen if input data is invalid (error or intentional tampering). * As a consequence, use these functions in trusted environments with trusted data **only**. */ LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using LZ4_decompress_safe() instead") LZ4LIB_API int LZ4_decompress_fast (const char* src, char* dst, int originalSize); LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using LZ4_decompress_safe_continue() instead") LZ4LIB_API int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* src, char* dst, int originalSize); LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using LZ4_decompress_safe_usingDict() instead") LZ4LIB_API int LZ4_decompress_fast_usingDict (const char* src, char* dst, int originalSize, const char* dictStart, int dictSize); /*! LZ4_resetStream() : * An LZ4_stream_t structure must be initialized at least once. * This is done with LZ4_initStream(), or LZ4_resetStream(). * Consider switching to LZ4_initStream(), * invoking LZ4_resetStream() will trigger deprecation warnings in the future. */ LZ4LIB_API void LZ4_resetStream (LZ4_stream_t* streamPtr); #endif /* LZ4_H_98237428734687 */ #if defined (__cplusplus) } #endif