From aa03e8bc941ea62a60128210a7f3a1f8dac9fcba Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 28 Aug 2008 09:57:13 -0500 Subject: [svn-r15549] Description: Initial checkin of extensible array data structure prototype code and regression tests. Initial definitions for revised FUNC_ENTER/LEAVE and error reporting macros, which are being vetted in the extensible array code. Minor warning and formatting cleanups in other sections of code. Tested on: Mac OS X/32 10.5.4 (amazon) in debug mode Mac OS X/32 10.5.4 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode --- MANIFEST | 8 + src/H5AC.c | 1 + src/H5ACprivate.h | 1 + src/H5Cpkg.h | 2 +- src/H5E.c | 5 + src/H5EA.c | 403 +++++++++++++++++++++++++++++++++++++++++++++++++ src/H5EAcache.c | 392 ++++++++++++++++++++++++++++++++++++++++++++++++ src/H5EAhdr.c | 413 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/H5EAint.c | 81 ++++++++++ src/H5EApkg.h | 440 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/H5EAprivate.h | 91 +++++++++++ src/H5EAtest.c | 152 +++++++++++++++++++ src/H5Edefin.h | 1 + src/H5Einit.h | 5 + src/H5Eint.c | 103 ++++++++++++- src/H5Eprivate.h | 10 +- src/H5Epubgen.h | 2 + src/H5Eterm.h | 1 + src/H5FDpublic.h | 8 + src/H5HF.c | 6 + src/H5err.txt | 1 + src/H5private.h | 21 +-- src/Makefile.am | 1 + src/Makefile.in | 26 ++-- test/Makefile.am | 4 +- test/Makefile.in | 37 +++-- test/earray.c | 381 ++++++++++++++++++++++++++++++++++++++++++++++ test/fheap.c | 132 ++++++++-------- 28 files changed, 2620 insertions(+), 108 deletions(-) create mode 100644 src/H5EA.c create mode 100644 src/H5EAcache.c create mode 100644 src/H5EAhdr.c create mode 100644 src/H5EAint.c create mode 100644 src/H5EApkg.h create mode 100644 src/H5EAprivate.h create mode 100644 src/H5EAtest.c create mode 100644 test/earray.c diff --git a/MANIFEST b/MANIFEST index 467b101..3f8a3a3 100644 --- a/MANIFEST +++ b/MANIFEST @@ -495,6 +495,13 @@ ./src/H5Epubgen.h ./src/H5Epublic.h ./src/H5Eterm.h +./src/H5EA.c +./src/H5EAcache.c +./src/H5EAhdr.c +./src/H5EAint.c +./src/H5EApkg.h +./src/H5EAprivate.h +./src/H5EAtest.c ./src/H5F.c ./src/H5Fdbg.c ./src/H5Ffake.c @@ -767,6 +774,7 @@ ./test/dt_arith.c ./test/dtypes.c ./test/dtransform.c +./test/earray.c ./test/enum.c ./test/extend.c ./test/external.c diff --git a/src/H5AC.c b/src/H5AC.c index 6840d7a..83ab0a4 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -491,6 +491,7 @@ static const char * H5AC_entry_type_names[H5AC_NTYPES] = "free space sections", "shared OH message master table", "shared OH message index", + "extensible array headers", "test entry" /* for testing only -- not used for actual files */ }; diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index bbbcf11..da18cd5 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -62,6 +62,7 @@ typedef enum { H5AC_FSPACE_SINFO_ID,/*free space sections */ H5AC_SOHM_TABLE_ID, /*shared object header message master table */ H5AC_SOHM_LIST_ID, /*shared message index stored as a list */ + H5AC_EARRAY_HDR_ID, /*extensible array header */ H5AC_TEST_ID, /*test entry -- not used for actual files */ H5AC_NTYPES /* Number of types, must be last */ } H5AC_type_t; diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 7c04ea2..c82443b 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -802,7 +802,7 @@ ****************************************************************************/ #define H5C__H5C_T_MAGIC 0x005CAC0E -#define H5C__MAX_NUM_TYPE_IDS 16 +#define H5C__MAX_NUM_TYPE_IDS 17 #define H5C__PREFIX_LEN 32 struct H5C_t diff --git a/src/H5E.c b/src/H5E.c index 7112d6e..7b64892 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -1301,6 +1301,11 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, if(maj_ptr->cls != min_ptr->cls) HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "major and minor errors not from same error class") +/* Note that the variable-argument parsing for the format is identical in + * the H5E_printf_stack() routine - correct errors and make changes in both + * places. -QAK + */ + /* Format the description */ va_start(ap, fmt); diff --git a/src/H5EA.c b/src/H5EA.c new file mode 100644 index 0000000..d25a16c --- /dev/null +++ b/src/H5EA.c @@ -0,0 +1,403 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * + * Created: H5EA.c + * Jun 17 2008 + * Quincey Koziol + * + * Purpose: Implements an "extensible array" for storing elements + * in an array whose high bounds can extend and shrink. + * + * Please see the documentation in: + * doc/html/TechNotes/ExtensibleArray.html for a full + * description of how they work, etc. + * + *------------------------------------------------------------------------- + */ + +/**********************/ +/* Module Declaration */ +/**********************/ + +#define H5EA_MODULE + + +/***********************/ +/* Other Packages Used */ +/***********************/ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5EApkg.h" /* Extensible Arrays */ + + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + +/* HDF5 API Entered variable */ +/* (move to H5.c when new FUNC_ENTER macros in actual use -QAK) */ +hbool_t H5_api_entered_g = FALSE; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + +/* Declare a free list to manage the H5EA_t struct */ +H5FL_DEFINE_STATIC(H5EA_t); + + + +/*------------------------------------------------------------------------- + * Function: H5EA_create + * + * Purpose: Creates a new empty extensible array in the file. + * + * Return: Pointer to earray wrapper on success + * NULL on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Jun 17 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PRIV, ERR, +H5EA_t *, NULL, NULL, +H5EA_create(H5F_t *f, hid_t dxpl_id, const H5EA_create_t *cparam)) + + /* Local variables */ + H5EA_t *ea = NULL; /* Pointer to new extensible array */ + H5EA_hdr_t *hdr = NULL; /* The extensible array header information */ + haddr_t ea_addr; /* Array header address */ + +#ifdef QAK +HDfprintf(stderr, "%s: Called\n", FUNC); +#endif /* QAK */ + + /* + * Check arguments. + */ + HDassert(f); + HDassert(cparam); + + /* Create extensible array header */ + if(HADDR_UNDEF == (ea_addr = H5EA__hdr_create(f, dxpl_id, cparam))) + H5E_THROW(H5E_CANTINIT, "can't create extensible array header") + + /* Allocate extensible array wrapper */ + if(NULL == (ea = H5FL_MALLOC(H5EA_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array info") + + /* Lock the array header into memory */ + if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, NULL, NULL, H5AC_WRITE))) + H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") + + /* Point extensible array wrapper at header and bump it's ref count */ + ea->hdr = hdr; + if(H5EA__hdr_incr(ea->hdr) < 0) + H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + + /* Increment # of files using this array header */ + if(H5EA__hdr_fuse_incr(ea->hdr) < 0) + H5E_THROW(H5E_CANTINC, "can't increment file reference count on shared array header") + + /* Set file pointer for this array open context */ + ea->f = f; + + /* Set the return value */ + ret_value = ea; + +CATCH + + if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, hdr, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + if(!ret_value) + if(ea && H5EA_close(ea, dxpl_id) < 0) + H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array") + +END_FUNC(PRIV) /* end H5EA_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5EA_get_nelmts + * + * Purpose: Query the current number of elements in array + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 21 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PRIV, NOERR, +herr_t, SUCCEED, -, +H5EA_get_nelmts(const H5EA_t *ea, hsize_t *nelmts)) + + /* Local variables */ + +#ifdef QAK +HDfprintf(stderr, "%s: Called\n", FUNC); +#endif /* QAK */ + + /* + * Check arguments. + */ + HDassert(ea); + HDassert(nelmts); + + /* Placeholder value */ + *nelmts = 0; + +END_FUNC(PRIV) /* end H5EA_get_nelmts() */ + + +/*------------------------------------------------------------------------- + * Function: H5EA_get_addr + * + * Purpose: Query the address of the array + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 21 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PRIV, NOERR, +herr_t, SUCCEED, -, +H5EA_get_addr(const H5EA_t *ea, haddr_t *addr)) + + /* Local variables */ + +#ifdef QAK +HDfprintf(stderr, "%s: Called\n", FUNC); +#endif /* QAK */ + + /* + * Check arguments. + */ + HDassert(ea); + HDassert(ea->hdr); + HDassert(addr); + + /* Retrieve the address of the extensible array's header */ + *addr = ea->hdr->addr; + +END_FUNC(PRIV) /* end H5EA_get_addr() */ + + +/*------------------------------------------------------------------------- + * Function: H5EA_get_stats + * + * Purpose: Query the metadata stats of an array + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 21 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PRIV, NOERR, +herr_t, SUCCEED, -, +H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats)) + + /* Local variables */ + +#ifdef QAK +HDfprintf(stderr, "%s: Called\n", FUNC); +#endif /* QAK */ + + /* + * Check arguments. + */ + HDassert(ea); + HDassert(stats); + + /* Placeholder value */ + HDmemset(stats, 0, sizeof(*stats)); + +END_FUNC(PRIV) /* end H5EA_get_stats() */ + + +/*------------------------------------------------------------------------- + * Function: H5EA_delete + * + * Purpose: Delete an extensible array + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 28 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PRIV, ERR, +herr_t, SUCCEED, FAIL, +H5EA_delete(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr)) + + /* Local variables */ + H5EA_hdr_t *hdr = NULL; /* The fractal heap header information */ + + /* + * Check arguments. + */ + HDassert(f); + HDassert(H5F_addr_defined(ea_addr)); + + /* Lock the array header into memory */ +#ifdef QAK +HDfprintf(stderr, "%s: ea_addr = %a\n", FUNC, ea_addr); +#endif /* QAK */ + if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, NULL, NULL, H5AC_WRITE))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu", (unsigned long_long)ea_addr) + + /* Check for files using shared array header */ + if(hdr->file_rc) + hdr->pending_delete = TRUE; + else { + /* Set the shared array header's file context for this operation */ + hdr->f = f; + + /* Delete array now, starting with header (unprotects header) */ + if(H5EA__hdr_delete(hdr, dxpl_id) < 0) + H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array") + hdr = NULL; + } /* end if */ + +CATCH + + /* Unprotect the header, if an error occurred */ + if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, hdr, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + +END_FUNC(PRIV) /* end H5EA_delete() */ + + +/*------------------------------------------------------------------------- + * Function: H5EA_close + * + * Purpose: Close an extensible array + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 21 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PRIV, ERR, +herr_t, SUCCEED, FAIL, +H5EA_close(H5EA_t *ea, hid_t dxpl_id)) + + /* Local variables */ + hbool_t pending_delete = FALSE; /* Whether the array is pending deletion */ + haddr_t ea_addr = HADDR_UNDEF; /* Address of array (for deletion) */ + +#ifdef QAK +HDfprintf(stderr, "%s: Called\n", FUNC); +#endif /* QAK */ + + /* + * Check arguments. + */ + HDassert(ea); + + /* Decrement file reference & check if this is the last open extensible array using the shared array header */ + if(0 == H5EA__hdr_fuse_decr(ea->hdr)) { + /* Set the shared array header's file context for this operation */ + ea->hdr->f = ea->f; + + /* Shut down anything that can't be put in the header's 'flush' callback */ + + /* Check for pending array deletion */ + if(ea->hdr->pending_delete) { + /* Set local info, so array deletion can occur after decrementing the + * header's ref count + */ + pending_delete = TRUE; + ea_addr = ea->hdr->addr; + } /* end if */ + } /* end if */ + + /* Decrement the reference count on the array header */ + /* (don't put in H5EA_hdr_fuse_decr() as the array header may be evicted + * immediately -QAK) + */ + if(H5EA__hdr_decr(ea->hdr) < 0) + H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") + + /* Check for pending array deletion */ + if(pending_delete) { + H5EA_hdr_t *hdr; /* Another pointer to extensible array header */ + + /* Lock the array header into memory */ + if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(ea->f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, NULL, NULL, H5AC_WRITE))) + H5E_THROW(H5E_CANTLOAD, "unable to load extensible array header") + + /* Set the shared array header's file context for this operation */ + hdr->f = ea->f; + + /* Delete array, starting with header (unprotects header) */ + if(H5EA__hdr_delete(hdr, dxpl_id) < 0) + H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array") + } /* end if */ + + /* Release the extensible array wrapper */ + (void)H5FL_FREE(H5EA_t, ea); + +CATCH + +END_FUNC(PRIV) /* end H5EA_close() */ + diff --git a/src/H5EAcache.c b/src/H5EAcache.c new file mode 100644 index 0000000..3fc408d --- /dev/null +++ b/src/H5EAcache.c @@ -0,0 +1,392 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * + * Created: H5EAcache.c + * Aug 26 2008 + * Quincey Koziol + * + * Purpose: Implement extensible array metadata cache methods. + * + *------------------------------------------------------------------------- + */ + +/**********************/ +/* Module Declaration */ +/**********************/ + +#define H5EA_MODULE + + +/***********************/ +/* Other Packages Used */ +/***********************/ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5EApkg.h" /* Extensible Arrays */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5WBprivate.h" /* Wrapped Buffers */ + + +/****************/ +/* Local Macros */ +/****************/ + +/* Fractal heap format version #'s */ +#define H5EA_HDR_VERSION 0 /* Header */ + +/* Size of stack buffer for serialized headers */ +#define H5EA_HDR_BUF_SIZE 512 + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + +/* Metadata cache (H5AC) callbacks */ +static H5EA_hdr_t *H5EA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata, void *udata2); +static herr_t H5EA__cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5EA_hdr_t *hdr, unsigned UNUSED * flags_ptr); +static herr_t H5EA__cache_hdr_clear(H5F_t *f, H5EA_hdr_t *hdr, hbool_t destroy); +static herr_t H5EA__cache_hdr_size(const H5F_t *f, const H5EA_hdr_t *hdr, size_t *size_ptr); + + +/*********************/ +/* Package Variables */ +/*********************/ + +/* H5EA header inherits cache-like properties from H5AC */ +const H5AC_class_t H5AC_EARRAY_HDR[1] = {{ + H5AC_EARRAY_HDR_ID, + (H5AC_load_func_t)H5EA__cache_hdr_load, + (H5AC_flush_func_t)H5EA__cache_hdr_flush, + (H5AC_dest_func_t)H5EA__cache_hdr_dest, + (H5AC_clear_func_t)H5EA__cache_hdr_clear, + (H5AC_size_func_t)H5EA__cache_hdr_size, +}}; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*------------------------------------------------------------------------- + * Function: H5EA_cache_hdr_load + * + * Purpose: Loads an extensible array header from the disk. + * + * Return: Success: Pointer to a new extensible array + * Failure: NULL + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 26 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(STATIC, ERR, +H5EA_hdr_t *, NULL, NULL, +H5EA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1, void UNUSED *udata2)) + + H5EA_hdr_t *hdr = NULL; /* Fractal heap info */ + size_t size; /* Header size */ + H5WB_t *wb = NULL; /* Wrapped buffer for header data */ + uint8_t hdr_buf[H5EA_HDR_BUF_SIZE]; /* Buffer for header */ + uint8_t *buf; /* Pointer to header buffer */ + const uint8_t *p; /* Pointer into raw data buffer */ + uint32_t stored_chksum; /* Stored metadata checksum value */ + uint32_t computed_chksum; /* Computed metadata checksum value */ + + /* Check arguments */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + + /* Allocate space for the extensible array data structure */ + if(NULL == (hdr = H5EA__hdr_alloc(f))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header") + + /* Set the extensible array header's address */ + hdr->addr = addr; + + /* Wrap the local buffer for serialized header info */ + if(NULL == (wb = H5WB_wrap(hdr_buf, sizeof(hdr_buf)))) + H5E_THROW(H5E_CANTINIT, "can't wrap buffer") + + /* Compute the 'base' size of the fractal heap header on disk */ + size = H5EA_HEADER_SIZE(hdr); + + /* Get a pointer to a buffer that's large enough for serialized header */ + if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size))) + H5E_THROW(H5E_CANTGET, "can't get actual buffer") + + /* Read header from disk */ + if(H5F_block_read(f, H5FD_MEM_EARRAY_HDR, addr, size, dxpl_id, buf) < 0) + H5E_THROW(H5E_READERROR, "can't read extensible array header") + + /* Get temporary pointer to serialized header */ + p = buf; + + /* Magic number */ + if(HDmemcmp(p, H5EA_HDR_MAGIC, (size_t)H5EA_SIZEOF_MAGIC)) + H5E_THROW(H5E_BADVALUE, "wrong extensible array header signature") + p += H5EA_SIZEOF_MAGIC; + + /* Version */ + if(*p++ != H5EA_HDR_VERSION) + H5E_THROW(H5E_VERSION, "wrong extensible array header version") + + /* General array information */ + hdr->elmt_size = *p++; /* Element size (in bytes) */ + hdr->idx_blk_elmts = *p++; /* # of elements to store in index block */ + hdr->data_blk_min_elmts = *p++; /* Min. # of elements per data block */ + hdr->sup_blk_min_data_ptrs = *p++; /* Min. # of data block pointers for a super block */ + + /* Sanity check */ + /* (allow for checksum not decoded yet) */ + HDassert((size_t)(p - buf) == (size - H5EA_SIZEOF_CHKSUM)); + + /* Set the array header's size */ + hdr->size = size; + + /* Compute checksum on entire header */ + /* (including the filter information, if present) */ + computed_chksum = H5_checksum_metadata(buf, (size_t)(p - buf), 0); + + /* Metadata checksum */ + UINT32DECODE(p, stored_chksum); + + /* Sanity check */ + HDassert((size_t)(p - buf) == hdr->size); + + /* Verify checksum */ + if(stored_chksum != computed_chksum) + H5E_THROW(H5E_BADVALUE, "incorrect metadata checksum for extensible array header") + + /* Set return value */ + ret_value = hdr; + +CATCH + + /* Release resources */ + if(wb && H5WB_unwrap(wb) < 0) + H5E_THROW(H5E_CLOSEERROR, "can't close wrapped buffer") + if(!ret_value) + if(hdr && H5EA__cache_hdr_dest(f, hdr) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header") + +END_FUNC(STATIC) /* end H5EA__cache_hdr_load() */ + + +/*------------------------------------------------------------------------- + * Function: H5EA__cache_hdr_flush + * + * Purpose: Flushes a dirty extensible array header to disk. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 26 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(STATIC, ERR, +herr_t, SUCCEED, FAIL, +H5EA__cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5EA_hdr_t *hdr, unsigned UNUSED * flags_ptr)) + + H5WB_t *wb = NULL; /* Wrapped buffer for header data */ + uint8_t hdr_buf[H5EA_HDR_BUF_SIZE]; /* Buffer for header */ + + /* check arguments */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(hdr); + + if(hdr->cache_info.is_dirty) { + uint8_t *buf; /* Temporary raw data buffer */ + uint8_t *p; /* Pointer into raw data buffer */ + size_t size; /* Header size on disk */ + uint32_t metadata_chksum; /* Computed metadata checksum value */ + + /* Wrap the local buffer for serialized header info */ + if(NULL == (wb = H5WB_wrap(hdr_buf, sizeof(hdr_buf)))) + H5E_THROW(H5E_CANTINIT, "can't wrap buffer") + + /* Compute the size of the heap header on disk */ + size = hdr->size; + + /* Get a pointer to a buffer that's large enough for serialized header */ + if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size))) + H5E_THROW(H5E_CANTGET, "can't get actual buffer") + + /* Get temporary pointer to serialized header */ + p = buf; + + /* Magic number */ + HDmemcpy(p, H5EA_HDR_MAGIC, (size_t)H5EA_SIZEOF_MAGIC); + p += H5EA_SIZEOF_MAGIC; + + /* Version # */ + *p++ = H5EA_HDR_VERSION; + + /* General array information */ + *p++ = hdr->elmt_size; /* Element size (in bytes) */ + *p++ = hdr->idx_blk_elmts; /* # of elements to store in index block */ + *p++ = hdr->data_blk_min_elmts; /* Min. # of elements per data block */ + *p++ = hdr->sup_blk_min_data_ptrs; /* Min. # of data block pointers for a super block */ + + /* Compute metadata checksum */ + metadata_chksum = H5_checksum_metadata(buf, (size_t)(p - buf), 0); + + /* Metadata checksum */ + UINT32ENCODE(p, metadata_chksum); + + /* Write the array header. */ + HDassert((size_t)(p - buf) == size); + if(H5F_block_write(f, H5FD_MEM_EARRAY_HDR, addr, size, dxpl_id, buf) < 0) + H5E_THROW(H5E_WRITEERROR, "unable to save extensible array header to disk") + + hdr->cache_info.is_dirty = FALSE; + } /* end if */ + + if(destroy) + if(H5EA__cache_hdr_dest(f, hdr) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header") + +CATCH + + /* Release resources */ + if(wb && H5WB_unwrap(wb) < 0) + H5E_THROW(H5E_CLOSEERROR, "can't close wrapped buffer") + +END_FUNC(STATIC) /* end H5EA__cache_hdr_flush() */ + + +/*------------------------------------------------------------------------- + * Function: H5EA__cache_hdr_dest + * + * Purpose: Destroys a extensible array header in memory. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 26 2008 + * + *------------------------------------------------------------------------- + */ +/* ARGSUSED */ +BEGIN_FUNC(PKG, NOERR, +herr_t, SUCCEED, -, +H5EA__cache_hdr_dest(H5F_t UNUSED *f, H5EA_hdr_t *hdr)) + + /* + * Check arguments. + */ + HDassert(hdr); + HDassert(hdr->rc == 0); + + /* Free the shared info itself */ + (void)H5FL_FREE(H5EA_hdr_t, hdr); + +END_FUNC(PKG) /* end H5EA__cache_hdr_dest() */ + + +/*------------------------------------------------------------------------- + * Function: H5EA__cache_hdr_clear + * + * Purpose: Mark a extensible array header in memory as non-dirty. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 26 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(STATIC, ERR, +herr_t, SUCCEED, FAIL, +H5EA__cache_hdr_clear(H5F_t *f, H5EA_hdr_t *hdr, hbool_t destroy)) + + /* + * Check arguments. + */ + HDassert(hdr); + + /* Reset the dirty flag. */ + hdr->cache_info.is_dirty = FALSE; + + if(destroy) + if(H5EA__cache_hdr_dest(f, hdr) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header") + +CATCH + +END_FUNC(STATIC) /* end H5EA__cache_hdr_clear() */ + + +/*------------------------------------------------------------------------- + * Function: H5EA__cache_hdr_size + * + * Purpose: Compute the size in bytes of a extensible array header + * on disk, and return it in *size_ptr. On failure, + * the value of *size_ptr is undefined. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 26 2008 + * + *------------------------------------------------------------------------- + */ +/* ARGSUSED */ +BEGIN_FUNC(STATIC, NOERR, +herr_t, SUCCEED, -, +H5EA__cache_hdr_size(const H5F_t UNUSED *f, const H5EA_hdr_t *hdr, size_t *size_ptr)) + + /* check arguments */ + HDassert(f); + HDassert(hdr); + HDassert(size_ptr); + + /* Set size value */ + *size_ptr = hdr->size; + +END_FUNC(STATIC) /* end H5EA__cache_hdr_size() */ + diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c new file mode 100644 index 0000000..2f14e6c --- /dev/null +++ b/src/H5EAhdr.c @@ -0,0 +1,413 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * + * Created: H5EAhdr.c + * Aug 26 2008 + * Quincey Koziol + * + * Purpose: Array header routines for extensible arrays. + * + *------------------------------------------------------------------------- + */ + +/**********************/ +/* Module Declaration */ +/**********************/ + +#define H5EA_MODULE + + +/***********************/ +/* Other Packages Used */ +/***********************/ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5EApkg.h" /* Extensible Arrays */ +#include "H5MFprivate.h" /* File memory management */ + + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + +/* Declare a free list to manage the H5EA_hdr_t struct */ +H5FL_DEFINE(H5EA_hdr_t); + + + +/*------------------------------------------------------------------------- + * Function: H5EA__hdr_alloc + * + * Purpose: Allocate shared extensible array header + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 26 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PKG, ERR, +H5EA_hdr_t *, NULL, NULL, +H5EA__hdr_alloc(H5F_t *f)) + + H5EA_hdr_t *hdr = NULL; /* Shared fractal heap header */ + + /* + * Check arguments. + */ + HDassert(f); + + /* Allocate space for the shared information */ + if(NULL == (hdr = H5FL_CALLOC(H5EA_hdr_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header") + + /* Set the internal parameters for the array */ + hdr->f = f; + + /* Set the return value */ + ret_value = hdr; + +CATCH + if(!ret_value) + if(hdr && H5EA__cache_hdr_dest(f, hdr) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header") + +END_FUNC(PKG) /* end H5EA__hdr_alloc() */ + + +/*------------------------------------------------------------------------- + * Function: H5EA_hdr_create + * + * Purpose: Creates a new extensible array header in the file + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Jun 17 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PKG, ERR, +haddr_t, HADDR_UNDEF, HADDR_UNDEF, +H5EA__hdr_create(H5F_t *f, hid_t dxpl_id, const H5EA_create_t *cparam)) + + H5EA_hdr_t *hdr; /* Extensible array header */ + +#ifdef QAK +HDfprintf(stderr, "%s: Called\n", FUNC); +#endif /* QAK */ + + /* + * Check arguments. + */ + HDassert(f); + HDassert(cparam); + +#ifndef NDEBUG + /* Check for valid parameters */ + if(cparam->elmt_size == 0) + H5E_THROW(H5E_BADVALUE, "element size must be greater than zero") + if(!POWER_OF_TWO(cparam->sup_blk_min_data_ptrs)) + H5E_THROW(H5E_BADVALUE, "min # of data block pointers in super block not power of two") + if(!POWER_OF_TWO(cparam->data_blk_min_elmts)) + H5E_THROW(H5E_BADVALUE, "min # of elements per data block not power of two") +#endif /* NDEBUG */ + + /* Allocate space for the shared information */ + if(NULL == (hdr = H5EA__hdr_alloc(f))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header") + + /* Set the internal parameters for the array */ + + /* Set the creation parameters for the array */ + hdr->elmt_size = cparam->elmt_size; + hdr->idx_blk_elmts = cparam->idx_blk_elmts; + hdr->sup_blk_min_data_ptrs = cparam->sup_blk_min_data_ptrs; + hdr->data_blk_min_elmts = cparam->data_blk_min_elmts; + + /* Set size of header on disk */ + hdr->size = H5EA_HEADER_SIZE(hdr); + + /* Allocate space for the header on disk */ + if(HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_EARRAY_HDR, dxpl_id, hdr->size))) + H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array header") + + /* Cache the new extensible array header */ + if(H5AC_set(f, dxpl_id, H5AC_EARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTINSERT, "can't add extensible array header to cache") + + /* Set address of array header to return */ + ret_value = hdr->addr; + + +CATCH + +END_FUNC(PKG) /* end H5EA__hdr_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5EA_hdr_incr + * + * Purpose: Increment component reference count on shared array header + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 26 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PKG, ERR, +herr_t, SUCCEED, FAIL, +H5EA__hdr_incr(H5EA_hdr_t *hdr)) + + /* Sanity check */ + HDassert(hdr); + + /* Mark header as un-evictable when something is depending on it */ + if(hdr->rc == 0) + if(H5AC_pin_protected_entry(hdr->f, hdr) < 0) + H5E_THROW(H5E_CANTPIN, "unable to pin extensible array header") + + /* Increment reference count on shared header */ + hdr->rc++; + +CATCH + +END_FUNC(PKG) /* end H5EA__hdr_incr() */ + + +/*------------------------------------------------------------------------- + * Function: H5EA_hdr_decr + * + * Purpose: Decrement component reference count on shared array header + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 26 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PKG, ERR, +herr_t, SUCCEED, FAIL, +H5EA__hdr_decr(H5EA_hdr_t *hdr)) + + /* Sanity check */ + HDassert(hdr); + HDassert(hdr->rc); + + /* Decrement reference count on shared header */ + hdr->rc--; + + /* Mark header as evictable again when nothing depend on it */ + if(hdr->rc == 0) { + HDassert(hdr->file_rc == 0); + if(H5AC_unpin_entry(hdr->f, hdr) < 0) + H5E_THROW(H5E_CANTUNPIN, "unable to unpin extensible array header") + } /* end if */ + +CATCH + +END_FUNC(PKG) /* end H5EA__hdr_decr() */ + + +/*------------------------------------------------------------------------- + * Function: H5EA_hdr_fuse_incr + * + * Purpose: Increment file reference count on shared array header + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 26 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PKG, NOERR, +herr_t, SUCCEED, -, +H5EA__hdr_fuse_incr(H5EA_hdr_t *hdr)) + + /* Sanity check */ + HDassert(hdr); + + /* Increment file reference count on shared header */ + hdr->file_rc++; + +END_FUNC(PKG) /* end H5EA__hdr_fuse_incr() */ + + +/*------------------------------------------------------------------------- + * Function: H5EA_hdr_fuse_decr + * + * Purpose: Decrement file reference count on shared array header + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 26 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PKG, NOERR, +size_t, 0, -, +H5EA__hdr_fuse_decr(H5EA_hdr_t *hdr)) + + /* Sanity check */ + HDassert(hdr); + HDassert(hdr->file_rc); + + /* Decrement file reference count on shared header */ + hdr->file_rc--; + + /* Set return value */ + ret_value = hdr->file_rc; + +END_FUNC(PKG) /* end H5EA__hdr_fuse_decr() */ + + +/*------------------------------------------------------------------------- + * Function: H5EA__hdr_delete + * + * Purpose: Delete an extensible array, starting with the header + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 26 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PKG, ERR, +herr_t, SUCCEED, FAIL, +H5EA__hdr_delete(H5EA_hdr_t *hdr, hid_t dxpl_id)) + + /* + * Check arguments. + */ + HDassert(hdr); + HDassert(!hdr->file_rc); + +#ifndef NDEBUG +{ + unsigned hdr_status = 0; /* Array header's status in the metadata cache */ + + /* Check the array header's status in the metadata cache */ + if(H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0) + H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for array header") + + /* Sanity checks on array header */ + HDassert(hdr_status & H5AC_ES__IN_CACHE); + HDassert(hdr_status & H5AC_ES__IS_PROTECTED); +} /* end block */ +#endif /* NDEBUG */ + +#ifdef LATER + /* Check for root direct/indirect block */ + if(H5F_addr_defined(hdr->man_dtable.table_addr)) { +#ifdef QAK +HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a\n", FUNC, hdr->man_dtable.table_addr); +#endif /* QAK */ + if(hdr->man_dtable.curr_root_rows == 0) { + hsize_t dblock_size; /* Size of direct block */ + + /* Check for I/O filters on this heap */ + if(hdr->filter_len > 0) { + dblock_size = (hsize_t)hdr->pline_root_direct_size; +#ifdef QAK +HDfprintf(stderr, "%s: hdr->pline_root_direct_size = %Zu\n", FUNC, hdr->pline_root_direct_size); +#endif /* QAK */ + + /* Reset the header's pipeline information */ + hdr->pline_root_direct_size = 0; + hdr->pline_root_direct_filter_mask = 0; + } /* end else */ + else + dblock_size = (hsize_t)hdr->man_dtable.cparam.start_block_size; + + /* Delete root direct block */ + if(H5HF_man_dblock_delete(hdr->f, dxpl_id, hdr->man_dtable.table_addr, dblock_size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release fractal heap root direct block") + } /* end if */ + else { + /* Delete root indirect block */ + if(H5HF_man_iblock_delete(hdr, dxpl_id, hdr->man_dtable.table_addr, hdr->man_dtable.curr_root_rows, NULL, 0) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release fractal heap root indirect block") + } /* end else */ + } /* end if */ +#endif /* LATER */ + + /* Release header's disk space */ + if(H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_HDR, dxpl_id, hdr->addr, (hsize_t)hdr->size) < 0) + H5E_THROW(H5E_CANTFREE, "unable to release extensible array header") + + /* Finished deleting header */ + if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_EARRAY_HDR, hdr->addr, hdr, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + hdr = NULL; + +CATCH + + /* Unprotect the header, if an error occurred */ + if(hdr && H5AC_unprotect(hdr->f, dxpl_id, H5AC_EARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + +END_FUNC(PKG) /* end H5EA__hdr_delete() */ + diff --git a/src/H5EAint.c b/src/H5EAint.c new file mode 100644 index 0000000..a53d4f9 --- /dev/null +++ b/src/H5EAint.c @@ -0,0 +1,81 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * + * Created: H5EAint.c + * Jun 17 2008 + * Quincey Koziol + * + * Purpose: Internal routines for extnsible arrays. + * + *------------------------------------------------------------------------- + */ + +/**********************/ +/* Module Declaration */ +/**********************/ + +#define H5EA_MODULE + + +/***********************/ +/* Other Packages Used */ +/***********************/ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5EApkg.h" /* Extensible Arrays */ + + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + diff --git a/src/H5EApkg.h b/src/H5EApkg.h new file mode 100644 index 0000000..95e5c60 --- /dev/null +++ b/src/H5EApkg.h @@ -0,0 +1,440 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol + * Tuesday, June 17, 2008 + * + * Purpose: This file contains declarations which are visible only within + * the H5EA package. Source files outside the H5EA package should + * include H5EAprivate.h instead. + */ +#if !(defined(H5EA_PACKAGE) | defined(H5EA_MODULE)) +#error "Do not include this file outside the H5EA package!" +#endif + +#ifndef _H5EApkg_H +#define _H5EApkg_H + +/* Get package's private header */ +#include "H5EAprivate.h" + +/* Other private headers needed by this file */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5FLprivate.h" /* Free Lists */ + +/************************************************/ +/* Revisions to FUNC_ENTER/LEAVE & Error Macros */ +/************************************************/ + +#ifndef NDEBUG +/* `S' is the name of a function which is being tested to check if it's */ +/* a public API function */ +#define H5_IS_PUB(S) (((HDisdigit(S[1]) || HDisupper(S[1])) && HDislower(S[2])) || \ + ((HDisdigit(S[2]) || HDisupper(S[2])) && HDislower(S[3])) || \ + (!S[4] || ((HDisdigit(S[3]) || HDisupper(S[3])) && HDislower(S[4])))) + +/* `S' is the name of a function which is being tested to check if it's */ +/* a private library function */ +#define H5_IS_PRIV(S) (((HDisdigit(S[1]) || HDisupper(S[1])) && '_' == S[2] && HDislower(S[3])) || \ + ((HDisdigit(S[2]) || HDisupper(S[2])) && '_' == S[3] && HDislower(S[4])) || \ + ((HDisdigit(S[3]) || HDisupper(S[3])) && '_' == S[4] && HDislower(S[5]))) + +/* `S' is the name of a function which is being tested to check if it's */ +/* a package private function */ +#define H5_IS_PKG(S) (((HDisdigit(S[1]) || HDisupper(S[1])) && '_' == S[2] && '_' == S[3] && HDislower(S[4])) || \ + ((HDisdigit(S[2]) || HDisupper(S[2])) && '_' == S[3] && '_' == S[4] && HDislower(S[5])) || \ + ((HDisdigit(S[3]) || HDisupper(S[3])) && '_' == S[4] && '_' == S[5] && HDislower(S[6]))) + +#define FUNC_ENTER_NAME_CHECK(asrt) \ + { \ + static hbool_t func_check = FALSE; \ + \ + if(!func_check) { \ + /* Check function naming status */ \ + HDassert(asrt); \ + \ + /* Don't check again */ \ + func_check = TRUE; \ + } /* end if */ \ + } /* end scope */ +#else /* NDEBUG */ +#define FUNC_ENTER_NAME_CHECK(asrt) +#define H5_IS_PUB(S) +#define H5_IS_PRIV(S) +#define H5_IS_PKG(S) +#endif /* NDEBUG */ + +/* Macro for referencing package initialization variables */ +#define H5_PACKAGE_INIT_VAR(x) H5_GLUE3(H5_, x, _init_g) + +/* Macros to check if a package is initialized */ +#define H5_CHECK_PACKAGE_INIT_REG_YES(asrt) HDassert(H5_PACKAGE_INIT_VAR(pkg)); +#define H5_CHECK_PACKAGE_INIT_REG_NO(asrt) +#define H5_CHECK_PACKAGE_INIT_INIT_YES(asrt) +#define H5_CHECK_PACKAGE_INIT_INIT_NO(asrt) + +/* Macros to initialize package, if a package initialization routine is defined */ +#define H5_PKG_YES_INIT(pkg) \ + if(!H5_PACKAGE_INIT_VAR(pkg)) { \ + if(H5_GLUE(pkg, _pkg_init)() < 0) { \ + /* (Can't use H5E_THROW here) */ \ + H5E_PRINTF(H5E_CANTINIT, "interface initialization failed"); \ + ret_value = fail_value; \ + goto func_init_failed; \ + } /* end if */ \ + } /* end if */ +#define H5_PKG_NO_INIT(pkg) + +/* Macros to declare package initialization variable, if a package initialization routine is defined */ +#define H5_PKG_YES_INIT_VAR(pkg) extern hbool_t H5_PACKAGE_INIT_VAR(H5_MY_PKG); +#define H5_PKG_NO_INIT_VAR(pkg) + +/* Declare package initialization variable (if in a package) */ +#define H5_DECLARE_PKG_VAR(pkg_init, pkg) H5_GLUE3(H5_PKG_, pkg_init, _INIT_VAR)(pkg) +#ifdef H5_MY_PKG +H5_DECLARE_PKG_VAR(H5_MY_PKG_INIT, H5_MY_PKG) +#endif /* H5_MY_PKG */ + +/* API re-entrance variable */ +extern hbool_t H5_api_entered_g; /* Has library already been entered through API? */ + +/* Macros for entering different scopes of routines */ +#define H5_PACKAGE_ENTER(pkg, pkg_init, init) \ + FUNC_ENTER_NAME_CHECK(H5_IS_PKG(__func__)) \ + \ + /* The library should be initialized already */ \ + HDassert(H5_INIT_GLOBAL); \ + \ + /* This interface should be initialized already */ \ + /* (except for package initialization routines :-) */ \ + H5_GLUE4(H5_CHECK_PACKAGE_INIT_, init, _, pkg_init)(pkg) \ + \ + /* Push the name of this function on the function stack */ \ + H5_PUSH_FUNC(__func__) \ + \ + /* Enter scope for this type of function */ \ + { + +#define H5_PRIVATE_ENTER(pkg, pkg_init) \ + FUNC_ENTER_NAME_CHECK(H5_IS_PRIV(__func__)) \ + \ + /* The library should be initialized already */ \ + HDassert(H5_INIT_GLOBAL); \ + \ + /* Initialize this interface if desired */ \ + H5_GLUE3(H5_PKG_, pkg_init, _INIT)(pkg) \ + \ + /* Push the name of this function on the function stack */ \ + H5_PUSH_FUNC(__func__) \ + \ + /* Enter scope for this type of function */ \ + {{ + +/* Remove this shim and change H5TRACE* macros when this change is permanent -QAK */ +#ifdef H5_DEBUG_API +#define FUNC __func__ +#endif + +#define H5_PUBLIC_ENTER(pkg, pkg_init) \ + FUNC_ENTER_API_VARS(__func__) \ + FUNC_ENTER_API_THREADSAFE; \ + FUNC_ENTER_NAME_CHECK(H5_IS_PUB(__func__)) \ + \ + /* Clear thread error stack when entering public functions */ \ + H5E_clear_stack(NULL); \ + \ + /* Initialize the library or bust */ \ + if(!(H5_INIT_GLOBAL)) { \ + H5_INIT_GLOBAL = TRUE; \ + if(H5_init_library() < 0) { \ + /* (Can't use H5E_THROW here) */ \ + H5E_PRINTF(H5E_CANTINIT, "interface initialization failed"); \ + ret_value = fail_value; \ + goto func_init_failed; \ + } /* end if */ \ + } /* end if */ \ + \ + /* Initialize this interface if desired */ \ + H5_GLUE3(H5_PKG_, pkg_init, _INIT)(pkg) \ + \ + /* Check for re-entering API routine */ \ + HDassert(!H5_api_entered_g); \ + H5_api_entered_g = TRUE; \ + \ + /* Start logging MPI's MPE information */ \ + BEGIN_MPE_LOG(__func__) \ + \ + /* Push the name of this function on the function stack */ \ + H5_PUSH_FUNC(__func__) \ + \ + /* Enter scope for this type of function */ \ + {{{ + +/* Macros for substituting the package name */ +#define FUNC_ENTER_STATIC H5_PACKAGE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT, REG) +#define FUNC_ENTER_PKGINIT H5_PACKAGE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT, INIT) +#define FUNC_ENTER_PKG H5_PACKAGE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT, REG) +#define FUNC_ENTER_PRIV H5_PRIVATE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT) +#define FUNC_ENTER_PUB H5_PUBLIC_ENTER(H5_MY_PKG, H5_MY_PKG_INIT) + +/* Macros for substituting a function prefix */ +#define FUNC_PREFIX_STATIC static +#define FUNC_PREFIX_PKGINIT +#define FUNC_PREFIX_PKG +#define FUNC_PREFIX_PRIV +#define FUNC_PREFIX_PUB + +/* Macros for declaring error variables */ +#define FUNC_ERR_VAR_ERR(ret_typ, err) \ + hbool_t past_catch = FALSE; \ + ret_typ fail_value = err; +#define FUNC_ERR_VAR_ERRCATCH(ret_typ, err) \ + hbool_t past_catch = FALSE; +#define FUNC_ERR_VAR_NOERR(ret_typ, err) + +/* Use this macro when entering all functions */ +#define BEGIN_FUNC(scope, use_err, ret_typ, ret_init, err, func) \ +H5_GLUE(FUNC_PREFIX_, scope) \ +ret_typ \ +func \ +/* Open function */ \ +{ \ + ret_typ ret_value = ret_init; \ + H5_GLUE(FUNC_ERR_VAR_, use_err)(ret_typ, err) \ + H5_GLUE(FUNC_ENTER_, scope) + +/* Macros for label when a function initialization can fail */ +#define H5_PRIV_YES_FUNC_INIT_FAILED func_init_failed: +#define H5_PRIV_NO_FUNC_INIT_FAILED +#define H5_PRIV_FUNC_INIT_FAILED(pkg_init) H5_GLUE3(H5_PRIV_, pkg_init, _FUNC_INIT_FAILED) + +/* Macros for leaving different scopes of routines */ +#define FUNC_LEAVE_STATIC \ + /* Leave scope for this type of function */ \ + } \ + \ + /* Pop the name of this function off the function stack */ \ + H5_POP_FUNC + +#define FUNC_LEAVE_PKG \ + /* Leave scope for this type of function */ \ + } \ + \ + /* Pop the name of this function off the function stack */ \ + H5_POP_FUNC + +#define FUNC_LEAVE_PRIV \ + /* Leave scope for this type of function */ \ + }} \ + \ + /* Label for errors during FUNC_ENTER */ \ + H5_PRIV_FUNC_INIT_FAILED(H5_MY_PKG_INIT) \ + \ + /* Pop the name of this function off the function stack */ \ + H5_POP_FUNC + +#define FUNC_LEAVE_PUB \ + /* Leave scope for this type of function */ \ + }}} \ + \ + /* Label for errors during FUNC_ENTER */ \ +func_init_failed: \ + \ + /* Dump error stack if an error occurred during API routine */ \ + if(ret_value == fail_value) \ + (void)H5E_dump_api_stack(TRUE); \ + \ + /* Finish the API tracing info */ \ + H5TRACE_RETURN(ret_value); \ + \ + /* Pop the name of this function off the function stack */ \ + H5_POP_FUNC \ + \ + /* Finish the MPE tracing info */ \ + FINISH_MPE_LOG; \ + \ + /* Check for leaving API routine */ \ + HDassert(H5_api_entered_g); \ + H5_api_entered_g = FALSE; \ + \ + /* Release thread-safety semaphore */ \ + FUNC_LEAVE_API_THREADSAFE + +/* Use this macro when leaving all functions */ +#define END_FUNC(scope) \ + /* Scope-specific function conclusion */ \ + H5_GLUE(FUNC_LEAVE_, scope) \ + \ + /* Leave routine */ \ + return(ret_value); \ + \ + /* Close Function */ \ +} + + +/* + * H5E_PRINTF macro, used to facilitate error reporting between a BEGIN_FUNC() + * and an END_FUNC() within a function body. The arguments are the minor + * error number, a description of the error (as a printf-like format string), + * and an optional set of arguments for the printf format arguments. + */ +#define H5E_PRINTF(...) H5E_printf_stack(NULL, __FILE__, __func__, __LINE__, H5E_ERR_CLS_g, H5_MY_PKG_ERR, __VA_ARGS__) + +/* + * H5_LEAVE macro, used to facilitate control flow between a + * BEGIN_FUNC() and an END_FUNC() within a function body. The argument is + * the return value. + * The return value is assigned to a variable `ret_value' and control branches + * to the `catch' label, if we're not already past it. + */ +#define H5_LEAVE(v) { \ + ret_value = v; \ + if(!past_catch) \ + goto catch; \ +} + +/* + * H5E_THROW macro, used to facilitate error reporting between a + * FUNC_ENTER() and a FUNC_LEAVE() within a function body. The arguments are + * the minor error number, and an error string. + * The return value is assigned to a variable `ret_value' and control branches + * to the `catch' label, if we're not already past it. + */ +#define H5E_THROW(...) { \ + H5E_PRINTF(__VA_ARGS__); \ + H5_LEAVE(fail_value) \ +} + +/* Macro for "catching" flow of control when an error occurs. Note that the + * H5_LEAVE macro won't jump back here once it's past this point. + */ +#define CATCH past_catch = TRUE; catch:; + + +/**************************/ +/* Package Private Macros */ +/**************************/ + +/* If this package header is being included in one of the H5EA modules, define + * the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#ifdef H5EA_MODULE +#define H5_MY_PKG H5EA +#define H5_MY_PKG_ERR H5E_EARRAY +#define H5_MY_PKG_INIT NO +#endif /* H5EA_MODULE */ + +/* Size of signature information (on disk) */ +#define H5EA_SIZEOF_MAGIC 4 + +/* Fractal heap signatures */ +#define H5EA_HDR_MAGIC "EAHD" /* Header */ + +/* Size of checksum information (on disk) */ +#define H5EA_SIZEOF_CHKSUM 4 + +/* "Standard" size of prefix information for extensible array metadata */ +#define H5EA_METADATA_PREFIX_SIZE(c) ( \ + H5EA_SIZEOF_MAGIC /* Signature */ \ + + 1 /* Version */ \ + + ((c) ? H5EA_SIZEOF_CHKSUM : 0) /* Metadata checksum */ \ + ) + +/* Size of the extensible array header on disk */ +#define H5EA_HEADER_SIZE(h) ( \ + /* General metadata fields */ \ + H5EA_METADATA_PREFIX_SIZE(TRUE) \ + \ + /* Extensible Array Header specific fields */ \ + \ + /* General heap information */ \ + + 1 /* Element Size */ \ + + 1 /* # of elements to store in index block */ \ + + 1 /* Min. # elements per data block */ \ + + 1 /* Min. # of data block pointers for a super block */ \ + ) + + +/****************************/ +/* Package Private Typedefs */ +/****************************/ + +/* The extensible array header information */ +/* (Each extensible array header has certain information that is shared across + * all the blocks in that extensible array) + */ +typedef struct H5EA_hdr_t { + /* Information for H5AC cache functions, _must_ be first field in structure */ + H5AC_info_t cache_info; + + /* Extensible array configuration/creation parameters (stored) */ + uint8_t elmt_size; /* Element size (in bytes) */ + uint8_t idx_blk_elmts; /* # of elements to store in index block */ + uint8_t data_blk_min_elmts; /* Min. # of elements per data block */ + uint8_t sup_blk_min_data_ptrs; /* Min. # of data block pointers for a super block */ + + /* Computed/cached values */ + size_t rc; /* Reference count of heap's components using heap header */ + haddr_t addr; /* Address of header in file */ + size_t size; /* Size of header in file */ + H5F_t *f; /* Pointer to file for extensible array */ + size_t file_rc; /* Reference count of files using array header */ + hbool_t pending_delete; /* Array is pending deletion */ +} H5EA_hdr_t; + +/* Extensible array */ +struct H5EA_t { + H5EA_hdr_t *hdr; /* Pointer to internal extensible array header info */ + H5F_t *f; /* Pointer to file for extensible array */ +}; + + +/*****************************/ +/* Package Private Variables */ +/*****************************/ + +/* H5EA header inherits cache-like properties from H5AC */ +H5_DLLVAR const H5AC_class_t H5AC_EARRAY_HDR[1]; + +/* Declare a free list to manage the H5EA_hdr_t struct */ +H5FL_EXTERN(H5EA_hdr_t); + + +/******************************/ +/* Package Private Prototypes */ +/******************************/ + +/* Header routines */ +H5_DLL H5EA_hdr_t *H5EA__hdr_alloc(H5F_t *f); +H5_DLL haddr_t H5EA__hdr_create(H5F_t *f, hid_t dxpl_id, const H5EA_create_t *cparam); +H5_DLL herr_t H5EA__hdr_incr(H5EA_hdr_t *hdr); +H5_DLL herr_t H5EA__hdr_decr(H5EA_hdr_t *hdr); +H5_DLL herr_t H5EA__hdr_fuse_incr(H5EA_hdr_t *hdr); +H5_DLL size_t H5EA__hdr_fuse_decr(H5EA_hdr_t *hdr); +H5_DLL herr_t H5EA__hdr_delete(H5EA_hdr_t *hdr, hid_t dxpl_id); + +/* Metadata cache callbacks */ +H5_DLL herr_t H5EA__cache_hdr_dest(H5F_t *f, H5EA_hdr_t *hdr); + +/* Testing routines */ +#ifdef H5EA_TESTING +H5_DLL herr_t H5EA_get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam); +H5_DLL int H5EA_cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2); +#endif /* H5EA_TESTING */ + +#endif /* _H5EApkg_H */ + diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h new file mode 100644 index 0000000..6a7fc67 --- /dev/null +++ b/src/H5EAprivate.h @@ -0,0 +1,91 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * + * Created: H5EAprivate.h + * Jun 17 2008 + * Quincey Koziol + * + * Purpose: Private header for library accessible extensible + * array routines. + * + *------------------------------------------------------------------------- + */ + +#ifndef _H5EAprivate_H +#define _H5EAprivate_H + +/* Include package's public header */ +#ifdef NOT_YET +#include "H5EApublic.h" +#endif /* NOT_YET */ + +/* Private headers needed by this file */ +#include "H5Fprivate.h" /* File access */ + + +/**************************/ +/* Library Private Macros */ +/**************************/ + + +/****************************/ +/* Library Private Typedefs */ +/****************************/ + +/* Extensible array creation parameters */ +typedef struct H5EA_create_t { + uint8_t elmt_size; /* Element size (in bytes) */ + uint8_t idx_blk_elmts; /* # of elements to store in index block */ + uint8_t data_blk_min_elmts; /* Min. # of elements per data block */ + uint8_t sup_blk_min_data_ptrs; /* Min. # of data block pointers for a super block */ +} H5EA_create_t; + +/* Extensible array metadata statistics info */ +typedef struct H5EA_stat_t { + hsize_t nsuper_blks; /* # of super blocks */ + hsize_t ndata_blks; /* # of data blocks */ +} H5EA_stat_t; + +/* Extensible array info (forward decl - defined in H5EApkg.h) */ +typedef struct H5EA_t H5EA_t; + + +/*****************************/ +/* Library-private Variables */ +/*****************************/ + + +/***************************************/ +/* Library-private Function Prototypes */ +/***************************************/ + +/* General routines */ +H5_DLL H5EA_t *H5EA_create(H5F_t *f, hid_t dxpl_id, const H5EA_create_t *cparam); +H5_DLL herr_t H5EA_get_nelmts(const H5EA_t *ea, hsize_t *nelmts); +H5_DLL herr_t H5EA_get_addr(const H5EA_t *ea, haddr_t *addr); +H5_DLL herr_t H5EA_delete(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr); +H5_DLL herr_t H5EA_close(H5EA_t *ea, hid_t dxpl_id); + +/* Statistics routines */ +H5_DLL herr_t H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats); + +/* Debugging routines */ +#ifdef H5EA_DEBUGGING +#endif /* H5EA_DEBUGGING */ + +#endif /* _H5EAprivate_H */ + diff --git a/src/H5EAtest.c b/src/H5EAtest.c new file mode 100644 index 0000000..c05084d --- /dev/null +++ b/src/H5EAtest.c @@ -0,0 +1,152 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: Quincey Koziol + * Thursday, August 28, 2008 + * + * Purpose: Extensible array testing functions. + * + */ + +/**********************/ +/* Module Declaration */ +/**********************/ + +#define H5EA_MODULE +#define H5EA_TESTING + + +/***********************/ +/* Other Packages Used */ +/***********************/ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5EApkg.h" /* Extensible Arrays */ + + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*------------------------------------------------------------------------- + * Function: H5EA_get_cparam_test + * + * Purpose: Retrieve the parameters used to create the extensible array + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Thursday, August 28, 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PRIV, NOERR, +herr_t, SUCCEED, -, +H5EA_get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam)) + + /* Check arguments. */ + HDassert(ea); + HDassert(cparam); + + /* Get extensible array creation parameters */ + cparam->elmt_size = ea->hdr->elmt_size; + cparam->idx_blk_elmts = ea->hdr->idx_blk_elmts; + cparam->sup_blk_min_data_ptrs = ea->hdr->sup_blk_min_data_ptrs; + cparam->data_blk_min_elmts = ea->hdr->data_blk_min_elmts; + +END_FUNC(PRIV) /* end H5EA_get_cparam_test() */ + + +/*------------------------------------------------------------------------- + * Function: H5EA_cmp_cparam_test + * + * Purpose: Compare the parameters used to create the extensible array + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Thursday, August 28, 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PRIV, ERRCATCH, +int, 0, -, +H5EA_cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2)) + + /* Check arguments. */ + HDassert(cparam1); + HDassert(cparam2); + + /* Compare creation parameters for array */ + if(cparam1->elmt_size < cparam2->elmt_size) + H5_LEAVE(-1) + else if(cparam1->elmt_size > cparam2->elmt_size) + H5_LEAVE(1) + if(cparam1->idx_blk_elmts < cparam2->idx_blk_elmts) + H5_LEAVE(-1) + else if(cparam1->idx_blk_elmts > cparam2->idx_blk_elmts) + H5_LEAVE(1) + if(cparam1->sup_blk_min_data_ptrs < cparam2->sup_blk_min_data_ptrs) + H5_LEAVE(-1) + else if(cparam1->sup_blk_min_data_ptrs > cparam2->sup_blk_min_data_ptrs) + H5_LEAVE(1) + if(cparam1->data_blk_min_elmts < cparam2->data_blk_min_elmts) + H5_LEAVE(-1) + else if(cparam1->data_blk_min_elmts > cparam2->data_blk_min_elmts) + H5_LEAVE(1) + +CATCH + +END_FUNC(PRIV) /* end H5EA_cmp_cparam_test() */ + diff --git a/src/H5Edefin.h b/src/H5Edefin.h index 5638305..612fcb1 100644 --- a/src/H5Edefin.h +++ b/src/H5Edefin.h @@ -47,6 +47,7 @@ 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 */ hid_t H5E_ARGS_g = FAIL; /* Invalid arguments to routine */ +hid_t H5E_EARRAY_g = FAIL; /* Extensible Array */ hid_t H5E_ERROR_g = FAIL; /* Error API */ hid_t H5E_PLINE_g = FAIL; /* Data filters */ hid_t H5E_FSPACE_g = FAIL; /* Free Space Manager */ diff --git a/src/H5Einit.h b/src/H5Einit.h index c5ceec4..20e156c 100644 --- a/src/H5Einit.h +++ b/src/H5Einit.h @@ -154,6 +154,11 @@ if((msg = H5E_create_msg(cls, H5E_MAJOR, "Invalid arguments to routine"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") if((H5E_ARGS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +assert(H5E_EARRAY_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Extensible Array"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_EARRAY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") assert(H5E_ERROR_g==(-1)); if((msg = H5E_create_msg(cls, H5E_MAJOR, "Error API"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") diff --git a/src/H5Eint.c b/src/H5Eint.c index 99048e1..ba1b1e0 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -660,6 +660,107 @@ H5E_set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data) /*------------------------------------------------------------------------- + * Function: H5E_printf_stack + * + * Purpose: Printf-like wrapper around H5E_push_stack. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Tuesday, August 12, 2008 + * + *------------------------------------------------------------------------- + */ +herr_t +H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned line, + hid_t cls_id, hid_t maj_id, hid_t min_id, const char *fmt, ...) +{ + va_list ap; /* Varargs info */ +#ifndef H5_HAVE_VASPRINTF + int tmp_len; /* Current size of description buffer */ + int desc_len; /* Actual length of description when formatted */ +#endif /* H5_HAVE_VASPRINTF */ + char *tmp = NULL; /* Buffer to place formatted description in */ + herr_t ret_value = SUCCEED; /* Return value */ + + /* + * WARNING: We cannot call HERROR() from within this function or else we + * could enter infinite recursion. Furthermore, we also cannot + * call any other HDF5 macro or function which might call + * HERROR(). HERROR() is called by HRETURN_ERROR() which could + * be called by FUNC_ENTER(). + */ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_printf_stack) + + /* Sanity check */ + HDassert(cls_id > 0); + HDassert(maj_id > 0); + HDassert(min_id > 0); + HDassert(fmt); + +/* Note that the variable-argument parsing for the format is identical in + * the H5Epush2() routine - correct errors and make changes in both + * places. -QAK + */ + + /* Start the variable-argument parsing */ + va_start(ap, fmt); + +#ifdef H5_HAVE_VASPRINTF + /* Use the vasprintf() routine, since it does what we're trying to do below */ + if(HDvasprintf(&tmp, fmt, ap) < 0) + HGOTO_DONE(FAIL) +#else /* H5_HAVE_VASPRINTF */ + /* Allocate space for the formatted description buffer */ + tmp_len = 128; + if(NULL == (tmp = H5MM_malloc((size_t)tmp_len))) + HGOTO_DONE(FAIL) + + /* If the description doesn't fit into the initial buffer size, allocate more space and try again */ + while((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap)) +#ifdef H5_VSNPRINTF_WORKS + > +#else /* H5_VSNPRINTF_WORKS */ + >= +#endif /* H5_VSNPRINTF_WORKS */ + (tmp_len - 1) +#ifndef H5_VSNPRINTF_WORKS + || (desc_len < 0) +#endif /* H5_VSNPRINTF_WORKS */ + ) { + /* shutdown & restart the va_list */ + va_end(ap); + va_start(ap, fmt); + + /* Release the previous description, it's too small */ + H5MM_xfree(tmp); + + /* Allocate a description of the appropriate length */ +#ifdef H5_VSNPRINTF_WORKS + tmp_len = desc_len + 1; +#else /* H5_VSNPRINTF_WORKS */ + tmp_len = 2 * tmp_len; +#endif /* H5_VSNPRINTF_WORKS */ + if(NULL == (tmp = H5MM_malloc((size_t)tmp_len))) + HGOTO_DONE(FAIL) + } /* end while */ +#endif /* H5_HAVE_VASPRINTF */ + + va_end(ap); + + /* Push the error on the stack */ + if(H5E_push_stack(estack, file, func, line, cls_id, maj_id, min_id, tmp) < 0) + HGOTO_DONE(FAIL) + +done: + if(tmp) + H5MM_xfree(tmp); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5E_printf_stack() */ + + +/*------------------------------------------------------------------------- * Function: H5E_push_stack * * Purpose: Pushes a new error record onto error stack for the current @@ -886,7 +987,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5E_dump_api_stack(int is_api) +H5E_dump_api_stack(hbool_t is_api) { herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index 05ce10e..7b1d7ef 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -40,7 +40,7 @@ typedef struct H5E_t H5E_t; */ #define HCOMMON_ERROR(maj, min, str) \ HERROR(maj, min, str); \ - (void)H5E_dump_api_stack((int)H5_IS_API(FUNC)); + (void)H5E_dump_api_stack((hbool_t)H5_IS_API(FUNC)); /* * HDONE_ERROR macro, used to facilitate error reporting between a @@ -78,10 +78,12 @@ typedef struct H5E_t H5E_t; /* Library-private functions defined in H5E package */ H5_DLL herr_t H5E_init(void); -H5_DLL herr_t H5E_push_stack(H5E_t *estack, const char *file, const char *func, unsigned line, - hid_t cls_id, hid_t maj_id, hid_t min_id, const char *desc); +H5_DLL herr_t H5E_push_stack(H5E_t *estack, const char *file, const char *func, + unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *desc); +H5_DLL herr_t H5E_printf_stack(H5E_t *estack, const char *file, const char *func, + unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *fmt, ...); H5_DLL herr_t H5E_clear_stack(H5E_t *estack); -H5_DLL herr_t H5E_dump_api_stack(int is_api); +H5_DLL herr_t H5E_dump_api_stack(hbool_t is_api); /* * Macros handling system error messages as described in C standard. diff --git a/src/H5Epubgen.h b/src/H5Epubgen.h index 8386e0f..4e981dc 100644 --- a/src/H5Epubgen.h +++ b/src/H5Epubgen.h @@ -50,6 +50,7 @@ #define H5E_EFL (H5OPEN H5E_EFL_g) #define H5E_TST (H5OPEN H5E_TST_g) #define H5E_ARGS (H5OPEN H5E_ARGS_g) +#define H5E_EARRAY (H5OPEN H5E_EARRAY_g) #define H5E_ERROR (H5OPEN H5E_ERROR_g) #define H5E_PLINE (H5OPEN H5E_PLINE_g) #define H5E_FSPACE (H5OPEN H5E_FSPACE_g) @@ -80,6 +81,7 @@ 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 */ H5_DLLVAR hid_t H5E_ARGS_g; /* Invalid arguments to routine */ +H5_DLLVAR hid_t H5E_EARRAY_g; /* Extensible Array */ H5_DLLVAR hid_t H5E_ERROR_g; /* Error API */ H5_DLLVAR hid_t H5E_PLINE_g; /* Data filters */ H5_DLLVAR hid_t H5E_FSPACE_g; /* Free Space Manager */ diff --git a/src/H5Eterm.h b/src/H5Eterm.h index dedc313..7595e7f 100644 --- a/src/H5Eterm.h +++ b/src/H5Eterm.h @@ -48,6 +48,7 @@ H5E_SLIST_g= H5E_EFL_g= H5E_TST_g= H5E_ARGS_g= +H5E_EARRAY_g= H5E_ERROR_g= H5E_PLINE_g= H5E_FSPACE_g= diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index ea92649..984edb6 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -89,6 +89,14 @@ typedef enum H5FD_mem_t { #define H5FD_MEM_SOHM_TABLE H5FD_MEM_OHDR #define H5FD_MEM_SOHM_INDEX H5FD_MEM_BTREE +/* Map "extensible array" header blocks to 'ohdr' type file memory, since its + * a fair amount of work to add a new kind of file memory and they are similar + * enough to object headers and probably too minor to deserve their own type. + * + * -QAK + */ +#define H5FD_MEM_EARRAY_HDR 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/H5HF.c b/src/H5HF.c index e65a968..83b29f1 100644 --- a/src/H5HF.c +++ b/src/H5HF.c @@ -847,6 +847,9 @@ HDfprintf(stderr, "%s; After iterator reset fh->hdr->rc = %Zu\n", FUNC, fh->hdr- } /* end if */ /* Decrement the reference count on the heap header */ + /* (don't put in H5HF_hdr_fuse_decr() as the heap header may be evicted + * immediately -QAK) + */ if(H5HF_hdr_decr(fh->hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared heap header") @@ -912,6 +915,9 @@ HDfprintf(stderr, "%s: fh_addr = %a\n", FUNC, fh_addr); if(hdr->file_rc) hdr->pending_delete = TRUE; else { + /* Set the shared heap header's file context for this operation */ + hdr->f = f; + /* Delete heap now, starting with header (unprotects header) */ if(H5HF_hdr_delete(hdr, dxpl_id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "unable to delete fractal heap") diff --git a/src/H5err.txt b/src/H5err.txt index 844bd57..7f110b8 100644 --- a/src/H5err.txt +++ b/src/H5err.txt @@ -74,6 +74,7 @@ MAJOR, H5E_ERROR, Error API MAJOR, H5E_SLIST, Skip Lists MAJOR, H5E_FSPACE, Free Space Manager MAJOR, H5E_SOHM, Shared Object Header Messages +MAJOR, H5E_EARRAY, Extensible Array MAJOR, H5E_NONE_MAJOR, No error # Sections (for grouping minor errors) diff --git a/src/H5private.h b/src/H5private.h index 6686f88..142e41e 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1612,8 +1612,8 @@ extern hbool_t H5_libinit_g; /* Has the library been initialized? */ /* Include required function stack header */ #include "H5CSprivate.h" -#define H5_PUSH_FUNC(func_name) H5CS_push(#func_name) -#define H5_POP_FUNC H5CS_pop() +#define H5_PUSH_FUNC(func_name) H5CS_push(func_name); +#define H5_POP_FUNC H5CS_pop(); #else /* H5_HAVE_CODESTACK */ #define H5_PUSH_FUNC(func_name) /* void */ #define H5_POP_FUNC /* void */ @@ -1723,7 +1723,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); FUNC_ENTER_API_VARS(func_name) \ FUNC_ENTER_COMMON(func_name,H5_IS_API(#func_name)); \ FUNC_ENTER_API_THREADSAFE; \ - H5_PUSH_FUNC(func_name); \ + H5_PUSH_FUNC(#func_name) \ BEGIN_MPE_LOG(func_name); \ { @@ -1763,7 +1763,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); */ #define FUNC_ENTER_NOAPI_NOINIT(func_name) { \ FUNC_ENTER_COMMON(func_name,!H5_IS_API(#func_name)); \ - H5_PUSH_FUNC(func_name); \ + H5_PUSH_FUNC(#func_name) \ { /* @@ -1780,7 +1780,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); */ #define FUNC_ENTER_NOAPI_NOINIT_NOFUNC(func_name) { \ FUNC_ENTER_COMMON_NOFUNC(func_name,!H5_IS_API(#func_name)); \ - H5_PUSH_FUNC(func_name); \ + H5_PUSH_FUNC(#func_name) \ { /* @@ -1809,7 +1809,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); H5_INTERFACE_INIT(err) \ \ /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC(func_name); \ + H5_PUSH_FUNC(#func_name) \ \ BEGIN_MPE_LOG(func_name) @@ -1819,7 +1819,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); H5_INTERFACE_INIT(err) \ \ /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC(func_name); + H5_PUSH_FUNC(#func_name) /*------------------------------------------------------------------------- * Purpose: Register function exit for code profiling. This should be @@ -1840,7 +1840,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); #define FUNC_LEAVE_API(ret_value) \ FINISH_MPE_LOG; \ H5TRACE_RETURN(ret_value); \ - H5_POP_FUNC; \ + H5_POP_FUNC \ FUNC_LEAVE_API_THREADSAFE \ return (ret_value); \ } /*end scope from end of FUNC_ENTER*/ \ @@ -1855,13 +1855,13 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); }} /*end scope from beginning of FUNC_ENTER*/ #define FUNC_LEAVE_NOAPI(ret_value) \ - H5_POP_FUNC; \ + H5_POP_FUNC \ return (ret_value); \ } /*end scope from end of FUNC_ENTER*/ \ } /*end scope from beginning of FUNC_ENTER*/ #define FUNC_LEAVE_NOAPI_VOID \ - H5_POP_FUNC; \ + H5_POP_FUNC \ return; \ } /*end scope from end of FUNC_ENTER*/ \ } /*end scope from beginning of FUNC_ENTER*/ @@ -1880,6 +1880,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); /* Macro for "glueing" together items, for re-scanning macros */ #define H5_GLUE(x,y) x##y #define H5_GLUE3(x,y,z) x##y##z +#define H5_GLUE4(w,x,y,z) w##x##y##z /* Compile-time "assert" macro */ #define HDcompile_assert(e) do { enum { compile_assert__ = 1 / (e) }; } while(0) diff --git a/src/Makefile.am b/src/Makefile.am index fcb47e2..161af23 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -51,6 +51,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Dio.c \ H5Distore.c H5Dmpio.c H5Doh.c H5Dscatgath.c H5Dselect.c H5Dtest.c \ H5E.c H5Edeprec.c H5Eint.c \ + H5EA.c H5EAcache.c H5EAhdr.c H5EAint.c H5EAtest.c \ H5F.c H5Fdbg.c H5Ffake.c H5Fmount.c H5Fsfile.c H5Fsuper.c H5Ftest.c \ H5FD.c H5FDcore.c \ H5FDdirect.c H5FDfamily.c H5FDlog.c H5FDmpi.c H5FDmpio.c \ diff --git a/src/Makefile.in b/src/Makefile.in index 98ff5f5..083e235 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -86,16 +86,16 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \ H5Dcontig.lo H5Ddbg.lo H5Ddeprec.lo H5Defl.lo H5Dfill.lo \ H5Dint.lo H5Dio.lo H5Distore.lo H5Dmpio.lo H5Doh.lo \ H5Dscatgath.lo H5Dselect.lo H5Dtest.lo H5E.lo H5Edeprec.lo \ - H5Eint.lo H5F.lo H5Fdbg.lo H5Ffake.lo H5Fmount.lo H5Fsfile.lo \ - H5Fsuper.lo H5Ftest.lo H5FD.lo H5FDcore.lo H5FDdirect.lo \ - H5FDfamily.lo H5FDlog.lo H5FDmpi.lo H5FDmpio.lo \ - H5FDmpiposix.lo H5FDmulti.lo H5FDsec2.lo H5FDspace.lo \ - H5FDstdio.lo H5FL.lo H5FO.lo H5FS.lo H5FScache.lo H5FSdbg.lo \ - H5FSsection.lo H5G.lo H5Gbtree2.lo H5Gcompact.lo H5Gdense.lo \ - H5Gdeprec.lo H5Gent.lo H5Gint.lo H5Glink.lo H5Gloc.lo \ - H5Gname.lo H5Gnode.lo H5Gobj.lo H5Goh.lo H5Gstab.lo H5Gtest.lo \ - H5Gtraverse.lo H5HF.lo H5HFbtree2.lo H5HFcache.lo H5HFdbg.lo \ - H5HFdblock.lo H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo \ + H5Eint.lo H5EA.lo H5EAcache.lo H5EAhdr.lo H5EAint.lo H5EAtest.lo H5F.lo H5Fdbg.lo H5Ffake.lo \ + H5Fmount.lo H5Fsfile.lo H5Fsuper.lo H5Ftest.lo H5FD.lo \ + H5FDcore.lo H5FDdirect.lo H5FDfamily.lo H5FDlog.lo H5FDmpi.lo \ + H5FDmpio.lo H5FDmpiposix.lo H5FDmulti.lo H5FDsec2.lo \ + H5FDspace.lo H5FDstdio.lo H5FL.lo H5FO.lo H5FS.lo H5FScache.lo \ + H5FSdbg.lo H5FSsection.lo H5G.lo H5Gbtree2.lo H5Gcompact.lo \ + H5Gdense.lo H5Gdeprec.lo H5Gent.lo H5Gint.lo H5Glink.lo \ + H5Gloc.lo H5Gname.lo H5Gnode.lo H5Gobj.lo H5Goh.lo H5Gstab.lo \ + H5Gtest.lo H5Gtraverse.lo H5HF.lo H5HFbtree2.lo H5HFcache.lo \ + H5HFdbg.lo H5HFdblock.lo H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo \ H5HFiblock.lo H5HFiter.lo H5HFman.lo H5HFsection.lo \ H5HFspace.lo H5HFstat.lo H5HFtest.lo H5HFtiny.lo H5HG.lo \ H5HGdbg.lo H5HL.lo H5HLdbg.lo H5HP.lo H5I.lo H5L.lo \ @@ -429,6 +429,7 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Dio.c \ H5Distore.c H5Dmpio.c H5Doh.c H5Dscatgath.c H5Dselect.c H5Dtest.c \ H5E.c H5Edeprec.c H5Eint.c \ + H5EA.c H5EAcache.c H5EAhdr.c H5EAint.c H5EAtest.c \ H5F.c H5Fdbg.c H5Ffake.c H5Fmount.c H5Fsfile.c H5Fsuper.c H5Ftest.c \ H5FD.c H5FDcore.c \ H5FDdirect.c H5FDfamily.c H5FDlog.c H5FDmpi.c H5FDmpio.c \ @@ -638,6 +639,11 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dselect.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dtest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5E.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5EA.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5EAcache.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5EAhdr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5EAint.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5EAtest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Edeprec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Eint.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5F.Plo@am__quote@ diff --git a/test/Makefile.am b/test/Makefile.am index 5b7edef..d6b6d62 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -42,7 +42,7 @@ TEST_PROG=testhdf5 lheap ohdr stab gheap cache cache_api \ fillval mount flush1 flush2 app_ref enum \ set_extent ttsafe \ getname vfd ntypes dangle dtransform reserved cross_read \ - btree2 fheap + btree2 fheap earray # 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. @@ -120,7 +120,7 @@ CHECK_CLEANFILES+=cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offset.h5 \ 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 objcopy_src.h5 objcopy_dst.h5 \ - objcopy_ext.dat trefer1.h5 trefer2.h5 app_ref.h5 + objcopy_ext.dat trefer1.h5 trefer2.h5 app_ref.h5 earray.h5 # Sources for testhdf5 executable testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ diff --git a/test/Makefile.in b/test/Makefile.in index 91008ad..7503172 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -80,7 +80,8 @@ am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \ app_ref$(EXEEXT) enum$(EXEEXT) set_extent$(EXEEXT) \ ttsafe$(EXEEXT) getname$(EXEEXT) vfd$(EXEEXT) ntypes$(EXEEXT) \ dangle$(EXEEXT) dtransform$(EXEEXT) reserved$(EXEEXT) \ - cross_read$(EXEEXT) btree2$(EXEEXT) fheap$(EXEEXT) + cross_read$(EXEEXT) btree2$(EXEEXT) fheap$(EXEEXT) \ + earray$(EXEEXT) am__EXEEXT_2 = gen_bad_ohdr$(EXEEXT) gen_bogus$(EXEEXT) \ gen_cross$(EXEEXT) gen_deflate$(EXEEXT) gen_filters$(EXEEXT) \ gen_new_array$(EXEEXT) gen_new_fill$(EXEEXT) \ @@ -141,6 +142,10 @@ dtypes_SOURCES = dtypes.c dtypes_OBJECTS = dtypes.$(OBJEXT) dtypes_LDADD = $(LDADD) dtypes_DEPENDENCIES = libh5test.la $(LIBHDF5) +earray_SOURCES = earray.c +earray_OBJECTS = earray.$(OBJEXT) +earray_LDADD = $(LDADD) +earray_DEPENDENCIES = libh5test.la $(LIBHDF5) enum_SOURCES = enum.c enum_OBJECTS = enum.$(OBJEXT) enum_LDADD = $(LDADD) @@ -337,7 +342,7 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libh5test_la_SOURCES) app_ref.c big.c bittests.c btree2.c \ cache.c cache_api.c cmpd_dset.c cross_read.c dangle.c dsets.c \ - dt_arith.c dtransform.c dtypes.c enum.c err_compat.c \ + dt_arith.c dtransform.c dtypes.c earray.c enum.c err_compat.c \ error_test.c extend.c external.c fheap.c fillval.c flush1.c \ flush2.c gen_bad_ohdr.c gen_bogus.c gen_cross.c gen_deflate.c \ gen_filters.c gen_new_array.c gen_new_fill.c gen_new_group.c \ @@ -349,16 +354,16 @@ SOURCES = $(libh5test_la_SOURCES) app_ref.c big.c bittests.c btree2.c \ vfd.c DIST_SOURCES = $(libh5test_la_SOURCES) app_ref.c big.c bittests.c \ btree2.c cache.c cache_api.c cmpd_dset.c cross_read.c dangle.c \ - dsets.c dt_arith.c dtransform.c dtypes.c enum.c err_compat.c \ - error_test.c extend.c external.c fheap.c fillval.c flush1.c \ - flush2.c gen_bad_ohdr.c gen_bogus.c gen_cross.c gen_deflate.c \ - gen_filters.c gen_new_array.c gen_new_fill.c gen_new_group.c \ - gen_new_mtime.c gen_new_super.c gen_noencoder.c \ - gen_nullspace.c gen_udlinks.c getname.c gheap.c hyperslab.c \ - istore.c lheap.c links.c mount.c mtime.c ntypes.c objcopy.c \ - ohdr.c pool.c reserved.c set_extent.c space_overflow.c stab.c \ - $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c \ - vfd.c + dsets.c dt_arith.c dtransform.c dtypes.c earray.c enum.c \ + err_compat.c error_test.c extend.c external.c fheap.c \ + fillval.c flush1.c flush2.c gen_bad_ohdr.c gen_bogus.c \ + gen_cross.c gen_deflate.c gen_filters.c gen_new_array.c \ + gen_new_fill.c gen_new_group.c gen_new_mtime.c gen_new_super.c \ + gen_noencoder.c gen_nullspace.c gen_udlinks.c getname.c \ + gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c \ + ntypes.c objcopy.c ohdr.c pool.c reserved.c set_extent.c \ + space_overflow.c stab.c $(testhdf5_SOURCES) testmeta.c \ + $(ttsafe_SOURCES) unlink.c vfd.c ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -633,7 +638,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog cmpd_dset.h5 \ err_compat.h5 dtransform.h5 test_filters.h5 get_file_name.h5 \ tstint[1-2].h5 unlink_chunked.h5 btree2.h5 objcopy_src.h5 \ objcopy_dst.h5 objcopy_ext.dat trefer1.h5 trefer2.h5 \ - app_ref.h5 + app_ref.h5 earray.h5 INCLUDES = -I$(top_srcdir)/src -I$(top_builddir)/src # Test script for error_test and err_compat @@ -654,7 +659,7 @@ TEST_PROG = testhdf5 lheap ohdr stab gheap cache cache_api \ fillval mount flush1 flush2 app_ref enum \ set_extent ttsafe \ getname vfd ntypes dangle dtransform reserved cross_read \ - btree2 fheap + btree2 fheap earray # These programs generate test files for the tests. They don't need to be @@ -807,6 +812,9 @@ dtransform$(EXEEXT): $(dtransform_OBJECTS) $(dtransform_DEPENDENCIES) dtypes$(EXEEXT): $(dtypes_OBJECTS) $(dtypes_DEPENDENCIES) @rm -f dtypes$(EXEEXT) $(LINK) $(dtypes_OBJECTS) $(dtypes_LDADD) $(LIBS) +earray$(EXEEXT): $(earray_OBJECTS) $(earray_DEPENDENCIES) + @rm -f earray$(EXEEXT) + $(LINK) $(earray_OBJECTS) $(earray_LDADD) $(LIBS) enum$(EXEEXT): $(enum_OBJECTS) $(enum_DEPENDENCIES) @rm -f enum$(EXEEXT) $(LINK) $(enum_OBJECTS) $(enum_LDADD) $(LIBS) @@ -957,6 +965,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dt_arith.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtransform.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtypes.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earray.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enum.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/err_compat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error_test.Po@am__quote@ diff --git a/test/earray.c b/test/earray.c new file mode 100644 index 0000000..7c1f05a --- /dev/null +++ b/test/earray.c @@ -0,0 +1,381 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: Quincey Koziol + * Tuesday, June 17, 2008 + */ +#include "h5test.h" + +/* + * This file needs to access private datatypes from the H5EA package. + * This file also needs to access the extensible array testing code. + */ +#define H5EA_PACKAGE +#define H5EA_TESTING +#include "H5EApkg.h" /* Extensible Arrays */ + +/* Other private headers that this test requires */ +#include "H5Iprivate.h" /* IDs */ + + +/* Local macros */ + +/* Max. testfile name length */ +#define EARRAY_FILENAME_LEN 1024 + +/* Extensible array creation values */ +#define ELMT_SIZE sizeof(haddr_t) +#define IDX_BLK_ELMTS 4 +#define SUP_BLK_MIN_DATA_PTRS 4 +#define DATA_BLK_MIN_ELMTS 16 + +/* Local typedefs */ + +/* Types of tests to perform */ +typedef enum { + EARRAY_TEST_NORMAL, /* "Normal" test, with no testing parameters set */ + EARRAY_TEST_REOPEN, /* Set the reopen_array flag */ + EARRAY_TEST_NTESTS /* The number of test types, must be last */ +} earray_test_type_t; + +/* Whether to compress data blocks */ +typedef enum { + EARRAY_TEST_NO_COMPRESS, /* Don't compress data blocks */ + EARRAY_TEST_COMPRESS, /* Compress data blocks */ + EARRAY_TEST_COMP_N /* The number of different ways to test compressing array blocks, must be last */ +} earray_test_comp_t; + +/* Testing parameters */ +typedef struct earray_test_param_t { + earray_test_type_t reopen_array; /* Whether to re-open the array during the test */ + earray_test_comp_t comp; /* Whether to compress the blocks or not */ +} earray_test_param_t; + +/* Extensible array state information */ +typedef struct earray_state_t { + hsize_t nsuper_blks; /* # of super blocks */ + hsize_t ndata_blks; /* # of data blocks */ +} earray_state_t; + +/* Local variables */ +const char *FILENAME[] = { + "earray", + NULL +}; + +/* Local routines */ + + +/*------------------------------------------------------------------------- + * Function: init_cparam + * + * Purpose: Initialize array creation parameter structure + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Thursday, August 21, 2008 + * + *------------------------------------------------------------------------- + */ +static int +init_cparam(H5EA_create_t *cparam) +{ + /* Wipe out background */ + HDmemset(cparam, 0, sizeof(*cparam)); + + /* General parameters */ + cparam->elmt_size = ELMT_SIZE; + cparam->idx_blk_elmts = IDX_BLK_ELMTS; + cparam->sup_blk_min_data_ptrs = SUP_BLK_MIN_DATA_PTRS; + cparam->data_blk_min_elmts = DATA_BLK_MIN_ELMTS; + + return(0); +} /* init_cparam() */ + + +/*------------------------------------------------------------------------- + * Function: check_stats + * + * Purpose: Verify stats for an extensible array + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Thursday, August 21, 2008 + * + *------------------------------------------------------------------------- + */ +static int +check_stats(const H5EA_t *ea, const earray_state_t *state) +{ + H5EA_stat_t earray_stats; /* Statistics about the array */ + + /* Get statistics for extensible array and verify they are correct */ + if(H5EA_get_stats(ea, &earray_stats) < 0) + FAIL_STACK_ERROR + + /* Compare information */ + if(earray_stats.nsuper_blks != state->nsuper_blks) { + HDfprintf(stdout, "earray_stats.nsuper_blks = %Hu, state->nsuper_blks = %Hu\n", earray_stats.nsuper_blks, state->nsuper_blks); + TEST_ERROR + } /* end if */ + if(earray_stats.ndata_blks != state->ndata_blks) { + HDfprintf(stdout, "earray_stats.ndata_blks = %Hu, state->ndata_blks = %Hu\n", earray_stats.ndata_blks, state->ndata_blks); + TEST_ERROR + } /* end if */ + + /* All tests passed */ + return(0); + +error: + return(1); +} /* check_stats() */ + + +/*------------------------------------------------------------------------- + * Function: test_basic + * + * Purpose: Basic tests for extensible arrays + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Thursday, August 7, 2008 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED *tparam) +{ + hid_t file = -1; /* File ID */ + char filename[EARRAY_FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ + H5EA_create_t test_cparam; /* Creation parameters for array */ + H5EA_t *ea = NULL; /* Extensible array wrapper */ + haddr_t ea_addr; /* Array address in file */ + hsize_t nelmts; /* Number of elements in array */ + earray_state_t state; /* State of extensible array */ + h5_stat_size_t empty_size; /* File size, w/o array */ + h5_stat_size_t file_size; /* File size, after deleting array */ + + /* Set the filename to use for this test (dependent on fapl) */ + 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) + FAIL_STACK_ERROR + + /* Close file */ + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + + /* Get the size of a file w/empty heap*/ + if((empty_size = h5_get_file_size(filename)) < 0) + TEST_ERROR + + /* Re-open the file */ + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + + /* Get a pointer to the internal file object */ + if(NULL == (f = (H5F_t *)H5I_object(file))) + FAIL_STACK_ERROR + + /* + * Display testing message + */ + TESTING("invalid extensible array creation parameters"); + +#ifndef NDEBUG + /* Set invalid element size */ + HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); + test_cparam.elmt_size = 0; + H5E_BEGIN_TRY { + ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam); + } H5E_END_TRY; + if(ea) { + /* Close opened extensible array */ + H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + + /* Indicate error */ + TEST_ERROR + } /* end if */ + + /* Set invalid min. # of data block pointers in super blocks */ + HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); + test_cparam.sup_blk_min_data_ptrs = 0; + H5E_BEGIN_TRY { + ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam); + } H5E_END_TRY; + if(ea) { + /* Close opened extensible array */ + H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + + /* Indicate error */ + TEST_ERROR + } /* end if */ + + /* Set invalid min. # of elements per data block */ + HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); + test_cparam.data_blk_min_elmts = 0; + H5E_BEGIN_TRY { + ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam); + } H5E_END_TRY; + if(ea) { + /* Close opened extensible array */ + H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + + /* Indicate error */ + TEST_ERROR + } /* end if */ + + PASSED() +#else /* NDEBUG */ + SKIPPED(); + puts(" Not tested when assertions are disabled"); +#endif /* NDEBUG */ + + /* + * Display testing message + */ + TESTING("extensible array creation"); + + if(NULL == (ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + FAIL_STACK_ERROR + nelmts = 0; + if(H5EA_get_nelmts(ea, &nelmts) < 0) + FAIL_STACK_ERROR + if(nelmts > 0) + TEST_ERROR + if(H5EA_get_addr(ea, &ea_addr) < 0) + FAIL_STACK_ERROR + if(!H5F_addr_defined(ea_addr)) + TEST_ERROR + HDmemset(&state, 0, sizeof(state)); + if(check_stats(ea, &state)) + TEST_ERROR + PASSED() + + /* Query the type of address mapping */ + TESTING("query array creation parameters"); + HDmemset(&test_cparam, 0, sizeof(H5EA_create_t)); + if(H5EA_get_cparam_test(ea, &test_cparam) < 0) + FAIL_STACK_ERROR + if(H5EA_cmp_cparam_test(cparam, &test_cparam)) + TEST_ERROR + + /* Close the extensible array */ + if(H5EA_close(ea, H5P_DATASET_XFER_DEFAULT) < 0) + FAIL_STACK_ERROR + + /* Delete array */ + if(H5EA_delete(f, H5P_DATASET_XFER_DEFAULT, ea_addr) < 0) + FAIL_STACK_ERROR + + /* Close the file */ + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + + + /* Get the size of the file */ + if((file_size = h5_get_file_size(filename)) < 0) + TEST_ERROR + + /* Verify the file is correct size */ + if(file_size != empty_size) + TEST_ERROR + + /* All tests passed */ + PASSED() + + return 0; + +error: + H5E_BEGIN_TRY { + if(ea) + H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + H5Fclose(file); + } H5E_END_TRY; + + return 1; +} /* end test_create() */ + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Test the extensible array code + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Tuesday, June 17, 2008 + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + H5EA_create_t cparam; /* Creation parameters for extensible array */ + earray_test_param_t tparam; /* Testing parameters */ + hid_t fapl = -1; /* File access property list for data files */ + unsigned nerrors = 0; /* Cumulative error count */ + int ExpressMode; /* Test express value */ + const char *envval; /* File Driver value from environment */ + + /* Reset library */ + h5_reset(); + fapl = h5_fileaccess(); + ExpressMode = GetTestExpress(); + if(ExpressMode > 1) + printf("***Express test mode on. Some tests may be skipped\n"); + + if(NULL == (envval = HDgetenv("HDF5_DRIVER"))) + envval = "nomatch"; + + /* Initialize extensible array creation parameters */ + init_cparam(&cparam); + + /* Clear the testing parameters */ + HDmemset(&tparam, 0, sizeof(tparam)); + + /* Tests */ + nerrors = test_create(fapl, &cparam, &tparam); + + if(nerrors) + goto error; + puts("All extensible array tests passed."); + + + /* Clean up file used */ + h5_cleanup(FILENAME, fapl); + + return 0; + +error: + puts("*** TESTS FAILED ***"); + + H5E_BEGIN_TRY { + H5Pclose(fapl); + } H5E_END_TRY; + + return 1; +} /* end main() */ + diff --git a/test/fheap.c b/test/fheap.c index 263d3a9..bee98b7 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -27,7 +27,7 @@ #include "H5HFpkg.h" /* Fractal heaps */ /* Other private headers that this test requires */ -#include "H5Iprivate.h" +#include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Vprivate.h" /* Vectors and arrays */ @@ -125,7 +125,7 @@ typedef struct fheap_test_param_t { fheap_test_del_drain_t drain_half; /* Whether to drain half of the objects & refill, when deleting objects */ fheap_test_fill_t fill; /* How to "bulk" fill heap blocks */ size_t actual_id_len; /* The actual length of heap IDs for a test */ - fheap_test_comp_t comp; /* Whether to compressed the blocks or not */ + fheap_test_comp_t comp; /* Whether to compress the blocks or not */ } fheap_test_param_t; /* Heap state information */ @@ -586,7 +586,7 @@ reopen_file(hid_t *file, H5F_t **f, const char *filename, hid_t fapl, hid_t dxpl FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = H5I_object(*file))) + if(NULL == (*f = (H5F_t *)H5I_object(*file))) FAIL_STACK_ERROR /* Re-open heap */ @@ -633,7 +633,7 @@ open_heap(char *filename, hid_t fapl, hid_t dxpl, const H5HF_create_t *cparam, /* Check for deleting the entire heap */ if(tparam->del_dir != FHEAP_DEL_HEAP) { /* Get a pointer to the internal file object */ - if(NULL == (*f = H5I_object(*file))) + if(NULL == (*f = (H5F_t *)H5I_object(*file))) FAIL_STACK_ERROR /* Create absolute heap */ @@ -671,7 +671,7 @@ open_heap(char *filename, hid_t fapl, hid_t dxpl, const H5HF_create_t *cparam, FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = H5I_object(*file))) + if(NULL == (*f = (H5F_t *)H5I_object(*file))) FAIL_STACK_ERROR /* Check for deleting the entire heap */ @@ -1839,7 +1839,7 @@ test_create(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t UNUSED *tparam FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* @@ -1939,7 +1939,7 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t UNUSED *tparam TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* @@ -2038,7 +2038,7 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t UNUSED *tp TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Re-open the file */ @@ -2046,7 +2046,7 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t UNUSED *tp FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f2 = H5I_object(file2))) + if(NULL == (f2 = (H5F_t *)H5I_object(file2))) FAIL_STACK_ERROR /* @@ -2184,7 +2184,7 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t UNUSED *t FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Display test banner */ @@ -2321,7 +2321,7 @@ test_id_limits(hid_t fapl, H5HF_create_t *cparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Display testing message */ @@ -2660,7 +2660,7 @@ test_filtered_create(hid_t fapl, H5HF_create_t *cparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Display testing message */ @@ -2701,7 +2701,7 @@ test_filtered_create(hid_t fapl, H5HF_create_t *cparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Re-open the heap */ @@ -2779,7 +2779,7 @@ test_size(hid_t fapl, H5HF_create_t *cparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Display testing message */ @@ -2829,7 +2829,7 @@ test_size(hid_t fapl, H5HF_create_t *cparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Re-open the heap */ @@ -2914,7 +2914,7 @@ test_man_insert_weird(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Create absolute heap */ @@ -3020,7 +3020,7 @@ test_man_insert_first(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Create absolute heap */ @@ -3117,7 +3117,7 @@ test_man_insert_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tp TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -3210,7 +3210,7 @@ test_man_insert_root_mult(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -3305,7 +3305,7 @@ test_man_insert_force_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_par TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -3407,7 +3407,7 @@ test_man_insert_fill_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -3510,7 +3510,7 @@ test_man_insert_third_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -3617,7 +3617,7 @@ test_man_fill_first_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -3709,7 +3709,7 @@ test_man_start_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -3808,7 +3808,7 @@ test_man_fill_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t * TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -3905,7 +3905,7 @@ test_man_start_third_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t * TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -4012,7 +4012,7 @@ test_man_fill_fourth_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t * TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -4105,7 +4105,7 @@ test_man_fill_all_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -4197,7 +4197,7 @@ test_man_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_ TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -4295,7 +4295,7 @@ test_man_second_direct_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhe TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -4401,7 +4401,7 @@ test_man_fill_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_ TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -4500,7 +4500,7 @@ test_man_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -4607,7 +4607,7 @@ test_man_fill_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -4711,7 +4711,7 @@ test_man_fill_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fheap_te TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -4809,7 +4809,7 @@ test_man_start_2nd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -4914,7 +4914,7 @@ test_man_recursive_indirect_two_deep(hid_t fapl, H5HF_create_t *cparam, fheap_te TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -5013,7 +5013,7 @@ test_man_start_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -5119,7 +5119,7 @@ test_man_fill_first_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fh TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -5226,7 +5226,7 @@ test_man_fill_3rd_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fhea TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -5329,7 +5329,7 @@ test_man_fill_all_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhea TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -5433,7 +5433,7 @@ test_man_start_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -5544,7 +5544,7 @@ test_man_fill_first_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fh TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -5660,7 +5660,7 @@ test_man_fill_4th_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fhea TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -5768,7 +5768,7 @@ test_man_fill_all_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhea TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -5879,7 +5879,7 @@ test_man_start_5th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -6009,7 +6009,7 @@ test_man_remove_bogus(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -6158,7 +6158,7 @@ test_man_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -6195,7 +6195,7 @@ test_man_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Re-open heap */ @@ -6314,7 +6314,7 @@ test_man_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -6351,7 +6351,7 @@ test_man_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Re-open heap */ @@ -6499,7 +6499,7 @@ test_man_remove_one_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -6536,7 +6536,7 @@ test_man_remove_one_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Re-open heap */ @@ -6660,7 +6660,7 @@ test_man_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -6697,7 +6697,7 @@ test_man_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Re-open heap */ @@ -6896,7 +6896,7 @@ test_man_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* Create absolute heap */ @@ -6933,7 +6933,7 @@ test_man_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Re-open heap */ @@ -13279,7 +13279,7 @@ test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Re-open the heap */ @@ -14455,7 +14455,7 @@ test_filtered_man_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Re-open the heap */ @@ -14636,7 +14636,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Re-open the heap */ @@ -14696,7 +14696,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Re-open the heap */ @@ -14728,7 +14728,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Re-open the heap */ @@ -14761,7 +14761,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Re-open the heap */ @@ -14793,7 +14793,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Re-open the heap */ @@ -15431,7 +15431,7 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Re-open the heap */ @@ -15589,7 +15589,7 @@ test_bug1(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Re-open the heap */ @@ -15615,7 +15615,7 @@ test_bug1(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = H5I_object(file))) + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* Re-open the heap */ -- cgit v0.12