summaryrefslogtreecommitdiffstats
path: root/src/H5HFhdr.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-05-22 16:43:45 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-05-22 16:43:45 (GMT)
commit5d2bddcd0654b9f1ad548799e6828780a30b506c (patch)
treeaf3981ebdedc3e92aff186ca1b06a67de197c7f2 /src/H5HFhdr.c
parent4d3390afd97c82f91165677877469ee0911288c6 (diff)
downloadhdf5-5d2bddcd0654b9f1ad548799e6828780a30b506c.zip
hdf5-5d2bddcd0654b9f1ad548799e6828780a30b506c.tar.gz
hdf5-5d2bddcd0654b9f1ad548799e6828780a30b506c.tar.bz2
[svn-r12362] Purpose:
Code checkpoint Description: Update fractal heap code to allow objects to be deleted Fix bugs in fractal heap object insertion Improve free space manager code to allow sections to be merged and shrink the container Another try at making the Windows compilers happy... Platforms tested: FreeBSD 4.11 (sleipnir) Mac OS X.4/PPC (amazon) Linux 2.4 (chicago & heping) Solaris 2.9 (shanti) AIX 5.? (copper) w/parallel
Diffstat (limited to 'src/H5HFhdr.c')
-rw-r--r--src/H5HFhdr.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c
index 664a7e7..a25a11b 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -216,8 +216,9 @@ H5HF_hdr_finish_init(H5HF_hdr_t *hdr)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize doubling table info")
/* Set the size of heap IDs */
- hdr->id_len = hdr->heap_off_size + MIN(hdr->man_dtable.max_dir_blk_off_size,
- ((H5V_log2_gen((hsize_t)hdr->standalone_size) + 7) / 8));
+ hdr->heap_len_size = MIN(hdr->man_dtable.max_dir_blk_off_size,
+ ((H5V_log2_gen((hsize_t)hdr->standalone_size) + 7) / 8));
+ hdr->id_len = hdr->heap_off_size + hdr->heap_len_size;
/* Set the free space in direct blocks */
for(u = 0; u < hdr->man_dtable.max_root_rows; u++) {
@@ -555,3 +556,49 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_hdr_inc_alloc() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5HF_hdr_empty
+ *
+ * Purpose: Reset heap header to 'empty heap' state
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * May 17 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5HF_hdr_empty(H5HF_hdr_t *hdr)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_empty)
+#ifdef QAK
+HDfprintf(stderr, "%s: Reseting heap header to empty\n", FUNC);
+#endif /* QAK */
+
+ /* Sanity check */
+ HDassert(hdr);
+
+ /* Reset root pointer information */
+ hdr->man_dtable.curr_root_rows = 0;
+ hdr->man_dtable.table_addr = HADDR_UNDEF;
+
+ /* Shrink heap size */
+ hdr->total_size = hdr->std_size;
+ hdr->man_size = 0;
+
+ /* Reset the free space in direct blocks */
+ hdr->total_man_free = 0;
+
+ /* Mark heap header as modified */
+ if(H5HF_hdr_dirty(hdr) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark header as dirty")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HF_hdr_empty() */
+