mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-13 16:47:58 +08:00
[svn-r10506] Purpose:
New feature Description: Add first iteration of "segmented heap" code, which will be used to store links in groups in a more flexible way than the previous "local heap" mechanism. Platforms tested: FreeBSD 4.11 (sleipnir) w/parallel Solaris 2.9 (shanti)
This commit is contained in:
parent
d8b3898368
commit
a9d5fc42eb
11
MANIFEST
11
MANIFEST
@ -934,6 +934,12 @@
|
||||
./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
|
||||
@ -1033,6 +1039,7 @@
|
||||
./test/srb_append.c
|
||||
./test/srb_read.c
|
||||
./test/srb_write.c
|
||||
./test/sheap.c
|
||||
./test/stab.c
|
||||
./test/stream_test.c
|
||||
./test/tarray.c
|
||||
@ -1683,8 +1690,8 @@
|
||||
./windows/examples/grouptestdll/grouptestdll.dsp
|
||||
./windows/examples/readtest/readtest.dsp
|
||||
./windows/examples/readtestdll/readtestdll.dsp
|
||||
./windows/examples/selectest/selecttest.dsp
|
||||
./windows/examples/selectestdll/selecttestdll.dsp
|
||||
./windows/examples/selectest/selectest.dsp
|
||||
./windows/examples/selectestdll/selectestdll.dsp
|
||||
./windows/examples/writetest/writetest.dsp
|
||||
./windows/examples/writetestdll/writetestdll.dsp
|
||||
./windows/examples/testExamples.bat
|
||||
|
@ -347,7 +347,8 @@ 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"
|
||||
"block tracker nodes",
|
||||
"segmented heaps"
|
||||
};
|
||||
|
||||
herr_t
|
||||
|
@ -48,7 +48,8 @@
|
||||
#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_NTYPES 9
|
||||
#define H5AC_SHEAP_ID 9 /*segmented heap */
|
||||
#define H5AC_NTYPES 10
|
||||
|
||||
/* H5AC_DUMP_STATS_ON_CLOSE should always be FALSE when
|
||||
* H5C_COLLECT_CACHE_STATS is FALSE.
|
||||
|
@ -574,7 +574,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#define H5C__H5C_T_MAGIC 0x005CAC0E
|
||||
#define H5C__MAX_NUM_TYPE_IDS 9
|
||||
#define H5C__MAX_NUM_TYPE_IDS 10
|
||||
#define H5C__MAX_EPOCH_MARKERS 10
|
||||
|
||||
struct H5C_t
|
||||
|
@ -48,6 +48,14 @@ typedef enum H5FD_mem_t {
|
||||
* enough to object headers and probably too minor to deserve their own type. -QAK */
|
||||
#define H5FD_MEM_BLKTRK H5FD_MEM_OHDR
|
||||
|
||||
/* Map "segmented heap" 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.
|
||||
* Map "segmented heap" blocks to 'lheap' type file memory, since they will be
|
||||
* replacing local heaps. -QAK */
|
||||
#define H5FD_MEM_SHEAP_HDR H5FD_MEM_OHDR
|
||||
#define H5FD_MEM_SHEAP_BLOCK H5FD_MEM_LHEAP
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
326
src/H5SH.c
Normal file
326
src/H5SH.c
Normal file
@ -0,0 +1,326 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
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->cache_info.is_dirty = TRUE;
|
||||
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
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
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() */
|
||||
|
332
src/H5SHcache.c
Normal file
332
src/H5SHcache.c
Normal file
@ -0,0 +1,332 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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 = *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() */
|
||||
|
||||
|
96
src/H5SHdbg.c
Normal file
96
src/H5SHdbg.c
Normal file
@ -0,0 +1,96 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
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() */
|
||||
|
||||
|
103
src/H5SHpkg.h
Normal file
103
src/H5SHpkg.h
Normal file
@ -0,0 +1,103 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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 */
|
||||
|
||||
|
59
src/H5SHprivate.h
Normal file
59
src/H5SHprivate.h
Normal file
@ -0,0 +1,59 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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 */
|
||||
|
53
src/H5SHpublic.h
Normal file
53
src/H5SHpublic.h
Normal file
@ -0,0 +1,53 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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 */
|
||||
|
||||
|
@ -58,7 +58,8 @@ libhdf5_la_SOURCES= H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2cache.c H5B2dbg.c \
|
||||
H5Oname.c H5Onull.c H5Opline.c H5Osdspace.c H5Oshared.c H5Ostab.c \
|
||||
H5P.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.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 H5SL.c H5ST.c H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c \
|
||||
H5Sselect.c H5Stest.c H5SH.c H5SHcache.c H5SHdbg.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 H5Topaque.c H5Torder.c \
|
||||
H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvlen.c H5TS.c H5V.c H5Z.c \
|
||||
@ -73,7 +74,8 @@ include_HEADERS =H5public.h H5Apublic.h H5ACpublic.h H5Bpublic.h H5B2public.h \
|
||||
H5FDfphdf5.h H5FDlog.h H5FDmpi.h H5FDmpio.h H5FDmpiposix.h \
|
||||
H5FDmulti.h H5FDsec2.h $(SRB_HEADER) H5FDstdio.h H5FDstream.h H5FPpublic.h \
|
||||
H5Gpublic.h H5HGpublic.h H5HLpublic.h H5Ipublic.h \
|
||||
H5MMpublic.h H5Opublic.h H5Ppublic.h H5Rpublic.h H5Spublic.h \
|
||||
H5MMpublic.h H5Opublic.h H5Ppublic.h H5Rpublic.h H5Spublic.h \
|
||||
H5SHpublic.h \
|
||||
H5Tpublic.h H5Zpublic.h H5pubconf.h hdf5.h H5api_adpt.h
|
||||
|
||||
# Private headers
|
||||
@ -84,7 +86,8 @@ include_HEADERS =H5public.h H5Apublic.h H5ACpublic.h H5Bpublic.h H5B2public.h \
|
||||
# H5FOprivate.h H5FSprivate.h H5Gprivate.h H5Gpkg.h \
|
||||
# H5HGprivate.h H5HLprivate.h H5HPprivate.h H5Iprivate.h H5MFprivate.h \
|
||||
# H5MMprivate.h H5Oprivate.h H5Opkg.h H5Pprivate.h H5Ppkg.h \
|
||||
# H5Rprivate.h H5RCprivate.h H5RSprivate.h H5Sprivate.h H5STprivate.h \
|
||||
# H5Rprivate.h H5RCprivate.h H5RSprivate.h H5Sprivate.h H5SHprivate.h \
|
||||
# H5STprivate.h \
|
||||
# H5Tprivate.h H5Tpkg.h H5TSprivate.h H5Vprivate.h \
|
||||
# H5Zprivate.h H5Zpkg.h H5config.h
|
||||
|
||||
|
@ -96,12 +96,13 @@ am__libhdf5_la_SOURCES_DIST = H5.c H5A.c H5AC.c H5B.c H5B2.c \
|
||||
H5Oshared.c H5Ostab.c H5P.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c \
|
||||
H5Pfcpl.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 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 \
|
||||
H5Topaque.c H5Torder.c H5Tpad.c H5Tprecis.c H5Tstrpad.c \
|
||||
H5Tvlen.c H5TS.c H5V.c H5Z.c H5Zdeflate.c H5Zfletcher32.c \
|
||||
H5Znbit.c H5Zshuffle.c H5Zszip.c H5Zscaleoffset.c H5Ztrans.c
|
||||
H5Stest.c H5SH.c H5SHcache.c H5SHdbg.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 H5Topaque.c H5Torder.c \
|
||||
H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvlen.c H5TS.c H5V.c H5Z.c \
|
||||
H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c H5Zszip.c \
|
||||
H5Zscaleoffset.c H5Ztrans.c
|
||||
@BUILD_SRB_CONDITIONAL_TRUE@am__objects_1 = H5FDsrb.lo
|
||||
am_libhdf5_la_OBJECTS = H5.lo H5A.lo H5AC.lo H5B.lo H5B2.lo \
|
||||
H5B2cache.lo H5B2dbg.lo H5B2test.lo H5BT.lo H5BTbtree2.lo \
|
||||
@ -119,13 +120,14 @@ am_libhdf5_la_OBJECTS = H5.lo H5A.lo H5AC.lo H5B.lo H5B2.lo \
|
||||
H5Oshared.lo H5Ostab.lo H5P.lo H5Pdcpl.lo H5Pdxpl.lo \
|
||||
H5Pfapl.lo H5Pfcpl.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 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 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 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 \
|
||||
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
|
||||
@ -153,8 +155,8 @@ am__include_HEADERS_DIST = H5public.h H5Apublic.h H5ACpublic.h \
|
||||
H5FDmpiposix.h H5FDmulti.h H5FDsec2.h H5FDsrb.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 H5Tpublic.h H5Zpublic.h H5pubconf.h \
|
||||
hdf5.h H5api_adpt.h
|
||||
H5Rpublic.h H5Spublic.h H5SHpublic.h H5Tpublic.h H5Zpublic.h \
|
||||
H5pubconf.h hdf5.h H5api_adpt.h
|
||||
includeHEADERS_INSTALL = $(INSTALL_HEADER)
|
||||
HEADERS = $(include_HEADERS)
|
||||
ETAGS = etags
|
||||
@ -387,7 +389,8 @@ libhdf5_la_SOURCES = H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2cache.c H5B2dbg.c \
|
||||
H5Oname.c H5Onull.c H5Opline.c H5Osdspace.c H5Oshared.c H5Ostab.c \
|
||||
H5P.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.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 H5SL.c H5ST.c H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c \
|
||||
H5Sselect.c H5Stest.c H5SH.c H5SHcache.c H5SHdbg.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 H5Topaque.c H5Torder.c \
|
||||
H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvlen.c H5TS.c H5V.c H5Z.c \
|
||||
@ -402,7 +405,8 @@ include_HEADERS = H5public.h H5Apublic.h H5ACpublic.h H5Bpublic.h H5B2public.h \
|
||||
H5FDfphdf5.h H5FDlog.h H5FDmpi.h H5FDmpio.h H5FDmpiposix.h \
|
||||
H5FDmulti.h H5FDsec2.h $(SRB_HEADER) H5FDstdio.h H5FDstream.h H5FPpublic.h \
|
||||
H5Gpublic.h H5HGpublic.h H5HLpublic.h H5Ipublic.h \
|
||||
H5MMpublic.h H5Opublic.h H5Ppublic.h H5Rpublic.h H5Spublic.h \
|
||||
H5MMpublic.h H5Opublic.h H5Ppublic.h H5Rpublic.h H5Spublic.h \
|
||||
H5SHpublic.h \
|
||||
H5Tpublic.h H5Zpublic.h H5pubconf.h hdf5.h H5api_adpt.h
|
||||
|
||||
|
||||
@ -414,7 +418,8 @@ include_HEADERS = H5public.h H5Apublic.h H5ACpublic.h H5Bpublic.h H5B2public.h \
|
||||
# H5FOprivate.h H5FSprivate.h H5Gprivate.h H5Gpkg.h \
|
||||
# H5HGprivate.h H5HLprivate.h H5HPprivate.h H5Iprivate.h H5MFprivate.h \
|
||||
# H5MMprivate.h H5Oprivate.h H5Opkg.h H5Pprivate.h H5Ppkg.h \
|
||||
# H5Rprivate.h H5RCprivate.h H5RSprivate.h H5Sprivate.h H5STprivate.h \
|
||||
# H5Rprivate.h H5RCprivate.h H5RSprivate.h H5Sprivate.h H5SHprivate.h \
|
||||
# H5STprivate.h \
|
||||
# H5Tprivate.h H5Tpkg.h H5TSprivate.h H5Vprivate.h \
|
||||
# H5Zprivate.h H5Zpkg.h H5config.h
|
||||
|
||||
@ -615,6 +620,9 @@ 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@
|
||||
|
@ -33,12 +33,13 @@ endif
|
||||
|
||||
# These are our main targets. They should be listed in the order to be
|
||||
# executed, generally most specific tests to least specific tests.
|
||||
TEST_PROG=testhdf5 lheap ohdr stab gheap cache hyperslab istore bittests \
|
||||
TEST_PROG=testhdf5 lheap ohdr stab gheap cache btree2 blocktrack sheap \
|
||||
hyperslab istore bittests \
|
||||
dtypes dsets cmpd_dset extend external links unlink big mtime \
|
||||
fillval mount flush1 flush2 enum \
|
||||
set_extent ttsafe stream_test \
|
||||
set_extent ttsafe stream_test \
|
||||
getname file_handle ntypes dangle dtransform filename reserved \
|
||||
btree2 blocktrack $(SRB_TESTS)
|
||||
$(SRB_TESTS)
|
||||
|
||||
# List programs to be built when testing here. error_test and err_compat are
|
||||
# built at the same time as the other tests, but executed by testerror.sh.
|
||||
@ -93,7 +94,7 @@ MOSTLYCLEANFILES=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
|
||||
unlink_chunked.h5 btree2.h5 blocktrack.h5 sheap.h5
|
||||
|
||||
# Sources for testhdf5 executable
|
||||
testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tconfig.c tfile.c tgenprop.c \
|
||||
|
@ -29,7 +29,7 @@
|
||||
#
|
||||
# HDF5 Library Test Makefile(.in)
|
||||
#
|
||||
SOURCES = $(libh5test_la_SOURCES) big.c bittests.c blocktrack.c btree2.c cache.c cmpd_dset.c dangle.c dsets.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.c file_handle.c filename.c fillval.c flush1.c flush2.c getname.c gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c ntypes.c ohdr.c reserved.c set_extent.c srb_append.c srb_read.c srb_write.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c
|
||||
SOURCES = $(libh5test_la_SOURCES) big.c bittests.c blocktrack.c btree2.c cache.c cmpd_dset.c dangle.c dsets.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.c file_handle.c filename.c fillval.c flush1.c flush2.c getname.c gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c ntypes.c ohdr.c reserved.c set_extent.c sheap.c srb_append.c srb_read.c srb_write.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
@ -74,7 +74,8 @@ libh5test_la_OBJECTS = $(am_libh5test_la_OBJECTS)
|
||||
@BUILD_SRB_CONDITIONAL_TRUE@ srb_append$(EXEEXT) \
|
||||
@BUILD_SRB_CONDITIONAL_TRUE@ srb_read$(EXEEXT)
|
||||
am__EXEEXT_2 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \
|
||||
stab$(EXEEXT) gheap$(EXEEXT) cache$(EXEEXT) hyperslab$(EXEEXT) \
|
||||
stab$(EXEEXT) gheap$(EXEEXT) cache$(EXEEXT) btree2$(EXEEXT) \
|
||||
blocktrack$(EXEEXT) sheap$(EXEEXT) hyperslab$(EXEEXT) \
|
||||
istore$(EXEEXT) bittests$(EXEEXT) dtypes$(EXEEXT) \
|
||||
dsets$(EXEEXT) cmpd_dset$(EXEEXT) extend$(EXEEXT) \
|
||||
external$(EXEEXT) links$(EXEEXT) unlink$(EXEEXT) big$(EXEEXT) \
|
||||
@ -83,7 +84,7 @@ am__EXEEXT_2 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \
|
||||
ttsafe$(EXEEXT) stream_test$(EXEEXT) getname$(EXEEXT) \
|
||||
file_handle$(EXEEXT) ntypes$(EXEEXT) dangle$(EXEEXT) \
|
||||
dtransform$(EXEEXT) filename$(EXEEXT) reserved$(EXEEXT) \
|
||||
btree2$(EXEEXT) blocktrack$(EXEEXT) $(am__EXEEXT_1)
|
||||
$(am__EXEEXT_1)
|
||||
big_SOURCES = big.c
|
||||
big_OBJECTS = big.$(OBJEXT)
|
||||
big_LDADD = $(LDADD)
|
||||
@ -212,6 +213,10 @@ 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)
|
||||
srb_append_SOURCES = srb_append.c
|
||||
srb_append_OBJECTS = srb_append.$(OBJEXT)
|
||||
srb_append_LDADD = $(LDADD)
|
||||
@ -272,7 +277,7 @@ SOURCES = $(libh5test_la_SOURCES) big.c bittests.c blocktrack.c \
|
||||
dtypes.c enum.c err_compat.c error_test.c extend.c external.c \
|
||||
file_handle.c filename.c fillval.c flush1.c flush2.c getname.c \
|
||||
gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c \
|
||||
ntypes.c ohdr.c reserved.c set_extent.c srb_append.c \
|
||||
ntypes.c ohdr.c reserved.c set_extent.c sheap.c srb_append.c \
|
||||
srb_read.c srb_write.c stab.c stream_test.c \
|
||||
$(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c
|
||||
DIST_SOURCES = $(libh5test_la_SOURCES) big.c bittests.c blocktrack.c \
|
||||
@ -280,7 +285,7 @@ DIST_SOURCES = $(libh5test_la_SOURCES) big.c bittests.c blocktrack.c \
|
||||
dtypes.c enum.c err_compat.c error_test.c extend.c external.c \
|
||||
file_handle.c filename.c fillval.c flush1.c flush2.c getname.c \
|
||||
gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c \
|
||||
ntypes.c ohdr.c reserved.c set_extent.c srb_append.c \
|
||||
ntypes.c ohdr.c reserved.c set_extent.c sheap.c srb_append.c \
|
||||
srb_read.c srb_write.c stab.c stream_test.c \
|
||||
$(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c
|
||||
ETAGS = etags
|
||||
@ -492,12 +497,13 @@ check_SCRIPTS = $(TEST_SCRIPT)
|
||||
|
||||
# These are our main targets. They should be listed in the order to be
|
||||
# executed, generally most specific tests to least specific tests.
|
||||
TEST_PROG = testhdf5 lheap ohdr stab gheap cache hyperslab istore bittests \
|
||||
TEST_PROG = testhdf5 lheap ohdr stab gheap cache btree2 blocktrack sheap \
|
||||
hyperslab istore bittests \
|
||||
dtypes dsets cmpd_dset extend external links unlink big mtime \
|
||||
fillval mount flush1 flush2 enum \
|
||||
set_extent ttsafe stream_test \
|
||||
set_extent ttsafe stream_test \
|
||||
getname file_handle ntypes dangle dtransform filename reserved \
|
||||
btree2 blocktrack $(SRB_TESTS)
|
||||
$(SRB_TESTS)
|
||||
|
||||
|
||||
# The libh5test.a library provides common support code for the tests.
|
||||
@ -536,7 +542,7 @@ MOSTLYCLEANFILES = cmpd_dset.h5 compact_dataset.h5 dataset.h5 extend.h5 istore.h
|
||||
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
|
||||
unlink_chunked.h5 btree2.h5 blocktrack.h5 sheap.h5
|
||||
|
||||
|
||||
# Sources for testhdf5 executable
|
||||
@ -704,6 +710,9 @@ 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)
|
||||
srb_append$(EXEEXT): $(srb_append_OBJECTS) $(srb_append_DEPENDENCIES)
|
||||
@rm -f srb_append$(EXEEXT)
|
||||
$(LINK) $(srb_append_LDFLAGS) $(srb_append_OBJECTS) $(srb_append_LDADD) $(LIBS)
|
||||
@ -771,6 +780,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ohdr.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)/srb_append.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/srb_read.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/srb_write.Po@am__quote@
|
||||
|
259
test/sheap.c
Normal file
259
test/sheap.c
Normal file
@ -0,0 +1,259 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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 */
|
||||
if(obj_addr != 1178) TEST_ERROR;
|
||||
|
||||
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 */
|
||||
if(obj_addr != 1188) TEST_ERROR;
|
||||
|
||||
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 */
|
||||
if(obj_addr != 6298) TEST_ERROR;
|
||||
|
||||
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 */
|
||||
if(obj_addr != 6810) TEST_ERROR;
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -29,6 +29,7 @@
|
||||
#define H5B2_PACKAGE /*suppress error about including H5B2pkg */
|
||||
#define H5B2_TESTING /*suppress warning about H5B2 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"
|
||||
@ -42,6 +43,7 @@
|
||||
#include "H5Iprivate.h"
|
||||
#include "H5Opkg.h"
|
||||
#include "H5Pprivate.h"
|
||||
#include "H5SHpkg.h" /* Segmented heap */
|
||||
|
||||
/* File drivers */
|
||||
#include "H5FDfamily.h"
|
||||
@ -253,6 +255,12 @@ main(int argc, char *argv[])
|
||||
*/
|
||||
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 (sig[0] == H5O_VERSION) {
|
||||
/*
|
||||
* This could be an object header. Since they don't have a signature
|
||||
|
Loading…
x
Reference in New Issue
Block a user