diff options
author | Bill Wendling <wendling@ncsa.uiuc.edu> | 2003-09-18 19:27:27 (GMT) |
---|---|---|
committer | Bill Wendling <wendling@ncsa.uiuc.edu> | 2003-09-18 19:27:27 (GMT) |
commit | fec0297f869e1f34bd4bb4fc0cb91ac403b73ccb (patch) | |
tree | e56930c56bd7f8ad7058bf5438dbe8b8da36c00e | |
parent | 2e3693aa8be42bfd1d30adda1dd3b278c9d450ec (diff) | |
download | hdf5-fec0297f869e1f34bd4bb4fc0cb91ac403b73ccb.zip hdf5-fec0297f869e1f34bd4bb4fc0cb91ac403b73ccb.tar.gz hdf5-fec0297f869e1f34bd4bb4fc0cb91ac403b73ccb.tar.bz2 |
[svn-r7489] Purpose:
Update
Description:
A lot of modifications for the FPHDF5 stuff:
H5AC.c
H5ACprivate.h - Removed AC_find (it's replaced with AC_protect
and AC_unprotect). Added flushing if it's an FPHDF5 driver and
we're doing an AC_set or AC_unprotect with the dirty flag set.
H5B.c - Split up the B_flush function into different functions
since the one function was doing serialization which is better
left as a separate entity.
H5D.c - Removed some FPHDF5 code that was incorrect
H5F.c - Split up the F_flush function so that it no longer
allocates file space. Created new functions (F_init_superblock,
F_read_superblock, and F_write_superblock) for greater modularity
and so that the FPHDF5 non-captain processes can read the
superblock after the captain process writes it.
H5FD.c - Error message correction.
H5FDfphdf5.c - Removed MPI barrier call that wasn't needed.
H5FPclient.c
H5FPserver.c - Modified so that if a process requests data that
isn't exactly aligned, we can return it if we have the block that
contains the requested address.
H5G.c
H5Gent.c
H5Gnode.c
H5HL.c
H5HLpkg.h
H5HLprivate.h
H5Oefl.c - Removed the H5HL_peek function since it was doing a
(now unsafe) holding of the information in the cache. Replaced
with protect and unprotect calls.
H5TB.c - Error fix. The TB_dless function wasn't working
properly.
H5Gstab.c - Format change.
H5err.txt
H5Edefin.h
H5Einit.h
H5Epubgen.h
H5Eterm.h - Added new error code.
Platforms tested:
Modi4 (paralle, Fortran)
Sol (Fortran)
Linux (C++, Fortran)
Copper (Parallel, Fortran)
Misc. update:
-rw-r--r-- | src/H5AC.c | 330 | ||||
-rw-r--r-- | src/H5ACprivate.h | 10 | ||||
-rw-r--r-- | src/H5B.c | 191 | ||||
-rw-r--r-- | src/H5D.c | 114 | ||||
-rw-r--r-- | src/H5Edefin.h | 193 | ||||
-rw-r--r-- | src/H5Einit.h | 613 | ||||
-rw-r--r-- | src/H5Epubgen.h | 344 | ||||
-rw-r--r-- | src/H5Eterm.h | 193 | ||||
-rw-r--r-- | src/H5F.c | 132 | ||||
-rw-r--r-- | src/H5FD.c | 2 | ||||
-rw-r--r-- | src/H5FDfphdf5.c | 5 | ||||
-rw-r--r-- | src/H5FPclient.c | 27 | ||||
-rw-r--r-- | src/H5FPserver.c | 38 | ||||
-rw-r--r-- | src/H5G.c | 50 | ||||
-rw-r--r-- | src/H5Gent.c | 6 | ||||
-rw-r--r-- | src/H5Gnode.c | 245 | ||||
-rw-r--r-- | src/H5Gstab.c | 1 | ||||
-rw-r--r-- | src/H5HL.c | 524 | ||||
-rw-r--r-- | src/H5HLpkg.h | 5 | ||||
-rw-r--r-- | src/H5HLprivate.h | 11 | ||||
-rw-r--r-- | src/H5Oefl.c | 22 | ||||
-rw-r--r-- | src/H5TB.c | 14 | ||||
-rw-r--r-- | src/H5err.txt | 1 |
23 files changed, 1654 insertions, 1417 deletions
@@ -51,6 +51,11 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ +#ifdef H5_HAVE_FPHDF5 +#include "H5FDfphdf5.h" /* FPHDF5 File Driver */ +#include "H5FPprivate.h" /* Flexible PHDF5 */ +#endif /* H5_HAVE_FPHDF5 */ + /* Interface initialization */ static int interface_initialize_g = 0; #define INTERFACE_INIT H5AC_init_interface @@ -453,233 +458,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } -#if 0 - -/*------------------------------------------------------------------------- - * Function: H5AC_find - * - * Purpose: Given an object type and the address at which that object - * is located in the file, return a pointer to the object. - * The optional UDATA1 and UDATA2 structures are passed down to - * the function that is responsible for loading the object into - * memory. - * - * The returned pointer is guaranteed to be valid until the next - * call to an H5AC function (if you want a pointer which is valid - * indefinately then see H5AC_protect()). - * - * If H5AC_DEBUG is defined then this function also - * checks that the requested object is not currently - * protected since it is illegal to modify a protected object - * except through the pointer returned by H5AC_protect(). - * - * Return: Success: Pointer to the object. The pointer is - * valid until some other cache function - * is called. - * - * Failure: NULL - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 9 1997 - * - * Modifications: - * - * Robb Matzke, 4 Aug 1997 - * Fails immediately if the cached object is at the correct address - * but is of the wrong type. This happens if the caller doesn't know - * what type of object is at the address and calls this function with - * various type identifiers until one succeeds (cf., the debugger). - * - * Robb Matzke, 30 Oct 1997 - * Keeps track of hits, misses, and flushes per object type so we have - * some cache performance diagnostics. - * - * Robb Matzke, 1999-07-27 - * The ADDR argument is passed by value. - * - *------------------------------------------------------------------------- - */ -void * -H5AC_find(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, - const void *udata1, void *udata2) -{ - unsigned idx; - void *thing; - H5AC_flush_func_t flush; - H5AC_info_t **info; -#ifdef H5_HAVE_PARALLEL - H5AC_info_t **dinfo = NULL; -#endif /* H5_HAVE_PARALLEL */ - H5AC_t *cache; - void *ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(H5AC_find, NULL) - - assert(f); - assert(f->shared->cache); - assert(type); - assert(type->load); - assert(type->flush); - assert(H5F_addr_defined(addr)); - - /* Get local pointers to the file's cache information */ - idx = H5AC_HASH(f, addr); - cache = f->shared->cache; - info = cache->slot + idx; - -#ifdef H5_HAVE_PARALLEL - /* If MPI based VFD is used, do special parallel I/O actions */ - if(IS_H5FD_MPI(f)) { - H5AC_dest_func_t dest; - - /* Get local pointer to file's dirty cache information */ - dinfo = cache->dslot + idx; - - /* Check if the cache has 'held' information for this cache slot */ - if (*dinfo) { - /* Sanity check that the 'clean' item is really clean */ - assert(*info); - assert((*info)->dirty==0); - - /* Destroy 'current' information */ - dest = (*info)->type->dest; - if ((dest)(f, (*info))<0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, NULL, "unable to free cached object") - - /* Restore 'held' information back to 'current' information */ - (*info)=(*dinfo); - - /* Clear 'held' information */ - (*dinfo)=NULL; - -#ifdef H5AC_DEBUG - cache->diagnostics[type->id].nrestores++; -#endif /* H5AC_DEBUG */ - } /* end if */ - } /* end if */ -#endif /* H5_HAVE_PARALLEL */ - - /* - * Return right away if the item is in the cache. - */ - if ((*info) && H5F_addr_eq(addr,(*info)->addr) -#ifdef H5AC_DEBUG - && (*info)->type==type -#endif /* H5AC_DEBUG */ - ) { -#ifndef H5AC_DEBUG - /* Sanity check that the object in the cache is the correct type */ - assert((*info)->type==type); -#endif /* H5AC_DEBUG */ - -#ifdef H5AC_DEBUG - cache->diagnostics[type->id].nhits++; -#endif /* H5AC_DEBUG */ - HGOTO_DONE(*info) - } -#ifdef H5AC_DEBUG - cache->diagnostics[type->id].nmisses++; -#endif /* H5AC_DEBUG */ - -#ifdef H5AC_DEBUG - /* - * Check that the requested thing isn't protected, for protected things - * can only be modified through the pointer already handed out by the - * H5AC_protect() function. - */ - { - H5AC_prot_t *prot = NULL; - int i; - - prot = cache->prot + idx; - for (i = 0; i < prot->nprots; i++) { - assert(H5F_addr_ne(addr, prot->slot[i]->addr)); - } - } -#endif /* H5AC_DEBUG */ - - /* - * Load a new thing. If it can't be loaded, then return an error - * without preempting anything. - */ - if (NULL == (thing = (type->load)(f, dxpl_id, addr, udata1, udata2))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "unable to load object") - -#ifdef H5_HAVE_PARALLEL - /* If MPI based VFD is used, do special parallel I/O actions */ - if(IS_H5FD_MPI(f)) { - H5P_genplist_t *dxpl; /* Dataset transfer property list */ - H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode property value */ - - /* Get the dataset transfer property list */ - if (NULL == (dxpl = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a dataset creation property list") - - /* Get the transfer mode property */ - if(H5P_get(dxpl, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve xfer mode") - - /* Make certain there is no 'held' info for this slot */ - assert((*dinfo)==NULL); - - /* Must be using collective I/O to flush metadata in parallel */ - if(xfer_mode==H5FD_MPIO_INDEPENDENT) { - /* Check if there is dirty metadata in this slot */ - if((*info) && (*info)->dirty) { - /* 'Hold' the current metadata for later */ - (*dinfo)=(*info); - - /* Reset the 'current' metadata, so it doesn't get flushed */ - (*info)=NULL; - -#ifdef H5AC_DEBUG - cache->diagnostics[(*dinfo)->type->id].nholds++; -#endif /* H5AC_DEBUG */ - } /* end if */ - } /* end else */ - } /* end if */ -#endif /* H5_HAVE_PARALLEL */ - - /* - * Flush & destroy the previous cache entry if there is one. - */ - if (*info) { -#ifdef H5AC_DEBUG - H5AC_subid_t type_id=(*info)->type->id; /* Remember this for later */ -#endif /* H5AC_DEBUG */ - - flush = (*info)->type->flush; - if ( (flush)(f, dxpl_id, TRUE, (*info)->addr, (*info)) < 0) { - /* - * The old thing could not be removed from the stack. - * Release the new thing and fail. - */ - if ((type->dest)(f, thing) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "unable to destroy just-loaded object") - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "unable to flush existing cached object") - } -#ifdef H5AC_DEBUG - cache->diagnostics[type_id].nflushes++; -#endif /* H5AC_DEBUG */ - } /* end if */ - - /* - * Make the cache point to the new thing. - */ - (*info)=thing; - (*info)->type = type; - (*info)->addr = addr; - assert((*info)->dirty==0); /* Should be clean after being loaded */ - - /* Set the return value */ - ret_value=thing; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} -#endif /* 0 */ - /*------------------------------------------------------------------------- * Function: H5AC_compare @@ -1029,16 +807,20 @@ done: * Modifications: * Robb Matzke, 1999-07-27 * The ADDR argument is passed by value. + * + * Bill Wendling, 2003-09-16 + * Added automatic "flush" if the FPHDF5 driver is being + * used. This'll write the metadata to the SAP where other, + * lesser processes can grab it. *------------------------------------------------------------------------- */ herr_t H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing) { - unsigned idx; - H5AC_flush_func_t flush; - H5AC_info_t **info; - H5AC_t *cache; - herr_t ret_value=SUCCEED; /* Return value */ + unsigned idx; + H5AC_info_t **info; + H5AC_t *cache; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_set, FAIL) @@ -1066,14 +848,16 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void * #endif #ifdef H5_HAVE_PARALLEL - /* If MPI based VFD is used, do special parallel I/O actions */ + /* + * If MPI based VFD is used, do special parallel I/O actions + */ if(IS_H5FD_MPI(f)) { H5AC_info_t **dinfo; + H5P_genplist_t *dxpl; /* Dataset transfer property list */ + H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode property value */ #ifdef H5AC_DEBUG H5AC_subid_t type_id; #endif /* H5AC_DEBUG */ - H5P_genplist_t *dxpl; /* Dataset transfer property list */ - H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode property value */ /* Get the dataset transfer property list */ if (NULL == (dxpl = H5I_object(dxpl_id))) @@ -1147,20 +931,40 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void * H5AC_subid_t type_id=(*info)->type->id; /* Remember this for later */ #endif /* H5AC_DEBUG */ - flush = (*info)->type->flush; - if ((flush)(f, dxpl_id, TRUE, (*info)->addr, (*info)) < 0) + if ((*info)->type->flush(f, dxpl_id, TRUE, (*info)->addr, (*info)) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush object") + #ifdef H5AC_DEBUG cache->diagnostics[type_id].nflushes++; #endif /* H5AC_DEBUG */ } /* end if */ /* Cache this item */ - (*info)=thing; + (*info) = thing; (*info)->type = type; (*info)->addr = addr; + +#ifdef H5_HAVE_FPHDF5 + if (H5FD_is_fphdf5_driver(f->shared->lf)) { +#ifdef H5AC_DEBUG + H5AC_subid_t type_id = (*info)->type->id; /* Remember this for later */ +#endif /* H5AC_DEBUG */ + + /* + * We want to write this metadata to the SAP right now. This will + * keep all of the participating processes in sync. + */ + if ((*info)->type->flush(f, dxpl_id, FALSE, (*info)->addr, *info) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush object") + +#ifdef H5AC_DEBUG + ++cache->diagnostics[type_id].nflushes; +#endif /* H5AC_DEBUG */ + } +#endif /* H5_HAVE_FPHDF5 */ + #ifdef H5AC_DEBUG - cache->diagnostics[type->id].ninits++; + ++cache->diagnostics[type->id].ninits; #endif /* H5AC_DEBUG */ done: @@ -1435,6 +1239,13 @@ H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, } #endif +#ifdef H5_HAVE_FPHDF5 + /* + * XXX: Send a request to the SAP asking to lock this particular + * address. -BW + */ +#endif /* H5_HAVE_FPHDF5 */ + FUNC_ENTER_NOAPI(H5AC_protect, NULL) /* check args */ @@ -1479,6 +1290,7 @@ H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, /* Sanity check that the object in the cache is the correct type */ assert((*dinfo)->type==type); #endif /* H5AC_DEBUG */ + /* * The object is already cached; simply remove it from the cache. */ @@ -1560,6 +1372,7 @@ H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, */ if (NULL == (thing = (type->load)(f, dxpl_id, addr, udata1, udata2))) HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "unable to load object") + #ifdef H5AC_DEBUG cache->diagnostics[type->id].nmisses++; #endif /* H5AC_DEBUG */ @@ -1588,7 +1401,7 @@ H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, prot->nprots += 1; #endif /* H5AC_DEBUG */ - cache->nprots += 1; + ++cache->nprots; rw = rw; /* Remove compiler warning if no FPHDF5 used */ @@ -1639,6 +1452,13 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, FUNC_ENTER_NOAPI(H5AC_unprotect, FAIL) +#ifdef H5_HAVE_FPHDF5 + /* + * XXX: Send a request to the SAP asking to release the lock on this + * particular address. -BW + */ +#endif /* H5_HAVE_FPHDF5 */ + /* check args */ assert(f); assert(f->shared->cache); @@ -1767,16 +1587,34 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, if ((flush)(f, dxpl_id, TRUE, (*info)->addr, (*info)) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush object") #ifdef H5AC_DEBUG - cache->diagnostics[type_id].nflushes++; + ++cache->diagnostics[type_id].nflushes; #endif /* H5AC_DEBUG */ } - /* - * Insert the object back into the cache; it is no longer protected. - */ - (*info)=thing; + /* Insert the object back into the cache; it is no longer protected. */ + (*info) = thing; (*info)->type = type; (*info)->addr = addr; + +#ifdef H5_HAVE_FPHDF5 + /* If the data in the cache is dirty, we want to flush it to the SAP */ + if (H5FD_is_fphdf5_driver(f->shared->lf)) { + if ((*info) && (*info)->dirty) { + /* + * We want to write this metadata to the SAP right now. + * This will keep all of the participating processes in + * sync. + */ + if ((*info)->type->flush(f, dxpl_id, FALSE, (*info)->addr, *info) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush object") + + (*info)->dirty = FALSE; +#ifdef H5AC_DEBUG + ++cache->diagnostics[type_id].nflushes; +#endif /* H5AC_DEBUG */ + } + } +#endif /* H5_HAVE_FPHDF5 */ } /* end if */ else { /* Destroy previously cached thing */ @@ -1785,7 +1623,7 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, } /* end else */ /* Decrement the number of protected items outstanding */ - cache->nprots -= 1; + --cache->nprots; done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index f05a32c..f12f397 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -80,11 +80,11 @@ typedef herr_t (*H5AC_dest_func_t)(H5F_t *f, void *thing); typedef herr_t (*H5AC_clear_func_t)(H5F_t *f, void *thing, hbool_t dest); typedef struct H5AC_class_t { - H5AC_subid_t id; - H5AC_load_func_t load; - H5AC_flush_func_t flush; - H5AC_dest_func_t dest; - H5AC_clear_func_t clear; + H5AC_subid_t id; + H5AC_load_func_t load; + H5AC_flush_func_t flush; + H5AC_dest_func_t dest; + H5AC_clear_func_t clear; } H5AC_class_t; /*===----------------------------------------------------------------------=== @@ -145,6 +145,8 @@ static herr_t H5B_split(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_t const double split_ratios[], void *udata, haddr_t *new_addr/*out*/); static H5B_t * H5B_copy(const H5F_t *f, const H5B_t *old_bt); +static herr_t H5B_serialize(H5F_t *f, H5B_t *bt, uint8_t *buf); +static size_t H5B_size(H5F_t *f, H5B_t *bt); #ifdef H5B_DEBUG static herr_t H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void *udata); @@ -403,6 +405,78 @@ done: /*------------------------------------------------------------------------- + * Function: H5B_serialize + * + * Purpose: Serialize the data structure for writing to disk or + * storing on the SAP (for FPHDF5). + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Bill Wendling + * wendling@ncsa.uiuc.edu + * Sept. 15, 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5B_serialize(H5F_t *f, H5B_t *bt, uint8_t *buf) +{ + unsigned u; + uint8_t *p = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5B_serialize, FAIL) + + /* check arguments */ + assert(f); + assert(bt); + assert(bt->page); + assert(bt->type); + + p = buf; + + /* magic number */ + HDmemcpy(p, H5B_MAGIC, H5B_SIZEOF_MAGIC); + p += 4; + + /* node type and level */ + *p++ = bt->type->id; + H5_CHECK_OVERFLOW(bt->level, int, uint8_t); + *p++ = (uint8_t)bt->level; + + /* entries used */ + UINT16ENCODE(p, bt->nchildren); + + /* sibling pointers */ + H5F_addr_encode(f, &p, bt->left); + H5F_addr_encode(f, &p, bt->right); + + /* child keys and pointers */ + for (u = 0; u <= bt->nchildren; ++u) { + /* encode the key */ + assert(bt->key[u].rkey == p); + p += bt->sizeof_rkey; + + /* encode the key */ + if (bt->key[u].dirty && bt->key[u].nkey) + if (bt->type->encode(f, bt, bt->key[u].rkey, bt->key[u].nkey) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree key") + + /* encode the child address */ + if (u < bt->ndirty) + H5F_addr_encode(f, &p, bt->child[u]); + else + p += H5F_SIZEOF_ADDR(f); + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} + +/*------------------------------------------------------------------------- * Function: H5B_flush * * Purpose: Flushes a dirty B-tree node to disk. @@ -414,92 +488,61 @@ done: * Jun 23 1997 * * Modifications: - * rky 980828 - * Only p0 writes metadata to disk. + * rky 980828 + * Only p0 writes metadata to disk. * - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. + * Robb Matzke, 1999-07-28 + * The ADDR argument is passed by value. * * Quincey Koziol, 2002-7-180 * Added dxpl parameter to allow more control over I/O from metadata * cache. + * + * Bill Wendling, 2003-09-15 + * Separated out the bit of code that serializes the B-Tree + * structure. + * *------------------------------------------------------------------------- */ static herr_t H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *bt) { - size_t size = 0; - uint8_t *p = bt->page; - unsigned u; /* Local index variable */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5B_flush, FAIL) - /* - * Check arguments. - */ + /* check arguments */ assert(f); assert(H5F_addr_defined(addr)); assert(bt); assert(bt->type); assert(bt->type->encode); - size = H5B_nodesize(f, bt->type, NULL, bt->sizeof_rkey); - if (bt->cache_info.dirty) { + unsigned u; - /* magic number */ - HDmemcpy(p, H5B_MAGIC, H5B_SIZEOF_MAGIC); - p += 4; - - /* node type and level */ - *p++ = bt->type->id; - H5_CHECK_OVERFLOW(bt->level,int,uint8_t); - *p++ = (uint8_t)bt->level; - - /* entries used */ - UINT16ENCODE(p, bt->nchildren); - - /* sibling pointers */ - H5F_addr_encode(f, &p, bt->left); - H5F_addr_encode(f, &p, bt->right); - - /* child keys and pointers */ - for (u=0; u<=bt->nchildren; u++) { + if (H5B_serialize(f, bt, bt->page) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTSERIALIZE, FAIL, "unable to serialize B-tree") - /* encode the key */ - assert(bt->key[u].rkey == p); - if (bt->key[u].dirty) { - if (bt->key[u].nkey) { - if ((bt->type->encode) (f, bt, bt->key[u].rkey, bt->key[u].nkey) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree key") - } - bt->key[u].dirty = FALSE; - } - p += bt->sizeof_rkey; - - /* encode the child address */ - if (u < bt->ndirty) { - H5F_addr_encode(f, &p, bt->child[u]); - } else { - p += H5F_SIZEOF_ADDR(f); - } - } + /* child keys and pointers */ + for (u = 0; u <= bt->nchildren; ++u) + bt->key[u].dirty = FALSE; /* - * Write the disk page. We always write the header, but we don't - * bother writing data for the child entries that don't exist or - * for the final unchanged children. + * Write the disk page. We always write the header, but we don't + * bother writing data for the child entries that don't exist or + * for the final unchanged children. */ - if (H5F_block_write(f, H5FD_MEM_BTREE, addr, size, dxpl_id, bt->page)<0) + if (H5F_block_write(f, H5FD_MEM_BTREE, addr, H5B_size(f, bt), dxpl_id, bt->page) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree node to disk") + bt->cache_info.dirty = FALSE; bt->ndirty = 0; } - if (destroy) { - if(H5B_dest(f,bt)<0) + + if (destroy) + if (H5B_dest(f,bt) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node") - } done: FUNC_LEAVE_NOAPI(ret_value) @@ -588,6 +631,38 @@ done: /*------------------------------------------------------------------------- + * Function: H5B_size + * + * Purpose: Get the size of the B-tree node on disk. + * + * Return: Doesn't fail. + * + * Programmer: Bill Wendling + * wendling@ncsa.uiuc.edu + * Sept. 16, 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static size_t +H5B_size(H5F_t *f, H5B_t *bt) +{ + size_t ret_value = 0; + + FUNC_ENTER_NOINIT(H5B_size) + + /* check args */ + assert(f); + assert(bt); + assert(bt->type); + + ret_value = H5B_nodesize(f, bt->type, NULL, bt->sizeof_rkey); + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5B_find * * Purpose: Locate the specified information in a B-tree and return @@ -977,9 +1052,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, FUNC_ENTER_NOAPI(H5B_insert, FAIL) - /* - * Check arguments. - */ + /* Check arguments. */ assert(f); assert(type); assert(type->sizeof_nkey <= sizeof _lt_key); @@ -13,9 +13,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #define H5D_PACKAGE /*suppress error about including H5Dpkg */ -#ifdef H5_HAVE_FPHDF5 -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#endif /* H5_HAVE_FPHDF5 */ /* Pablo information */ /* (Put before include files to avoid problems with inline functions) */ @@ -24,9 +21,6 @@ #include "H5private.h" /* Generic Functions */ #include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ -#ifdef H5_HAVE_FPHDF5 -#include "H5Fpkg.h" /* Files access */ -#endif /* H5_HAVE_FPHDF5 */ #include "H5FDprivate.h" /* File drivers */ #include "H5FLprivate.h" /* Free Lists */ #include "H5FOprivate.h" /* File objects */ @@ -37,7 +31,9 @@ #include "H5Vprivate.h" /* Vectors and arrays */ #ifdef H5_HAVE_FPHDF5 -#include "H5FPprivate.h" /* Flexible PHDF5 */ +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + +#include "H5Fpkg.h" /* File access */ #endif /* H5_HAVE_FPHDF5 */ /*#define H5D_DEBUG*/ @@ -1615,10 +1611,6 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space H5P_genplist_t *dc_plist=NULL; /* New Property list */ hbool_t has_vl_type=FALSE; /* Flag to indicate a VL-type for dataset */ H5D_t *ret_value; /* Return value */ -#ifdef H5_HAVE_FPHDF5 - hbool_t locked_grp = FALSE; /* The parent group is locked */ - hobj_ref_t grp_oid; -#endif /* H5_HAVE_FPHDF5 */ FUNC_ENTER_NOAPI(H5D_create, NULL) @@ -1631,7 +1623,7 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space assert (H5I_GENPROP_LST==H5I_get_type(dxpl_id)); /* Check if the filters in the DCPL can be applied to this dataset */ - if(H5Z_can_apply(dcpl_id,type_id)<0) + if (H5Z_can_apply(dcpl_id,type_id)<0) HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, NULL, "I/O filters can't operate on this dataset") /* Get the dataset's datatype */ @@ -1639,15 +1631,15 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") /* Check if the datatype is "sensible" for use in a dataset */ - if(H5T_is_sensible(type)!=TRUE) + if (H5T_is_sensible(type)!=TRUE) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "datatype is not sensible") /* Check if the datatype is/contains a VL-type */ - if(H5T_detect_class(type, H5T_VLEN)) + if (H5T_detect_class(type, H5T_VLEN)) has_vl_type=TRUE; /* Initialize the dataset object */ - if(NULL == (new_dset = H5D_new(dcpl_id,TRUE,has_vl_type))) + if (NULL == (new_dset = H5D_new(dcpl_id,TRUE,has_vl_type))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Make the "set local" filter callbacks for this dataset */ @@ -1658,72 +1650,6 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space if (NULL==(file=H5G_insertion_file(loc, name, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to locate insertion point") -#ifdef H5_HAVE_FPHDF5 -#error "This is not the right place for this code, see comment in code - QAK" -/* This code ought to be somewhere in H5G_insert (or one of the functions that - * it calls), not here. All the routines which create objects in the file - * (H5Dcreate, H5Gcreate, H5Tcommit, H5Glink, etc.) all prepare an object in - * memory and then call H5G_insert to actually insert the object into the group - * that contains it. - * - * Looking through the H5G_insert code, it calls H5G_namei which calls - * H5G_stab_insert to actually insert the object into the symbol table, so - * H5G_stab_insert would probably be the best place to do this sort of locking. - * (I think it would be better to do it there than in H5G_insert because the - * H5Glink code doesn't end up calling H5G_insert for creating soft links, but - * it does end up calling H5G_stab_insert). - * - * Otherwise, you are going to have to duplicate this chunk of code into far - * too many places in the library... - QAK - */ - if (H5FD_is_fphdf5_driver(file->shared->lf)) { - unsigned file_id = H5FD_fphdf5_file_id(file->shared->lf); - char *tmp_name = H5MM_xstrdup(name); - char *last = HDstrrchr(tmp_name, '/'); - hid_t gid; - H5G_t *grp = NULL; - H5G_entry_t *grp_loc = NULL; - H5FP_status_t status; - unsigned req_id; - - /* Chop off the dataset name (we only want to lock the group) */ - if (last) - last[1] = '\0'; - - /* Open the group */ - if ((grp = H5G_open(loc, tmp_name, dxpl_id)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group"); - - /* Register the group so we can grab information about it */ - if ((gid = H5I_register(H5I_GROUP, grp)) < 0) { - H5G_close(grp); - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, NULL, "unable to register group"); - } - - /* Grab the location of the group */ - if ((grp_loc = H5G_loc(gid)) == NULL) { - H5I_dec_ref(gid); - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a location ID") - } - - grp_oid = grp_loc->header; - - if (H5FP_request_lock(file_id, grp_oid, H5FP_LOCK_WRITE, - TRUE, &req_id, &status) != SUCCEED) { - /* FIXME: This is bad. We should check the "status" variable */ - H5I_dec_ref(gid); - H5MM_xfree(tmp_name); - HGOTO_ERROR(H5E_FPHDF5, H5E_CANTLOCK, NULL, "unable to lock group"); - } - - if (H5I_dec_ref(gid) != SUCCEED) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to close group"); - - locked_grp = TRUE; - H5MM_xfree(tmp_name); - } -#endif /* H5_HAVE_FPHDF5 */ - /* Copy datatype for dataset */ if((new_dset->type = H5T_copy(type, H5T_COPY_ALL))==NULL) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy datatype") @@ -1903,12 +1829,18 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "not implemented yet") } /* end switch */ - /* - * Update the dataset's entry info. - */ + /* Update the dataset's entry info. */ if (H5D_update_entry_info(file, dxpl_id, new_dset, dc_plist) != SUCCEED) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't update the metadata cache") +#ifdef H5_HAVE_FPHDF5 + /* FPHDF5 is all about independent writes */ + if (H5FD_is_fphdf5_driver(file->shared->lf)) + if (H5Pset_dxpl_fphdf5(dxpl_id, H5FD_MPIO_INDEPENDENT) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, NULL, + "unable to set xfer property list to independent write") +#endif /* H5_HAVE_FPHDF5 */ + /* * Give the dataset a name. That is, create and add a new * "H5G_entry_t" object to the group this dataset is being initially @@ -1946,20 +1878,6 @@ done: H5FL_FREE(H5D_t,new_dset); } -#ifdef H5_HAVE_FPHDF5 - if (locked_grp) { - unsigned file_id = H5FD_fphdf5_file_id(file->shared->lf); - H5FP_status_t status; - unsigned req_id; - - /* Request a release of the lock */ - if (H5FP_request_release_lock(file_id, grp_oid, TRUE, &req_id, &status)) { - /* FIXME: This is bad. We should check the "status" variable */ - HGOTO_ERROR(H5E_FPHDF5, H5E_CANTLOCK, NULL, "unable to lock group"); - } - } -#endif /* H5_HAVE_FPHDF5 */ - FUNC_LEAVE_NOAPI(ret_value) } diff --git a/src/H5Edefin.h b/src/H5Edefin.h index 6b2f0bb..ed3df3a 100644 --- a/src/H5Edefin.h +++ b/src/H5Edefin.h @@ -20,101 +20,42 @@ #define _H5Edefin_H /* Major error IDs */ -hid_t H5E_BTREE_g = FAIL; /* B-Tree node */ -hid_t H5E_EFL_g = FAIL; /* External file list */ -hid_t H5E_REFERENCE_g = FAIL; /* References */ -hid_t H5E_FPHDF5_g = FAIL; /* Flexible Parallel HDF5 */ -hid_t H5E_INTERNAL_g = FAIL; /* Internal error (too specific to document in detail) */ -hid_t H5E_ERROR_g = FAIL; /* Error API */ hid_t H5E_DATASET_g = FAIL; /* Dataset */ -hid_t H5E_ATOM_g = FAIL; /* Object atom */ -hid_t H5E_TBBT_g = FAIL; /* Threaded, Balanced, Binary Trees */ -hid_t H5E_OHDR_g = FAIL; /* Object header */ +hid_t H5E_FUNC_g = FAIL; /* Function entry/exit */ hid_t H5E_STORAGE_g = FAIL; /* Data storage */ hid_t H5E_FILE_g = FAIL; /* File accessability */ -hid_t H5E_RS_g = FAIL; /* Reference Counted Strings */ -hid_t H5E_DATATYPE_g = FAIL; /* Datatype */ -hid_t H5E_TST_g = FAIL; /* Ternary Search Trees */ -hid_t H5E_RESOURCE_g = FAIL; /* Resource unavailable */ -hid_t H5E_CACHE_g = FAIL; /* Object cache */ +hid_t H5E_FPHDF5_g = FAIL; /* Flexible Parallel HDF5 */ hid_t H5E_SYM_g = FAIL; /* Symbol table */ -hid_t H5E_FUNC_g = FAIL; /* Function entry/exit */ hid_t H5E_VFL_g = FAIL; /* Virtual File Layer */ +hid_t H5E_INTERNAL_g = FAIL; /* Internal error (too specific to document in detail) */ +hid_t H5E_BTREE_g = FAIL; /* B-Tree node */ +hid_t H5E_REFERENCE_g = FAIL; /* References */ +hid_t H5E_DATASPACE_g = FAIL; /* Dataspace */ +hid_t H5E_RESOURCE_g = FAIL; /* Resource unavailable */ hid_t H5E_PLIST_g = FAIL; /* Property lists */ +hid_t H5E_DATATYPE_g = FAIL; /* Datatype */ +hid_t H5E_RS_g = FAIL; /* Reference Counted Strings */ +hid_t H5E_HEAP_g = FAIL; /* Heap */ +hid_t H5E_OHDR_g = FAIL; /* Object header */ +hid_t H5E_TBBT_g = FAIL; /* Threaded, Balanced, Binary Trees */ +hid_t H5E_ATOM_g = FAIL; /* Object atom */ hid_t H5E_ATTR_g = FAIL; /* Attribute */ hid_t H5E_IO_g = FAIL; /* Low-level I/O */ +hid_t H5E_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_DATASPACE_g = FAIL; /* Dataspace */ +hid_t H5E_ERROR_g = FAIL; /* Error API */ hid_t H5E_PLINE_g = FAIL; /* Data filters */ -hid_t H5E_HEAP_g = FAIL; /* Heap */ +hid_t H5E_CACHE_g = FAIL; /* Object cache */ /* Minor error IDs */ -/* Property list errors */ -hid_t H5E_CANTGET_g = FAIL; /* Can't get value */ -hid_t H5E_CANTSET_g = FAIL; /* Can't set value */ -hid_t H5E_DUPCLASS_g = FAIL; /* Duplicate class name in parent class */ - -/* Dataspace errors */ -hid_t H5E_CANTCLIP_g = FAIL; /* Can't clip hyperslab region */ -hid_t H5E_CANTCOUNT_g = FAIL; /* Can't count elements */ -hid_t H5E_CANTSELECT_g = FAIL; /* Can't select hyperslab */ -hid_t H5E_CANTNEXT_g = FAIL; /* Can't move to next iterator location */ -hid_t H5E_BADSELECT_g = FAIL; /* Invalid selection */ -hid_t H5E_CANTCOMPARE_g = FAIL; /* Can't compare objects */ - -/* Object atom related errors */ -hid_t H5E_BADATOM_g = FAIL; /* Unable to find atom information (already closed?) */ -hid_t H5E_BADGROUP_g = FAIL; /* Unable to find ID group information */ -hid_t H5E_CANTREGISTER_g = FAIL; /* Unable to register new atom */ -hid_t H5E_CANTINC_g = FAIL; /* Unable to increment reference count */ -hid_t H5E_CANTDEC_g = FAIL; /* Unable to decrement reference count */ -hid_t H5E_NOIDS_g = FAIL; /* Out of IDs for group */ - -/* Argument errors */ -hid_t H5E_UNINITIALIZED_g = FAIL; /* Information is uinitialized */ -hid_t H5E_UNSUPPORTED_g = FAIL; /* Feature is unsupported */ -hid_t H5E_BADTYPE_g = FAIL; /* Inappropriate type */ -hid_t H5E_BADRANGE_g = FAIL; /* Out of range */ -hid_t H5E_BADVALUE_g = FAIL; /* Bad value */ - -/* FPHDF5 errors */ -hid_t H5E_CANTMAKETREE_g = FAIL; /* Can't create a binary tree node */ -hid_t H5E_CANTRECV_g = FAIL; /* Can't receive messages from processes */ -hid_t H5E_CANTSENDMDATA_g = FAIL; /* Can't send metadata message */ -hid_t H5E_CANTCHANGE_g = FAIL; /* Can't register change with server */ -hid_t H5E_CANTALLOC_g = FAIL; /* Can't allocate from file */ - /* I/O pipeline errors */ hid_t H5E_NOFILTER_g = FAIL; /* Requested filter is not available */ hid_t H5E_CALLBACK_g = FAIL; /* Callback failed */ hid_t H5E_CANAPPLY_g = FAIL; /* Error from filter 'can apply' callback */ hid_t H5E_SETLOCAL_g = FAIL; /* Error from filter 'set local' callback */ -/* Datatype conversion errors */ -hid_t H5E_CANTCONVERT_g = FAIL; /* Can't convert datatypes */ -hid_t H5E_BADSIZE_g = FAIL; /* Bad size for object */ - -/* Parallel MPI errors */ -hid_t H5E_MPI_g = FAIL; /* Some MPI function failed */ -hid_t H5E_MPIERRSTR_g = FAIL; /* MPI Error String */ - -/* Object header related errors */ -hid_t H5E_LINKCOUNT_g = FAIL; /* Bad object header link count */ -hid_t H5E_VERSION_g = FAIL; /* Wrong version number */ -hid_t H5E_ALIGNMENT_g = FAIL; /* Alignment error */ -hid_t H5E_BADMESG_g = FAIL; /* Unrecognized message */ -hid_t H5E_CANTDELETE_g = FAIL; /* Can't delete message */ - -/* Resource errors */ -hid_t H5E_NOSPACE_g = FAIL; /* No space available for allocation */ -hid_t H5E_CANTCOPY_g = FAIL; /* Unable to copy object */ -hid_t H5E_CANTFREE_g = FAIL; /* Unable to free object */ -hid_t H5E_ALREADYEXISTS_g = FAIL; /* Object already exists */ -hid_t H5E_CANTLOCK_g = FAIL; /* Unable to lock object */ -hid_t H5E_CANTUNLOCK_g = FAIL; /* Unable to unlock object */ -hid_t H5E_CANTGC_g = FAIL; /* Unable to garbage collect */ - /* Generic low-level file I/O errors */ hid_t H5E_SEEKERROR_g = FAIL; /* Seek failed */ hid_t H5E_READERROR_g = FAIL; /* Read failed */ @@ -123,14 +64,28 @@ hid_t H5E_CLOSEERROR_g = FAIL; /* Close failed */ hid_t H5E_OVERFLOW_g = FAIL; /* Address overflowed */ hid_t H5E_FCNTL_g = FAIL; /* File control (fcntl) failed */ -/* B-tree related errors */ -hid_t H5E_NOTFOUND_g = FAIL; /* Object not found */ -hid_t H5E_EXISTS_g = FAIL; /* Object already exists */ -hid_t H5E_CANTENCODE_g = FAIL; /* Unable to encode value */ -hid_t H5E_CANTDECODE_g = FAIL; /* Unable to decode value */ -hid_t H5E_CANTSPLIT_g = FAIL; /* Unable to split node */ -hid_t H5E_CANTINSERT_g = FAIL; /* Unable to insert object */ -hid_t H5E_CANTLIST_g = FAIL; /* Unable to list node */ +/* Group related errors */ +hid_t H5E_CANTOPENOBJ_g = FAIL; /* Can't open object */ +hid_t H5E_CANTCLOSEOBJ_g = FAIL; /* Can't close object */ +hid_t H5E_COMPLEN_g = FAIL; /* Name component is too long */ +hid_t H5E_CWG_g = FAIL; /* Problem with current working group */ +hid_t H5E_LINK_g = FAIL; /* Link count failure */ +hid_t H5E_SLINK_g = FAIL; /* Symbolic link error */ + +/* Cache related errors */ +hid_t H5E_CANTFLUSH_g = FAIL; /* Unable to flush data from cache */ +hid_t H5E_CANTSERIALIZE_g = FAIL; /* Unable to serialize data from cache */ +hid_t H5E_CANTLOAD_g = FAIL; /* Unable to load metadata into cache */ +hid_t H5E_PROTECT_g = FAIL; /* Protected metadata error */ +hid_t H5E_NOTCACHED_g = FAIL; /* Metadata not currently cached */ + +/* Object atom related errors */ +hid_t H5E_BADATOM_g = FAIL; /* Unable to find atom information (already closed?) */ +hid_t H5E_BADGROUP_g = FAIL; /* Unable to find ID group information */ +hid_t H5E_CANTREGISTER_g = FAIL; /* Unable to register new atom */ +hid_t H5E_CANTINC_g = FAIL; /* Unable to increment reference count */ +hid_t H5E_CANTDEC_g = FAIL; /* Unable to decrement reference count */ +hid_t H5E_NOIDS_g = FAIL; /* Out of IDs for group */ /* File accessability errors */ hid_t H5E_FILEEXISTS_g = FAIL; /* File already exists */ @@ -143,23 +98,69 @@ hid_t H5E_BADFILE_g = FAIL; /* Bad file ID accessed */ hid_t H5E_TRUNCATED_g = FAIL; /* File has been truncated */ hid_t H5E_MOUNT_g = FAIL; /* File mount error */ -/* Cache related errors */ -hid_t H5E_CANTFLUSH_g = FAIL; /* Unable to flush data from cache */ -hid_t H5E_CANTLOAD_g = FAIL; /* Unable to load metadata into cache */ -hid_t H5E_PROTECT_g = FAIL; /* Protected metadata error */ -hid_t H5E_NOTCACHED_g = FAIL; /* Metadata not currently cached */ +/* Resource errors */ +hid_t H5E_NOSPACE_g = FAIL; /* No space available for allocation */ +hid_t H5E_CANTCOPY_g = FAIL; /* Unable to copy object */ +hid_t H5E_CANTFREE_g = FAIL; /* Unable to free object */ +hid_t H5E_ALREADYEXISTS_g = FAIL; /* Object already exists */ +hid_t H5E_CANTLOCK_g = FAIL; /* Unable to lock object */ +hid_t H5E_CANTUNLOCK_g = FAIL; /* Unable to unlock object */ +hid_t H5E_CANTGC_g = FAIL; /* Unable to garbage collect */ -/* Group related errors */ -hid_t H5E_CANTOPENOBJ_g = FAIL; /* Can't open object */ -hid_t H5E_CANTCLOSEOBJ_g = FAIL; /* Can't close object */ -hid_t H5E_COMPLEN_g = FAIL; /* Name component is too long */ -hid_t H5E_CWG_g = FAIL; /* Problem with current working group */ -hid_t H5E_LINK_g = FAIL; /* Link count failure */ -hid_t H5E_SLINK_g = FAIL; /* Symbolic link error */ +/* Parallel MPI errors */ +hid_t H5E_MPI_g = FAIL; /* Some MPI function failed */ +hid_t H5E_MPIERRSTR_g = FAIL; /* MPI Error String */ + +/* Dataspace errors */ +hid_t H5E_CANTCLIP_g = FAIL; /* Can't clip hyperslab region */ +hid_t H5E_CANTCOUNT_g = FAIL; /* Can't count elements */ +hid_t H5E_CANTSELECT_g = FAIL; /* Can't select hyperslab */ +hid_t H5E_CANTNEXT_g = FAIL; /* Can't move to next iterator location */ +hid_t H5E_BADSELECT_g = FAIL; /* Invalid selection */ +hid_t H5E_CANTCOMPARE_g = FAIL; /* Can't compare objects */ /* Function entry/exit interface errors */ hid_t H5E_CANTINIT_g = FAIL; /* Unable to initialize object */ hid_t H5E_ALREADYINIT_g = FAIL; /* Object already initialized */ hid_t H5E_CANTRELEASE_g = FAIL; /* Unable to release object */ +/* Property list errors */ +hid_t H5E_CANTGET_g = FAIL; /* Can't get value */ +hid_t H5E_CANTSET_g = FAIL; /* Can't set value */ +hid_t H5E_DUPCLASS_g = FAIL; /* Duplicate class name in parent class */ + +/* Argument errors */ +hid_t H5E_UNINITIALIZED_g = FAIL; /* Information is uinitialized */ +hid_t H5E_UNSUPPORTED_g = FAIL; /* Feature is unsupported */ +hid_t H5E_BADTYPE_g = FAIL; /* Inappropriate type */ +hid_t H5E_BADRANGE_g = FAIL; /* Out of range */ +hid_t H5E_BADVALUE_g = FAIL; /* Bad value */ + +/* B-tree related errors */ +hid_t H5E_NOTFOUND_g = FAIL; /* Object not found */ +hid_t H5E_EXISTS_g = FAIL; /* Object already exists */ +hid_t H5E_CANTENCODE_g = FAIL; /* Unable to encode value */ +hid_t H5E_CANTDECODE_g = FAIL; /* Unable to decode value */ +hid_t H5E_CANTSPLIT_g = FAIL; /* Unable to split node */ +hid_t H5E_CANTINSERT_g = FAIL; /* Unable to insert object */ +hid_t H5E_CANTLIST_g = FAIL; /* Unable to list node */ + +/* Object header related errors */ +hid_t H5E_LINKCOUNT_g = FAIL; /* Bad object header link count */ +hid_t H5E_VERSION_g = FAIL; /* Wrong version number */ +hid_t H5E_ALIGNMENT_g = FAIL; /* Alignment error */ +hid_t H5E_BADMESG_g = FAIL; /* Unrecognized message */ +hid_t H5E_CANTDELETE_g = FAIL; /* Can't delete message */ + +/* FPHDF5 errors */ +hid_t H5E_CANTMAKETREE_g = FAIL; /* Can't create a binary tree node */ +hid_t H5E_CANTRECV_g = FAIL; /* Can't receive messages from processes */ +hid_t H5E_CANTSENDMDATA_g = FAIL; /* Can't send metadata message */ +hid_t H5E_CANTCHANGE_g = FAIL; /* Can't register change with server */ +hid_t H5E_CANTALLOC_g = FAIL; /* Can't allocate from file */ + +/* Datatype conversion errors */ +hid_t H5E_CANTCONVERT_g = FAIL; /* Can't convert datatypes */ +hid_t H5E_BADSIZE_g = FAIL; /* Bad size for object */ + #endif /* H5Edefin_H */ diff --git a/src/H5Einit.h b/src/H5Einit.h index a4b929a..a384e2f 100644 --- a/src/H5Einit.h +++ b/src/H5Einit.h @@ -23,110 +23,100 @@ /* Major error codes */ /*********************/ -assert(H5E_BTREE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "B-Tree node"))==NULL) +assert(H5E_DATASET_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Dataset"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BTREE_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_DATASET_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_EFL_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "External file list"))==NULL) +assert(H5E_FUNC_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Function entry/exit"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_EFL_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_FUNC_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_REFERENCE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "References"))==NULL) +assert(H5E_STORAGE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Data storage"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_REFERENCE_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_STORAGE_g = H5I_register(H5I_ERROR_MSG, msg))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +assert(H5E_FILE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "File accessability"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_FILE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") assert(H5E_FPHDF5_g==(-1)); if((msg = H5E_create_msg(cls, H5E_MAJOR, "Flexible Parallel HDF5"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") if((H5E_FPHDF5_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_INTERNAL_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Internal error (too specific to document in detail)"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_INTERNAL_g = H5I_register(H5I_ERROR_MSG, msg))<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) +assert(H5E_SYM_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Symbol table"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ERROR_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_SYM_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_DATASET_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Dataset"))==NULL) +assert(H5E_VFL_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Virtual File Layer"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_DATASET_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_VFL_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_ATOM_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Object atom"))==NULL) +assert(H5E_INTERNAL_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Internal error (too specific to document in detail)"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ATOM_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_INTERNAL_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_TBBT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Threaded, Balanced, Binary Trees"))==NULL) +assert(H5E_BTREE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "B-Tree node"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_TBBT_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_BTREE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_OHDR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Object header"))==NULL) +assert(H5E_REFERENCE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "References"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_OHDR_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_REFERENCE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_STORAGE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Data storage"))==NULL) +assert(H5E_DATASPACE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Dataspace"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_STORAGE_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_DATASPACE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_FILE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "File accessability"))==NULL) +assert(H5E_RESOURCE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Resource unavailable"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FILE_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_RESOURCE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_RS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Reference Counted Strings"))==NULL) +assert(H5E_PLIST_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Property lists"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_RS_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_PLIST_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") assert(H5E_DATATYPE_g==(-1)); if((msg = H5E_create_msg(cls, H5E_MAJOR, "Datatype"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") if((H5E_DATATYPE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_TST_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Ternary Search Trees"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_TST_g = H5I_register(H5I_ERROR_MSG, msg))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_RESOURCE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Resource unavailable"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_RESOURCE_g = H5I_register(H5I_ERROR_MSG, msg))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CACHE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Object cache"))==NULL) +assert(H5E_RS_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Reference Counted Strings"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CACHE_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_RS_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_SYM_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Symbol table"))==NULL) +assert(H5E_HEAP_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Heap"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SYM_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_HEAP_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_FUNC_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Function entry/exit"))==NULL) +assert(H5E_OHDR_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Object header"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FUNC_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_OHDR_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_VFL_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Virtual File Layer"))==NULL) +assert(H5E_TBBT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Threaded, Balanced, Binary Trees"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_VFL_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_TBBT_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_PLIST_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Property lists"))==NULL) +assert(H5E_ATOM_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Object atom"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_PLIST_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_ATOM_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") assert(H5E_ATTR_g==(-1)); if((msg = H5E_create_msg(cls, H5E_MAJOR, "Attribute"))==NULL) @@ -138,25 +128,35 @@ if((msg = H5E_create_msg(cls, H5E_MAJOR, "Low-level I/O"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") if((H5E_IO_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +assert(H5E_EFL_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "External file list"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_EFL_g = H5I_register(H5I_ERROR_MSG, msg))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +assert(H5E_TST_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Ternary Search Trees"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_TST_g = H5I_register(H5I_ERROR_MSG, msg))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") assert(H5E_ARGS_g==(-1)); 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))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_DATASPACE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Dataspace"))==NULL) +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") -if((H5E_DATASPACE_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_ERROR_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") assert(H5E_PLINE_g==(-1)); if((msg = H5E_create_msg(cls, H5E_MAJOR, "Data filters"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") if((H5E_PLINE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_HEAP_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Heap"))==NULL) +assert(H5E_CACHE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Object cache"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_HEAP_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CACHE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /*********************/ @@ -164,53 +164,117 @@ if((H5E_HEAP_g = H5I_register(H5I_ERROR_MSG, msg))<0) /*********************/ -/* Property list errors */ -assert(H5E_CANTGET_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't get value"))==NULL) +/* I/O pipeline errors */ +assert(H5E_NOFILTER_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Requested filter is not available"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTGET_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_NOFILTER_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTSET_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't set value"))==NULL) +assert(H5E_CALLBACK_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Callback failed"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTSET_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CALLBACK_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_DUPCLASS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Duplicate class name in parent class"))==NULL) +assert(H5E_CANAPPLY_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Error from filter 'can apply' callback"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_DUPCLASS_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANAPPLY_g = H5I_register(H5I_ERROR_MSG, msg))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +assert(H5E_SETLOCAL_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Error from filter 'set local' callback"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_SETLOCAL_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -/* Dataspace errors */ -assert(H5E_CANTCLIP_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't clip hyperslab region"))==NULL) +/* Generic low-level file I/O errors */ +assert(H5E_SEEKERROR_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Seek failed"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCLIP_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_SEEKERROR_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTCOUNT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't count elements"))==NULL) +assert(H5E_READERROR_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Read failed"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCOUNT_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_READERROR_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTSELECT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't select hyperslab"))==NULL) +assert(H5E_WRITEERROR_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Write failed"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTSELECT_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_WRITEERROR_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTNEXT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't move to next iterator location"))==NULL) +assert(H5E_CLOSEERROR_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Close failed"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTNEXT_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CLOSEERROR_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADSELECT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Invalid selection"))==NULL) +assert(H5E_OVERFLOW_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Address overflowed"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADSELECT_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_OVERFLOW_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTCOMPARE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't compare objects"))==NULL) +assert(H5E_FCNTL_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "File control (fcntl) failed"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCOMPARE_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_FCNTL_g = H5I_register(H5I_ERROR_MSG, msg))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + +/* Group related errors */ +assert(H5E_CANTOPENOBJ_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't open object"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTOPENOBJ_g = H5I_register(H5I_ERROR_MSG, msg))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +assert(H5E_CANTCLOSEOBJ_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't close object"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTCLOSEOBJ_g = H5I_register(H5I_ERROR_MSG, msg))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +assert(H5E_COMPLEN_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Name component is too long"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_COMPLEN_g = H5I_register(H5I_ERROR_MSG, msg))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +assert(H5E_CWG_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Problem with current working group"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CWG_g = H5I_register(H5I_ERROR_MSG, msg))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +assert(H5E_LINK_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Link count failure"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_LINK_g = H5I_register(H5I_ERROR_MSG, msg))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +assert(H5E_SLINK_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Symbolic link error"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_SLINK_g = H5I_register(H5I_ERROR_MSG, msg))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + +/* Cache related errors */ +assert(H5E_CANTFLUSH_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to flush data from cache"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTFLUSH_g = H5I_register(H5I_ERROR_MSG, msg))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +assert(H5E_CANTSERIALIZE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to serialize data from cache"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTSERIALIZE_g = H5I_register(H5I_ERROR_MSG, msg))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +assert(H5E_CANTLOAD_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to load metadata into cache"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTLOAD_g = H5I_register(H5I_ERROR_MSG, msg))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +assert(H5E_PROTECT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Protected metadata error"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_PROTECT_g = H5I_register(H5I_ERROR_MSG, msg))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +assert(H5E_NOTCACHED_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Metadata not currently cached"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_NOTCACHED_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* Object atom related errors */ @@ -245,92 +309,88 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "Out of IDs for group"))==NULL) if((H5E_NOIDS_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -/* Argument errors */ -assert(H5E_UNINITIALIZED_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Information is uinitialized"))==NULL) +/* File accessability errors */ +assert(H5E_FILEEXISTS_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "File already exists"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_UNINITIALIZED_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_FILEEXISTS_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_UNSUPPORTED_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Feature is unsupported"))==NULL) +assert(H5E_FILEOPEN_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "File already open"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_UNSUPPORTED_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_FILEOPEN_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADTYPE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Inappropriate type"))==NULL) +assert(H5E_CANTCREATE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to create file"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADTYPE_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTCREATE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADRANGE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Out of range"))==NULL) +assert(H5E_CANTOPENFILE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to open file"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADRANGE_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTOPENFILE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADVALUE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad value"))==NULL) +assert(H5E_CANTCLOSEFILE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to close file"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADVALUE_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTCLOSEFILE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* FPHDF5 errors */ -assert(H5E_CANTMAKETREE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't create a binary tree node"))==NULL) +assert(H5E_NOTHDF5_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Not an HDF5 file"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTMAKETREE_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_NOTHDF5_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTRECV_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't receive messages from processes"))==NULL) +assert(H5E_BADFILE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad file ID accessed"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTRECV_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_BADFILE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTSENDMDATA_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't send metadata message"))==NULL) +assert(H5E_TRUNCATED_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "File has been truncated"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTSENDMDATA_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_TRUNCATED_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTCHANGE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't register change with server"))==NULL) +assert(H5E_MOUNT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "File mount error"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCHANGE_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_MOUNT_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTALLOC_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't allocate from file"))==NULL) + +/* Resource errors */ +assert(H5E_NOSPACE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "No space available for allocation"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTALLOC_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_NOSPACE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* I/O pipeline errors */ -assert(H5E_NOFILTER_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Requested filter is not available"))==NULL) +assert(H5E_CANTCOPY_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to copy object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOFILTER_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTCOPY_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CALLBACK_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Callback failed"))==NULL) +assert(H5E_CANTFREE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to free object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CALLBACK_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTFREE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANAPPLY_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Error from filter 'can apply' callback"))==NULL) +assert(H5E_ALREADYEXISTS_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Object already exists"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANAPPLY_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_ALREADYEXISTS_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_SETLOCAL_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Error from filter 'set local' callback"))==NULL) +assert(H5E_CANTLOCK_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to lock object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SETLOCAL_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTLOCK_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Datatype conversion errors */ -assert(H5E_CANTCONVERT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't convert datatypes"))==NULL) +assert(H5E_CANTUNLOCK_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to unlock object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCONVERT_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTUNLOCK_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADSIZE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad size for object"))==NULL) +assert(H5E_CANTGC_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to garbage collect"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADSIZE_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTGC_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* Parallel MPI errors */ @@ -345,100 +405,97 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "MPI Error String"))==NULL) if((H5E_MPIERRSTR_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -/* Object header related errors */ -assert(H5E_LINKCOUNT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad object header link count"))==NULL) +/* Dataspace errors */ +assert(H5E_CANTCLIP_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't clip hyperslab region"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_LINKCOUNT_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTCLIP_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_VERSION_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Wrong version number"))==NULL) +assert(H5E_CANTCOUNT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't count elements"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_VERSION_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTCOUNT_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_ALIGNMENT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Alignment error"))==NULL) +assert(H5E_CANTSELECT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't select hyperslab"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ALIGNMENT_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTSELECT_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADMESG_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unrecognized message"))==NULL) +assert(H5E_CANTNEXT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't move to next iterator location"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADMESG_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTNEXT_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTDELETE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't delete message"))==NULL) +assert(H5E_BADSELECT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Invalid selection"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTDELETE_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_BADSELECT_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Resource errors */ -assert(H5E_NOSPACE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "No space available for allocation"))==NULL) +assert(H5E_CANTCOMPARE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't compare objects"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOSPACE_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTCOMPARE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTCOPY_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to copy object"))==NULL) + +/* Function entry/exit interface errors */ +assert(H5E_CANTINIT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to initialize object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCOPY_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTINIT_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTFREE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to free object"))==NULL) +assert(H5E_ALREADYINIT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Object already initialized"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTFREE_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_ALREADYINIT_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_ALREADYEXISTS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Object already exists"))==NULL) +assert(H5E_CANTRELEASE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to release object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ALREADYEXISTS_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTRELEASE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTLOCK_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to lock object"))==NULL) + +/* Property list errors */ +assert(H5E_CANTGET_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't get value"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTLOCK_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTGET_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTUNLOCK_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to unlock object"))==NULL) +assert(H5E_CANTSET_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't set value"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTUNLOCK_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTSET_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTGC_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to garbage collect"))==NULL) +assert(H5E_DUPCLASS_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Duplicate class name in parent class"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTGC_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_DUPCLASS_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -/* Generic low-level file I/O errors */ -assert(H5E_SEEKERROR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Seek failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SEEKERROR_g = H5I_register(H5I_ERROR_MSG, msg))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_READERROR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Read failed"))==NULL) +/* Argument errors */ +assert(H5E_UNINITIALIZED_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Information is uinitialized"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_READERROR_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_UNINITIALIZED_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_WRITEERROR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Write failed"))==NULL) +assert(H5E_UNSUPPORTED_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Feature is unsupported"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_WRITEERROR_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_UNSUPPORTED_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CLOSEERROR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Close failed"))==NULL) +assert(H5E_BADTYPE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Inappropriate type"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CLOSEERROR_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_BADTYPE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_OVERFLOW_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Address overflowed"))==NULL) +assert(H5E_BADRANGE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Out of range"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_OVERFLOW_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_BADRANGE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_FCNTL_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "File control (fcntl) failed"))==NULL) +assert(H5E_BADVALUE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad value"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FCNTL_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_BADVALUE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* B-tree related errors */ @@ -478,122 +535,70 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to list node"))==NULL) if((H5E_CANTLIST_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -/* File accessability errors */ -assert(H5E_FILEEXISTS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "File already exists"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FILEEXISTS_g = H5I_register(H5I_ERROR_MSG, msg))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_FILEOPEN_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "File already open"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FILEOPEN_g = H5I_register(H5I_ERROR_MSG, msg))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTCREATE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to create file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCREATE_g = H5I_register(H5I_ERROR_MSG, msg))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTOPENFILE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to open file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTOPENFILE_g = H5I_register(H5I_ERROR_MSG, msg))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTCLOSEFILE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to close file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCLOSEFILE_g = H5I_register(H5I_ERROR_MSG, msg))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_NOTHDF5_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Not an HDF5 file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOTHDF5_g = H5I_register(H5I_ERROR_MSG, msg))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADFILE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad file ID accessed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADFILE_g = H5I_register(H5I_ERROR_MSG, msg))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_TRUNCATED_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "File has been truncated"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_TRUNCATED_g = H5I_register(H5I_ERROR_MSG, msg))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_MOUNT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "File mount error"))==NULL) +/* Object header related errors */ +assert(H5E_LINKCOUNT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad object header link count"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_MOUNT_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_LINKCOUNT_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Cache related errors */ -assert(H5E_CANTFLUSH_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to flush data from cache"))==NULL) +assert(H5E_VERSION_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Wrong version number"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTFLUSH_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_VERSION_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTLOAD_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to load metadata into cache"))==NULL) +assert(H5E_ALIGNMENT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Alignment error"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTLOAD_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_ALIGNMENT_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_PROTECT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Protected metadata error"))==NULL) +assert(H5E_BADMESG_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unrecognized message"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_PROTECT_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_BADMESG_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_NOTCACHED_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Metadata not currently cached"))==NULL) +assert(H5E_CANTDELETE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't delete message"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOTCACHED_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTDELETE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -/* Group related errors */ -assert(H5E_CANTOPENOBJ_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't open object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTOPENOBJ_g = H5I_register(H5I_ERROR_MSG, msg))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTCLOSEOBJ_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't close object"))==NULL) +/* FPHDF5 errors */ +assert(H5E_CANTMAKETREE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't create a binary tree node"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCLOSEOBJ_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTMAKETREE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_COMPLEN_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Name component is too long"))==NULL) +assert(H5E_CANTRECV_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't receive messages from processes"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_COMPLEN_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTRECV_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CWG_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Problem with current working group"))==NULL) +assert(H5E_CANTSENDMDATA_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't send metadata message"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CWG_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTSENDMDATA_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_LINK_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Link count failure"))==NULL) +assert(H5E_CANTCHANGE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't register change with server"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_LINK_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTCHANGE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_SLINK_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Symbolic link error"))==NULL) +assert(H5E_CANTALLOC_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't allocate from file"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SLINK_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTALLOC_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -/* Function entry/exit interface errors */ -assert(H5E_CANTINIT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to initialize object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTINIT_g = H5I_register(H5I_ERROR_MSG, msg))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_ALREADYINIT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Object already initialized"))==NULL) +/* Datatype conversion errors */ +assert(H5E_CANTCONVERT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't convert datatypes"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ALREADYINIT_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_CANTCONVERT_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTRELEASE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to release object"))==NULL) +assert(H5E_BADSIZE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad size for object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTRELEASE_g = H5I_register(H5I_ERROR_MSG, msg))<0) +if((H5E_BADSIZE_g = H5I_register(H5I_ERROR_MSG, msg))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") #endif /* H5Einit_H */ diff --git a/src/H5Epubgen.h b/src/H5Epubgen.h index f01ce3d..d8d53e0 100644 --- a/src/H5Epubgen.h +++ b/src/H5Epubgen.h @@ -23,125 +23,65 @@ /* Major error codes */ /*********************/ -#define H5E_BTREE (H5OPEN H5E_BTREE_g) -#define H5E_EFL (H5OPEN H5E_EFL_g) -#define H5E_REFERENCE (H5OPEN H5E_REFERENCE_g) -#define H5E_FPHDF5 (H5OPEN H5E_FPHDF5_g) -#define H5E_INTERNAL (H5OPEN H5E_INTERNAL_g) -#define H5E_ERROR (H5OPEN H5E_ERROR_g) #define H5E_DATASET (H5OPEN H5E_DATASET_g) -#define H5E_ATOM (H5OPEN H5E_ATOM_g) -#define H5E_TBBT (H5OPEN H5E_TBBT_g) -#define H5E_OHDR (H5OPEN H5E_OHDR_g) +#define H5E_FUNC (H5OPEN H5E_FUNC_g) #define H5E_STORAGE (H5OPEN H5E_STORAGE_g) #define H5E_FILE (H5OPEN H5E_FILE_g) -#define H5E_RS (H5OPEN H5E_RS_g) -#define H5E_DATATYPE (H5OPEN H5E_DATATYPE_g) -#define H5E_TST (H5OPEN H5E_TST_g) -#define H5E_RESOURCE (H5OPEN H5E_RESOURCE_g) -#define H5E_CACHE (H5OPEN H5E_CACHE_g) +#define H5E_FPHDF5 (H5OPEN H5E_FPHDF5_g) #define H5E_SYM (H5OPEN H5E_SYM_g) -#define H5E_FUNC (H5OPEN H5E_FUNC_g) #define H5E_VFL (H5OPEN H5E_VFL_g) +#define H5E_INTERNAL (H5OPEN H5E_INTERNAL_g) +#define H5E_BTREE (H5OPEN H5E_BTREE_g) +#define H5E_REFERENCE (H5OPEN H5E_REFERENCE_g) +#define H5E_DATASPACE (H5OPEN H5E_DATASPACE_g) +#define H5E_RESOURCE (H5OPEN H5E_RESOURCE_g) #define H5E_PLIST (H5OPEN H5E_PLIST_g) +#define H5E_DATATYPE (H5OPEN H5E_DATATYPE_g) +#define H5E_RS (H5OPEN H5E_RS_g) +#define H5E_HEAP (H5OPEN H5E_HEAP_g) +#define H5E_OHDR (H5OPEN H5E_OHDR_g) +#define H5E_TBBT (H5OPEN H5E_TBBT_g) +#define H5E_ATOM (H5OPEN H5E_ATOM_g) #define H5E_ATTR (H5OPEN H5E_ATTR_g) #define H5E_IO (H5OPEN H5E_IO_g) +#define H5E_EFL (H5OPEN H5E_EFL_g) +#define H5E_TST (H5OPEN H5E_TST_g) #define H5E_ARGS (H5OPEN H5E_ARGS_g) -#define H5E_DATASPACE (H5OPEN H5E_DATASPACE_g) +#define H5E_ERROR (H5OPEN H5E_ERROR_g) #define H5E_PLINE (H5OPEN H5E_PLINE_g) -#define H5E_HEAP (H5OPEN H5E_HEAP_g) -H5_DLLVAR hid_t H5E_BTREE_g; /* B-Tree node */ -H5_DLLVAR hid_t H5E_EFL_g; /* External file list */ -H5_DLLVAR hid_t H5E_REFERENCE_g; /* References */ -H5_DLLVAR hid_t H5E_FPHDF5_g; /* Flexible Parallel HDF5 */ -H5_DLLVAR hid_t H5E_INTERNAL_g; /* Internal error (too specific to document in detail) */ -H5_DLLVAR hid_t H5E_ERROR_g; /* Error API */ +#define H5E_CACHE (H5OPEN H5E_CACHE_g) H5_DLLVAR hid_t H5E_DATASET_g; /* Dataset */ -H5_DLLVAR hid_t H5E_ATOM_g; /* Object atom */ -H5_DLLVAR hid_t H5E_TBBT_g; /* Threaded, Balanced, Binary Trees */ -H5_DLLVAR hid_t H5E_OHDR_g; /* Object header */ +H5_DLLVAR hid_t H5E_FUNC_g; /* Function entry/exit */ H5_DLLVAR hid_t H5E_STORAGE_g; /* Data storage */ H5_DLLVAR hid_t H5E_FILE_g; /* File accessability */ -H5_DLLVAR hid_t H5E_RS_g; /* Reference Counted Strings */ -H5_DLLVAR hid_t H5E_DATATYPE_g; /* Datatype */ -H5_DLLVAR hid_t H5E_TST_g; /* Ternary Search Trees */ -H5_DLLVAR hid_t H5E_RESOURCE_g; /* Resource unavailable */ -H5_DLLVAR hid_t H5E_CACHE_g; /* Object cache */ +H5_DLLVAR hid_t H5E_FPHDF5_g; /* Flexible Parallel HDF5 */ H5_DLLVAR hid_t H5E_SYM_g; /* Symbol table */ -H5_DLLVAR hid_t H5E_FUNC_g; /* Function entry/exit */ H5_DLLVAR hid_t H5E_VFL_g; /* Virtual File Layer */ +H5_DLLVAR hid_t H5E_INTERNAL_g; /* Internal error (too specific to document in detail) */ +H5_DLLVAR hid_t H5E_BTREE_g; /* B-Tree node */ +H5_DLLVAR hid_t H5E_REFERENCE_g; /* References */ +H5_DLLVAR hid_t H5E_DATASPACE_g; /* Dataspace */ +H5_DLLVAR hid_t H5E_RESOURCE_g; /* Resource unavailable */ H5_DLLVAR hid_t H5E_PLIST_g; /* Property lists */ +H5_DLLVAR hid_t H5E_DATATYPE_g; /* Datatype */ +H5_DLLVAR hid_t H5E_RS_g; /* Reference Counted Strings */ +H5_DLLVAR hid_t H5E_HEAP_g; /* Heap */ +H5_DLLVAR hid_t H5E_OHDR_g; /* Object header */ +H5_DLLVAR hid_t H5E_TBBT_g; /* Threaded, Balanced, Binary Trees */ +H5_DLLVAR hid_t H5E_ATOM_g; /* Object atom */ H5_DLLVAR hid_t H5E_ATTR_g; /* Attribute */ H5_DLLVAR hid_t H5E_IO_g; /* Low-level I/O */ +H5_DLLVAR hid_t H5E_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_DATASPACE_g; /* Dataspace */ +H5_DLLVAR hid_t H5E_ERROR_g; /* Error API */ H5_DLLVAR hid_t H5E_PLINE_g; /* Data filters */ -H5_DLLVAR hid_t H5E_HEAP_g; /* Heap */ +H5_DLLVAR hid_t H5E_CACHE_g; /* Object cache */ /*********************/ /* Minor error codes */ /*********************/ -/* Property list errors */ -#define H5E_CANTGET (H5OPEN H5E_CANTGET_g) -#define H5E_CANTSET (H5OPEN H5E_CANTSET_g) -#define H5E_DUPCLASS (H5OPEN H5E_DUPCLASS_g) -H5_DLLVAR hid_t H5E_CANTGET_g; /* Can't get value */ -H5_DLLVAR hid_t H5E_CANTSET_g; /* Can't set value */ -H5_DLLVAR hid_t H5E_DUPCLASS_g; /* Duplicate class name in parent class */ - -/* Dataspace errors */ -#define H5E_CANTCLIP (H5OPEN H5E_CANTCLIP_g) -#define H5E_CANTCOUNT (H5OPEN H5E_CANTCOUNT_g) -#define H5E_CANTSELECT (H5OPEN H5E_CANTSELECT_g) -#define H5E_CANTNEXT (H5OPEN H5E_CANTNEXT_g) -#define H5E_BADSELECT (H5OPEN H5E_BADSELECT_g) -#define H5E_CANTCOMPARE (H5OPEN H5E_CANTCOMPARE_g) -H5_DLLVAR hid_t H5E_CANTCLIP_g; /* Can't clip hyperslab region */ -H5_DLLVAR hid_t H5E_CANTCOUNT_g; /* Can't count elements */ -H5_DLLVAR hid_t H5E_CANTSELECT_g; /* Can't select hyperslab */ -H5_DLLVAR hid_t H5E_CANTNEXT_g; /* Can't move to next iterator location */ -H5_DLLVAR hid_t H5E_BADSELECT_g; /* Invalid selection */ -H5_DLLVAR hid_t H5E_CANTCOMPARE_g; /* Can't compare objects */ - -/* Object atom related errors */ -#define H5E_BADATOM (H5OPEN H5E_BADATOM_g) -#define H5E_BADGROUP (H5OPEN H5E_BADGROUP_g) -#define H5E_CANTREGISTER (H5OPEN H5E_CANTREGISTER_g) -#define H5E_CANTINC (H5OPEN H5E_CANTINC_g) -#define H5E_CANTDEC (H5OPEN H5E_CANTDEC_g) -#define H5E_NOIDS (H5OPEN H5E_NOIDS_g) -H5_DLLVAR hid_t H5E_BADATOM_g; /* Unable to find atom information (already closed?) */ -H5_DLLVAR hid_t H5E_BADGROUP_g; /* Unable to find ID group information */ -H5_DLLVAR hid_t H5E_CANTREGISTER_g; /* Unable to register new atom */ -H5_DLLVAR hid_t H5E_CANTINC_g; /* Unable to increment reference count */ -H5_DLLVAR hid_t H5E_CANTDEC_g; /* Unable to decrement reference count */ -H5_DLLVAR hid_t H5E_NOIDS_g; /* Out of IDs for group */ - -/* Argument errors */ -#define H5E_UNINITIALIZED (H5OPEN H5E_UNINITIALIZED_g) -#define H5E_UNSUPPORTED (H5OPEN H5E_UNSUPPORTED_g) -#define H5E_BADTYPE (H5OPEN H5E_BADTYPE_g) -#define H5E_BADRANGE (H5OPEN H5E_BADRANGE_g) -#define H5E_BADVALUE (H5OPEN H5E_BADVALUE_g) -H5_DLLVAR hid_t H5E_UNINITIALIZED_g;/* Information is uinitialized */ -H5_DLLVAR hid_t H5E_UNSUPPORTED_g; /* Feature is unsupported */ -H5_DLLVAR hid_t H5E_BADTYPE_g; /* Inappropriate type */ -H5_DLLVAR hid_t H5E_BADRANGE_g; /* Out of range */ -H5_DLLVAR hid_t H5E_BADVALUE_g; /* Bad value */ - -/* FPHDF5 errors */ -#define H5E_CANTMAKETREE (H5OPEN H5E_CANTMAKETREE_g) -#define H5E_CANTRECV (H5OPEN H5E_CANTRECV_g) -#define H5E_CANTSENDMDATA (H5OPEN H5E_CANTSENDMDATA_g) -#define H5E_CANTCHANGE (H5OPEN H5E_CANTCHANGE_g) -#define H5E_CANTALLOC (H5OPEN H5E_CANTALLOC_g) -H5_DLLVAR hid_t H5E_CANTMAKETREE_g; /* Can't create a binary tree node */ -H5_DLLVAR hid_t H5E_CANTRECV_g; /* Can't receive messages from processes */ -H5_DLLVAR hid_t H5E_CANTSENDMDATA_g;/* Can't send metadata message */ -H5_DLLVAR hid_t H5E_CANTCHANGE_g; /* Can't register change with server */ -H5_DLLVAR hid_t H5E_CANTALLOC_g; /* Can't allocate from file */ - /* I/O pipeline errors */ #define H5E_NOFILTER (H5OPEN H5E_NOFILTER_g) #define H5E_CALLBACK (H5OPEN H5E_CALLBACK_g) @@ -152,46 +92,6 @@ H5_DLLVAR hid_t H5E_CALLBACK_g; /* Callback failed */ H5_DLLVAR hid_t H5E_CANAPPLY_g; /* Error from filter 'can apply' callback */ H5_DLLVAR hid_t H5E_SETLOCAL_g; /* Error from filter 'set local' callback */ -/* Datatype conversion errors */ -#define H5E_CANTCONVERT (H5OPEN H5E_CANTCONVERT_g) -#define H5E_BADSIZE (H5OPEN H5E_BADSIZE_g) -H5_DLLVAR hid_t H5E_CANTCONVERT_g; /* Can't convert datatypes */ -H5_DLLVAR hid_t H5E_BADSIZE_g; /* Bad size for object */ - -/* Parallel MPI errors */ -#define H5E_MPI (H5OPEN H5E_MPI_g) -#define H5E_MPIERRSTR (H5OPEN H5E_MPIERRSTR_g) -H5_DLLVAR hid_t H5E_MPI_g; /* Some MPI function failed */ -H5_DLLVAR hid_t H5E_MPIERRSTR_g; /* MPI Error String */ - -/* Object header related errors */ -#define H5E_LINKCOUNT (H5OPEN H5E_LINKCOUNT_g) -#define H5E_VERSION (H5OPEN H5E_VERSION_g) -#define H5E_ALIGNMENT (H5OPEN H5E_ALIGNMENT_g) -#define H5E_BADMESG (H5OPEN H5E_BADMESG_g) -#define H5E_CANTDELETE (H5OPEN H5E_CANTDELETE_g) -H5_DLLVAR hid_t H5E_LINKCOUNT_g; /* Bad object header link count */ -H5_DLLVAR hid_t H5E_VERSION_g; /* Wrong version number */ -H5_DLLVAR hid_t H5E_ALIGNMENT_g; /* Alignment error */ -H5_DLLVAR hid_t H5E_BADMESG_g; /* Unrecognized message */ -H5_DLLVAR hid_t H5E_CANTDELETE_g; /* Can't delete message */ - -/* Resource errors */ -#define H5E_NOSPACE (H5OPEN H5E_NOSPACE_g) -#define H5E_CANTCOPY (H5OPEN H5E_CANTCOPY_g) -#define H5E_CANTFREE (H5OPEN H5E_CANTFREE_g) -#define H5E_ALREADYEXISTS (H5OPEN H5E_ALREADYEXISTS_g) -#define H5E_CANTLOCK (H5OPEN H5E_CANTLOCK_g) -#define H5E_CANTUNLOCK (H5OPEN H5E_CANTUNLOCK_g) -#define H5E_CANTGC (H5OPEN H5E_CANTGC_g) -H5_DLLVAR hid_t H5E_NOSPACE_g; /* No space available for allocation */ -H5_DLLVAR hid_t H5E_CANTCOPY_g; /* Unable to copy object */ -H5_DLLVAR hid_t H5E_CANTFREE_g; /* Unable to free object */ -H5_DLLVAR hid_t H5E_ALREADYEXISTS_g;/* Object already exists */ -H5_DLLVAR hid_t H5E_CANTLOCK_g; /* Unable to lock object */ -H5_DLLVAR hid_t H5E_CANTUNLOCK_g; /* Unable to unlock object */ -H5_DLLVAR hid_t H5E_CANTGC_g; /* Unable to garbage collect */ - /* Generic low-level file I/O errors */ #define H5E_SEEKERROR (H5OPEN H5E_SEEKERROR_g) #define H5E_READERROR (H5OPEN H5E_READERROR_g) @@ -206,21 +106,45 @@ H5_DLLVAR hid_t H5E_CLOSEERROR_g; /* Close failed */ H5_DLLVAR hid_t H5E_OVERFLOW_g; /* Address overflowed */ H5_DLLVAR hid_t H5E_FCNTL_g; /* File control (fcntl) failed */ -/* B-tree related errors */ -#define H5E_NOTFOUND (H5OPEN H5E_NOTFOUND_g) -#define H5E_EXISTS (H5OPEN H5E_EXISTS_g) -#define H5E_CANTENCODE (H5OPEN H5E_CANTENCODE_g) -#define H5E_CANTDECODE (H5OPEN H5E_CANTDECODE_g) -#define H5E_CANTSPLIT (H5OPEN H5E_CANTSPLIT_g) -#define H5E_CANTINSERT (H5OPEN H5E_CANTINSERT_g) -#define H5E_CANTLIST (H5OPEN H5E_CANTLIST_g) -H5_DLLVAR hid_t H5E_NOTFOUND_g; /* Object not found */ -H5_DLLVAR hid_t H5E_EXISTS_g; /* Object already exists */ -H5_DLLVAR hid_t H5E_CANTENCODE_g; /* Unable to encode value */ -H5_DLLVAR hid_t H5E_CANTDECODE_g; /* Unable to decode value */ -H5_DLLVAR hid_t H5E_CANTSPLIT_g; /* Unable to split node */ -H5_DLLVAR hid_t H5E_CANTINSERT_g; /* Unable to insert object */ -H5_DLLVAR hid_t H5E_CANTLIST_g; /* Unable to list node */ +/* Group related errors */ +#define H5E_CANTOPENOBJ (H5OPEN H5E_CANTOPENOBJ_g) +#define H5E_CANTCLOSEOBJ (H5OPEN H5E_CANTCLOSEOBJ_g) +#define H5E_COMPLEN (H5OPEN H5E_COMPLEN_g) +#define H5E_CWG (H5OPEN H5E_CWG_g) +#define H5E_LINK (H5OPEN H5E_LINK_g) +#define H5E_SLINK (H5OPEN H5E_SLINK_g) +H5_DLLVAR hid_t H5E_CANTOPENOBJ_g; /* Can't open object */ +H5_DLLVAR hid_t H5E_CANTCLOSEOBJ_g; /* Can't close object */ +H5_DLLVAR hid_t H5E_COMPLEN_g; /* Name component is too long */ +H5_DLLVAR hid_t H5E_CWG_g; /* Problem with current working group */ +H5_DLLVAR hid_t H5E_LINK_g; /* Link count failure */ +H5_DLLVAR hid_t H5E_SLINK_g; /* Symbolic link error */ + +/* Cache related errors */ +#define H5E_CANTFLUSH (H5OPEN H5E_CANTFLUSH_g) +#define H5E_CANTSERIALIZE (H5OPEN H5E_CANTSERIALIZE_g) +#define H5E_CANTLOAD (H5OPEN H5E_CANTLOAD_g) +#define H5E_PROTECT (H5OPEN H5E_PROTECT_g) +#define H5E_NOTCACHED (H5OPEN H5E_NOTCACHED_g) +H5_DLLVAR hid_t H5E_CANTFLUSH_g; /* Unable to flush data from cache */ +H5_DLLVAR hid_t H5E_CANTSERIALIZE_g;/* Unable to serialize data from cache */ +H5_DLLVAR hid_t H5E_CANTLOAD_g; /* Unable to load metadata into cache */ +H5_DLLVAR hid_t H5E_PROTECT_g; /* Protected metadata error */ +H5_DLLVAR hid_t H5E_NOTCACHED_g; /* Metadata not currently cached */ + +/* Object atom related errors */ +#define H5E_BADATOM (H5OPEN H5E_BADATOM_g) +#define H5E_BADGROUP (H5OPEN H5E_BADGROUP_g) +#define H5E_CANTREGISTER (H5OPEN H5E_CANTREGISTER_g) +#define H5E_CANTINC (H5OPEN H5E_CANTINC_g) +#define H5E_CANTDEC (H5OPEN H5E_CANTDEC_g) +#define H5E_NOIDS (H5OPEN H5E_NOIDS_g) +H5_DLLVAR hid_t H5E_BADATOM_g; /* Unable to find atom information (already closed?) */ +H5_DLLVAR hid_t H5E_BADGROUP_g; /* Unable to find ID group information */ +H5_DLLVAR hid_t H5E_CANTREGISTER_g; /* Unable to register new atom */ +H5_DLLVAR hid_t H5E_CANTINC_g; /* Unable to increment reference count */ +H5_DLLVAR hid_t H5E_CANTDEC_g; /* Unable to decrement reference count */ +H5_DLLVAR hid_t H5E_NOIDS_g; /* Out of IDs for group */ /* File accessability errors */ #define H5E_FILEEXISTS (H5OPEN H5E_FILEEXISTS_g) @@ -242,29 +166,41 @@ H5_DLLVAR hid_t H5E_BADFILE_g; /* Bad file ID accessed */ H5_DLLVAR hid_t H5E_TRUNCATED_g; /* File has been truncated */ H5_DLLVAR hid_t H5E_MOUNT_g; /* File mount error */ -/* Cache related errors */ -#define H5E_CANTFLUSH (H5OPEN H5E_CANTFLUSH_g) -#define H5E_CANTLOAD (H5OPEN H5E_CANTLOAD_g) -#define H5E_PROTECT (H5OPEN H5E_PROTECT_g) -#define H5E_NOTCACHED (H5OPEN H5E_NOTCACHED_g) -H5_DLLVAR hid_t H5E_CANTFLUSH_g; /* Unable to flush data from cache */ -H5_DLLVAR hid_t H5E_CANTLOAD_g; /* Unable to load metadata into cache */ -H5_DLLVAR hid_t H5E_PROTECT_g; /* Protected metadata error */ -H5_DLLVAR hid_t H5E_NOTCACHED_g; /* Metadata not currently cached */ +/* Resource errors */ +#define H5E_NOSPACE (H5OPEN H5E_NOSPACE_g) +#define H5E_CANTCOPY (H5OPEN H5E_CANTCOPY_g) +#define H5E_CANTFREE (H5OPEN H5E_CANTFREE_g) +#define H5E_ALREADYEXISTS (H5OPEN H5E_ALREADYEXISTS_g) +#define H5E_CANTLOCK (H5OPEN H5E_CANTLOCK_g) +#define H5E_CANTUNLOCK (H5OPEN H5E_CANTUNLOCK_g) +#define H5E_CANTGC (H5OPEN H5E_CANTGC_g) +H5_DLLVAR hid_t H5E_NOSPACE_g; /* No space available for allocation */ +H5_DLLVAR hid_t H5E_CANTCOPY_g; /* Unable to copy object */ +H5_DLLVAR hid_t H5E_CANTFREE_g; /* Unable to free object */ +H5_DLLVAR hid_t H5E_ALREADYEXISTS_g;/* Object already exists */ +H5_DLLVAR hid_t H5E_CANTLOCK_g; /* Unable to lock object */ +H5_DLLVAR hid_t H5E_CANTUNLOCK_g; /* Unable to unlock object */ +H5_DLLVAR hid_t H5E_CANTGC_g; /* Unable to garbage collect */ -/* Group related errors */ -#define H5E_CANTOPENOBJ (H5OPEN H5E_CANTOPENOBJ_g) -#define H5E_CANTCLOSEOBJ (H5OPEN H5E_CANTCLOSEOBJ_g) -#define H5E_COMPLEN (H5OPEN H5E_COMPLEN_g) -#define H5E_CWG (H5OPEN H5E_CWG_g) -#define H5E_LINK (H5OPEN H5E_LINK_g) -#define H5E_SLINK (H5OPEN H5E_SLINK_g) -H5_DLLVAR hid_t H5E_CANTOPENOBJ_g; /* Can't open object */ -H5_DLLVAR hid_t H5E_CANTCLOSEOBJ_g; /* Can't close object */ -H5_DLLVAR hid_t H5E_COMPLEN_g; /* Name component is too long */ -H5_DLLVAR hid_t H5E_CWG_g; /* Problem with current working group */ -H5_DLLVAR hid_t H5E_LINK_g; /* Link count failure */ -H5_DLLVAR hid_t H5E_SLINK_g; /* Symbolic link error */ +/* Parallel MPI errors */ +#define H5E_MPI (H5OPEN H5E_MPI_g) +#define H5E_MPIERRSTR (H5OPEN H5E_MPIERRSTR_g) +H5_DLLVAR hid_t H5E_MPI_g; /* Some MPI function failed */ +H5_DLLVAR hid_t H5E_MPIERRSTR_g; /* MPI Error String */ + +/* Dataspace errors */ +#define H5E_CANTCLIP (H5OPEN H5E_CANTCLIP_g) +#define H5E_CANTCOUNT (H5OPEN H5E_CANTCOUNT_g) +#define H5E_CANTSELECT (H5OPEN H5E_CANTSELECT_g) +#define H5E_CANTNEXT (H5OPEN H5E_CANTNEXT_g) +#define H5E_BADSELECT (H5OPEN H5E_BADSELECT_g) +#define H5E_CANTCOMPARE (H5OPEN H5E_CANTCOMPARE_g) +H5_DLLVAR hid_t H5E_CANTCLIP_g; /* Can't clip hyperslab region */ +H5_DLLVAR hid_t H5E_CANTCOUNT_g; /* Can't count elements */ +H5_DLLVAR hid_t H5E_CANTSELECT_g; /* Can't select hyperslab */ +H5_DLLVAR hid_t H5E_CANTNEXT_g; /* Can't move to next iterator location */ +H5_DLLVAR hid_t H5E_BADSELECT_g; /* Invalid selection */ +H5_DLLVAR hid_t H5E_CANTCOMPARE_g; /* Can't compare objects */ /* Function entry/exit interface errors */ #define H5E_CANTINIT (H5OPEN H5E_CANTINIT_g) @@ -274,4 +210,70 @@ H5_DLLVAR hid_t H5E_CANTINIT_g; /* Unable to initialize object */ H5_DLLVAR hid_t H5E_ALREADYINIT_g; /* Object already initialized */ H5_DLLVAR hid_t H5E_CANTRELEASE_g; /* Unable to release object */ +/* Property list errors */ +#define H5E_CANTGET (H5OPEN H5E_CANTGET_g) +#define H5E_CANTSET (H5OPEN H5E_CANTSET_g) +#define H5E_DUPCLASS (H5OPEN H5E_DUPCLASS_g) +H5_DLLVAR hid_t H5E_CANTGET_g; /* Can't get value */ +H5_DLLVAR hid_t H5E_CANTSET_g; /* Can't set value */ +H5_DLLVAR hid_t H5E_DUPCLASS_g; /* Duplicate class name in parent class */ + +/* Argument errors */ +#define H5E_UNINITIALIZED (H5OPEN H5E_UNINITIALIZED_g) +#define H5E_UNSUPPORTED (H5OPEN H5E_UNSUPPORTED_g) +#define H5E_BADTYPE (H5OPEN H5E_BADTYPE_g) +#define H5E_BADRANGE (H5OPEN H5E_BADRANGE_g) +#define H5E_BADVALUE (H5OPEN H5E_BADVALUE_g) +H5_DLLVAR hid_t H5E_UNINITIALIZED_g;/* Information is uinitialized */ +H5_DLLVAR hid_t H5E_UNSUPPORTED_g; /* Feature is unsupported */ +H5_DLLVAR hid_t H5E_BADTYPE_g; /* Inappropriate type */ +H5_DLLVAR hid_t H5E_BADRANGE_g; /* Out of range */ +H5_DLLVAR hid_t H5E_BADVALUE_g; /* Bad value */ + +/* B-tree related errors */ +#define H5E_NOTFOUND (H5OPEN H5E_NOTFOUND_g) +#define H5E_EXISTS (H5OPEN H5E_EXISTS_g) +#define H5E_CANTENCODE (H5OPEN H5E_CANTENCODE_g) +#define H5E_CANTDECODE (H5OPEN H5E_CANTDECODE_g) +#define H5E_CANTSPLIT (H5OPEN H5E_CANTSPLIT_g) +#define H5E_CANTINSERT (H5OPEN H5E_CANTINSERT_g) +#define H5E_CANTLIST (H5OPEN H5E_CANTLIST_g) +H5_DLLVAR hid_t H5E_NOTFOUND_g; /* Object not found */ +H5_DLLVAR hid_t H5E_EXISTS_g; /* Object already exists */ +H5_DLLVAR hid_t H5E_CANTENCODE_g; /* Unable to encode value */ +H5_DLLVAR hid_t H5E_CANTDECODE_g; /* Unable to decode value */ +H5_DLLVAR hid_t H5E_CANTSPLIT_g; /* Unable to split node */ +H5_DLLVAR hid_t H5E_CANTINSERT_g; /* Unable to insert object */ +H5_DLLVAR hid_t H5E_CANTLIST_g; /* Unable to list node */ + +/* Object header related errors */ +#define H5E_LINKCOUNT (H5OPEN H5E_LINKCOUNT_g) +#define H5E_VERSION (H5OPEN H5E_VERSION_g) +#define H5E_ALIGNMENT (H5OPEN H5E_ALIGNMENT_g) +#define H5E_BADMESG (H5OPEN H5E_BADMESG_g) +#define H5E_CANTDELETE (H5OPEN H5E_CANTDELETE_g) +H5_DLLVAR hid_t H5E_LINKCOUNT_g; /* Bad object header link count */ +H5_DLLVAR hid_t H5E_VERSION_g; /* Wrong version number */ +H5_DLLVAR hid_t H5E_ALIGNMENT_g; /* Alignment error */ +H5_DLLVAR hid_t H5E_BADMESG_g; /* Unrecognized message */ +H5_DLLVAR hid_t H5E_CANTDELETE_g; /* Can't delete message */ + +/* FPHDF5 errors */ +#define H5E_CANTMAKETREE (H5OPEN H5E_CANTMAKETREE_g) +#define H5E_CANTRECV (H5OPEN H5E_CANTRECV_g) +#define H5E_CANTSENDMDATA (H5OPEN H5E_CANTSENDMDATA_g) +#define H5E_CANTCHANGE (H5OPEN H5E_CANTCHANGE_g) +#define H5E_CANTALLOC (H5OPEN H5E_CANTALLOC_g) +H5_DLLVAR hid_t H5E_CANTMAKETREE_g; /* Can't create a binary tree node */ +H5_DLLVAR hid_t H5E_CANTRECV_g; /* Can't receive messages from processes */ +H5_DLLVAR hid_t H5E_CANTSENDMDATA_g;/* Can't send metadata message */ +H5_DLLVAR hid_t H5E_CANTCHANGE_g; /* Can't register change with server */ +H5_DLLVAR hid_t H5E_CANTALLOC_g; /* Can't allocate from file */ + +/* Datatype conversion errors */ +#define H5E_CANTCONVERT (H5OPEN H5E_CANTCONVERT_g) +#define H5E_BADSIZE (H5OPEN H5E_BADSIZE_g) +H5_DLLVAR hid_t H5E_CANTCONVERT_g; /* Can't convert datatypes */ +H5_DLLVAR hid_t H5E_BADSIZE_g; /* Bad size for object */ + #endif /* H5Epubgen_H */ diff --git a/src/H5Eterm.h b/src/H5Eterm.h index 3f77a1f..efb2043 100644 --- a/src/H5Eterm.h +++ b/src/H5Eterm.h @@ -21,49 +21,65 @@ /* Reset major error IDs */ -H5E_BTREE_g= -H5E_EFL_g= -H5E_REFERENCE_g= -H5E_FPHDF5_g= -H5E_INTERNAL_g= -H5E_ERROR_g= H5E_DATASET_g= -H5E_ATOM_g= -H5E_TBBT_g= -H5E_OHDR_g= +H5E_FUNC_g= H5E_STORAGE_g= H5E_FILE_g= -H5E_RS_g= -H5E_DATATYPE_g= -H5E_TST_g= -H5E_RESOURCE_g= -H5E_CACHE_g= +H5E_FPHDF5_g= H5E_SYM_g= -H5E_FUNC_g= H5E_VFL_g= +H5E_INTERNAL_g= +H5E_BTREE_g= +H5E_REFERENCE_g= +H5E_DATASPACE_g= +H5E_RESOURCE_g= H5E_PLIST_g= +H5E_DATATYPE_g= +H5E_RS_g= +H5E_HEAP_g= +H5E_OHDR_g= +H5E_TBBT_g= +H5E_ATOM_g= H5E_ATTR_g= H5E_IO_g= +H5E_EFL_g= +H5E_TST_g= H5E_ARGS_g= -H5E_DATASPACE_g= +H5E_ERROR_g= H5E_PLINE_g= -H5E_HEAP_g= (-1); +H5E_CACHE_g= (-1); /* Reset minor error IDs */ -/* Property list errors */ -H5E_CANTGET_g= -H5E_CANTSET_g= -H5E_DUPCLASS_g= +/* I/O pipeline errors */ +H5E_NOFILTER_g= +H5E_CALLBACK_g= +H5E_CANAPPLY_g= +H5E_SETLOCAL_g= -/* Dataspace errors */ -H5E_CANTCLIP_g= -H5E_CANTCOUNT_g= -H5E_CANTSELECT_g= -H5E_CANTNEXT_g= -H5E_BADSELECT_g= -H5E_CANTCOMPARE_g= +/* Generic low-level file I/O errors */ +H5E_SEEKERROR_g= +H5E_READERROR_g= +H5E_WRITEERROR_g= +H5E_CLOSEERROR_g= +H5E_OVERFLOW_g= +H5E_FCNTL_g= + +/* Group related errors */ +H5E_CANTOPENOBJ_g= +H5E_CANTCLOSEOBJ_g= +H5E_COMPLEN_g= +H5E_CWG_g= +H5E_LINK_g= +H5E_SLINK_g= + +/* Cache related errors */ +H5E_CANTFLUSH_g= +H5E_CANTSERIALIZE_g= +H5E_CANTLOAD_g= +H5E_PROTECT_g= +H5E_NOTCACHED_g= /* Object atom related errors */ H5E_BADATOM_g= @@ -73,40 +89,16 @@ H5E_CANTINC_g= H5E_CANTDEC_g= H5E_NOIDS_g= -/* Argument errors */ -H5E_UNINITIALIZED_g= -H5E_UNSUPPORTED_g= -H5E_BADTYPE_g= -H5E_BADRANGE_g= -H5E_BADVALUE_g= - -/* FPHDF5 errors */ -H5E_CANTMAKETREE_g= -H5E_CANTRECV_g= -H5E_CANTSENDMDATA_g= -H5E_CANTCHANGE_g= -H5E_CANTALLOC_g= - -/* I/O pipeline errors */ -H5E_NOFILTER_g= -H5E_CALLBACK_g= -H5E_CANAPPLY_g= -H5E_SETLOCAL_g= - -/* Datatype conversion errors */ -H5E_CANTCONVERT_g= -H5E_BADSIZE_g= - -/* Parallel MPI errors */ -H5E_MPI_g= -H5E_MPIERRSTR_g= - -/* Object header related errors */ -H5E_LINKCOUNT_g= -H5E_VERSION_g= -H5E_ALIGNMENT_g= -H5E_BADMESG_g= -H5E_CANTDELETE_g= +/* File accessability errors */ +H5E_FILEEXISTS_g= +H5E_FILEOPEN_g= +H5E_CANTCREATE_g= +H5E_CANTOPENFILE_g= +H5E_CANTCLOSEFILE_g= +H5E_NOTHDF5_g= +H5E_BADFILE_g= +H5E_TRUNCATED_g= +H5E_MOUNT_g= /* Resource errors */ H5E_NOSPACE_g= @@ -117,13 +109,34 @@ H5E_CANTLOCK_g= H5E_CANTUNLOCK_g= H5E_CANTGC_g= -/* Generic low-level file I/O errors */ -H5E_SEEKERROR_g= -H5E_READERROR_g= -H5E_WRITEERROR_g= -H5E_CLOSEERROR_g= -H5E_OVERFLOW_g= -H5E_FCNTL_g= +/* Parallel MPI errors */ +H5E_MPI_g= +H5E_MPIERRSTR_g= + +/* Dataspace errors */ +H5E_CANTCLIP_g= +H5E_CANTCOUNT_g= +H5E_CANTSELECT_g= +H5E_CANTNEXT_g= +H5E_BADSELECT_g= +H5E_CANTCOMPARE_g= + +/* Function entry/exit interface errors */ +H5E_CANTINIT_g= +H5E_ALREADYINIT_g= +H5E_CANTRELEASE_g= + +/* Property list errors */ +H5E_CANTGET_g= +H5E_CANTSET_g= +H5E_DUPCLASS_g= + +/* Argument errors */ +H5E_UNINITIALIZED_g= +H5E_UNSUPPORTED_g= +H5E_BADTYPE_g= +H5E_BADRANGE_g= +H5E_BADVALUE_g= /* B-tree related errors */ H5E_NOTFOUND_g= @@ -134,34 +147,22 @@ H5E_CANTSPLIT_g= H5E_CANTINSERT_g= H5E_CANTLIST_g= -/* File accessability errors */ -H5E_FILEEXISTS_g= -H5E_FILEOPEN_g= -H5E_CANTCREATE_g= -H5E_CANTOPENFILE_g= -H5E_CANTCLOSEFILE_g= -H5E_NOTHDF5_g= -H5E_BADFILE_g= -H5E_TRUNCATED_g= -H5E_MOUNT_g= - -/* Cache related errors */ -H5E_CANTFLUSH_g= -H5E_CANTLOAD_g= -H5E_PROTECT_g= -H5E_NOTCACHED_g= +/* Object header related errors */ +H5E_LINKCOUNT_g= +H5E_VERSION_g= +H5E_ALIGNMENT_g= +H5E_BADMESG_g= +H5E_CANTDELETE_g= -/* Group related errors */ -H5E_CANTOPENOBJ_g= -H5E_CANTCLOSEOBJ_g= -H5E_COMPLEN_g= -H5E_CWG_g= -H5E_LINK_g= -H5E_SLINK_g= +/* FPHDF5 errors */ +H5E_CANTMAKETREE_g= +H5E_CANTRECV_g= +H5E_CANTSENDMDATA_g= +H5E_CANTCHANGE_g= +H5E_CANTALLOC_g= -/* Function entry/exit interface errors */ -H5E_CANTINIT_g= -H5E_ALREADYINIT_g= -H5E_CANTRELEASE_g= (-1); +/* Datatype conversion errors */ +H5E_CANTCONVERT_g= +H5E_BADSIZE_g= (-1); #endif /* H5Eterm_H */ @@ -1795,6 +1795,8 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d hbool_t driver_has_cmp; /*`cmp' callback defined? */ H5P_genplist_t *a_plist; /*file access property list */ H5F_close_degree_t fc_degree; /*file close degree */ + uint8_t buf[256]; /*some buffer */ + int mrc; /*MPI return code */ H5F_t *ret_value = NULL; /*actual return value */ FUNC_ENTER_NOAPI(H5F_open, NULL) @@ -1923,38 +1925,49 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d * to create & write the superblock. */ #ifdef H5_HAVE_FPHDF5 - /* - * Psuedo-code for FPHDF5 should be something like this: - * if(captn) { - * H5F_init_superblock(...) - * H5G_mkroot(...,NULL) - * H5F_write_superblock(...,buf) - * } - * MPI_Bcast(...,captn,buf,...) - * if(!captn) { - * H5F_read_superblock(...,HADDR_UNDEF,buf) - * H5G_mkroot(...,&root_ret) - * } - */ + if (!H5FD_is_fphdf5_driver(lf) || H5FD_fphdf5_is_captain(lf)) { #endif /* H5_HAVE_FPHDF5 */ + /* Initialize information about the superblock and allocate space for it */ + if (H5F_init_superblock(file, dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to allocate file superblock") - /* Initialize information about the superblock and allocate space for it */ - if (H5F_init_superblock(file, dxpl_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to allocate file superblock") + /* Create and open the root group */ + /* (This must be after the space for the superblock is allocated in + * the file) + */ + if (H5G_mkroot(file, dxpl_id, NULL)<0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create/open root group") - /* Create and open the root group */ - /* (This must be after the space for the superblock is allocated in - * the file) - */ - if (H5G_mkroot(file, dxpl_id, NULL)<0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create/open root group") + /* Write the superblock to the file */ + /* (This must be after the root group is created, since the root + * group's symbol table entry is part of the superblock) + */ + if (H5F_write_superblock(file, dxpl_id, &buf[H5F_sizeof_addr(file)]) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to write file superblock") - /* Write the superblock to the file */ - /* (This must be after the root group is created, since the root - * group's symbol table entry is part of the superblock) - */ - if (H5F_write_superblock(file, dxpl_id, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to write file superblock") +#ifdef H5_HAVE_FPHDF5 + HDmemcpy(buf, &shared->super_addr, H5F_sizeof_addr(file)); + } + + if (H5FD_is_fphdf5_driver(lf)) { + if ((mrc = MPI_Bcast(buf, sizeof(buf), MPI_BYTE, (int)H5FP_capt_barrier_rank, + H5FP_SAP_BARRIER_COMM)) != MPI_SUCCESS) + HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mrc) + + if (!H5FD_fphdf5_is_captain(lf)) { + haddr_t super_addr; + + HDmemcpy(&super_addr, buf, H5F_sizeof_addr(file)); + + if (H5F_read_superblock(file, dxpl_id, &root_ent, super_addr, + &buf[H5F_sizeof_addr(file)]) < 0) + HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock") + + if (H5G_mkroot(file, dxpl_id, &root_ent) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create/open root group") + } + } +#endif /* H5_HAVE_FPHDF5 */ } else if (1 == shared->nrefs) { /* Read the superblock if it hasn't been read before. */ if (HADDR_UNDEF == (shared->super_addr = H5F_locate_signature(lf,dxpl_id))) @@ -2313,6 +2326,7 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr H5F_file_t *shared = NULL; /* shared part of `file' */ H5FD_t *lf = NULL; /* file driver part of `shared' */ const uint8_t *p = NULL; /* Temporary pointer into encoding buffers */ + const uint8_t *start_p; /* Start of encoding buffers */ unsigned i; /* Index variable */ unsigned chksum; /* Checksum temporary variable */ size_t driver_size; /* Size of driver info block, in bytes */ @@ -2345,15 +2359,17 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr } if (!buf) { - buf = local_buf; + start_p = p = local_buf; if (H5FD_set_eoa(lf, shared->super_addr + fixed_size) < 0 || - H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, shared->super_addr, fixed_size, buf) < 0) + H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, shared->super_addr, fixed_size, p) < 0) HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "unable to read superblock") + } else { + start_p = p = buf; } /* Signature, already checked */ - p = buf + H5F_SIGNATURE_LEN; + p += H5F_SIGNATURE_LEN; /* Superblock version */ super_vers = *p++; @@ -2447,7 +2463,7 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr /* File consistency flags. Not really used yet */ UINT32DECODE(p, shared->consist_flags); - assert(((size_t)(p - buf)) == fixed_size); + assert(((size_t)(p - start_p)) == fixed_size); /* Decode the variable-length part of the superblock... */ variable_size = (super_vers>0 ? 4 : 0) + /* Potential indexed storage B-tree internal 'K' value */ @@ -2459,10 +2475,12 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr assert(fixed_size + variable_size <= sizeof(local_buf)); /* The buffer (buf) is either passed in or the "local_buf" variable now */ - if (H5FD_set_eoa(lf, shared->super_addr + fixed_size+variable_size) < 0 || - H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, shared->super_addr + fixed_size, - variable_size, &buf[fixed_size]) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to read superblock") + if(!buf) { + if (H5FD_set_eoa(lf, shared->super_addr + fixed_size+variable_size) < 0 || + H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, shared->super_addr + fixed_size, + variable_size, &start_p[fixed_size]) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to read superblock") + } /* end if */ /* * If the superblock version # is greater than 0, read in the indexed @@ -2508,7 +2526,7 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr assert(sizeof(chksum) == sizeof(shared->super_chksum)); for (q = (uint8_t *)&chksum, chksum = 0, i = 0; i < fixed_size + variable_size; ++i) - q[i % sizeof(shared->super_chksum)] ^= buf[i]; + q[i % sizeof(shared->super_chksum)] ^= start_p[i]; /* Set the super block checksum */ shared->super_chksum = chksum; @@ -2516,12 +2534,13 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr /* Decode the optional driver information block */ if (H5F_addr_defined(shared->driver_addr)) { haddr_t drv_addr = shared->base_addr + shared->driver_addr; + const uint8_t *driver_p=p; /* Remember beginning of driver info block */ - if (H5FD_set_eoa(lf, drv_addr + 16) < 0 || - H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, drv_addr, 16, buf) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to read driver information block") - - p = buf; + if(!buf) { + if (H5FD_set_eoa(lf, drv_addr + 16) < 0 || + H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, drv_addr, 16, p) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to read driver information block") + } /* end if */ /* Version number */ if (HDF5_DRIVERINFO_VERSION != *p++) @@ -2539,18 +2558,20 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr /* Read driver information and decode */ assert((driver_size + 16) <= sizeof(local_buf)); - if (H5FD_set_eoa(lf, drv_addr + 16 + driver_size) < 0 || - H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, drv_addr+16, driver_size, &buf[16]) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to read file driver information") + if(!buf) { + if (H5FD_set_eoa(lf, drv_addr + 16 + driver_size) < 0 || + H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, drv_addr+16, driver_size, &driver_p[16]) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to read file driver information") + } /* end if */ - if (H5FD_sb_decode(lf, driver_name, &buf[16]) < 0) + if (H5FD_sb_decode(lf, driver_name, &driver_p[16]) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to decode driver information") /* Compute driver info block checksum */ assert(sizeof(chksum) == sizeof(shared->drvr_chksum)); for (q = (uint8_t *)&chksum, chksum = 0, i = 0; i < (driver_size + 16); ++i) - q[i % sizeof(shared->drvr_chksum)] ^= buf[i]; + q[i % sizeof(shared->drvr_chksum)] ^= driver_p[i]; /* Set the driver info block checksum */ shared->drvr_chksum = chksum; @@ -2571,8 +2592,11 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr if (HADDR_UNDEF == (eof = H5FD_get_eof(lf))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size") - if (eof < stored_eoa) - HGOTO_ERROR(H5E_FILE, H5E_TRUNCATED, FAIL, "truncated file") +#ifdef H5_HAVE_FPHDF5 + if (!H5FD_is_fphdf5_driver(lf) || H5FD_fphdf5_is_captain(lf)) +#endif /* !H5_HAVE_FPHDF5 */ + if (eof < stored_eoa) + HGOTO_ERROR(H5E_FILE, H5E_TRUNCATED, FAIL, "truncated file") /* * Tell the file driver how much address space has already been @@ -2629,7 +2653,7 @@ H5F_init_superblock(H5F_t *f, hid_t dxpl_id) * now. */ if(H5P_get(plist, H5F_CRT_USER_BLOCK_NAME, &userblock_size) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get user block size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get user block size") f->shared->super_addr = userblock_size; f->shared->base_addr = f->shared->super_addr; f->shared->consist_flags = 0x03; @@ -3291,11 +3315,9 @@ H5F_close(H5F_t *f) } /* Let's all meet up now... */ - /* XXX: Calls which end up here are already required to be - * collective, is this barrier really necessary? -QAK - */ - if (H5FD_is_fphdf5_driver(f->shared->lf)) - MPI_Barrier(H5FP_SAP_BARRIER_COMM); + if (H5F_flush(f, H5AC_dxpl_id, H5F_SCOPE_LOCAL, + H5F_FLUSH_INVALIDATE | H5F_FLUSH_CLOSING | H5F_FLUSH_CLEAR_ONLY) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") #endif /* H5_HAVE_FPHDF5 */ } /* end if */ @@ -1331,7 +1331,7 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) if (H5P_exist_plist(plist, H5FD_FPHDF5_CAPTN_ALLOC_ONLY) > 0) if (H5P_get(plist, H5FD_FPHDF5_CAPTN_ALLOC_ONLY, &capt_only) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, HADDR_UNDEF, "can't retrieve FPHDF5 property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, HADDR_UNDEF, "can't retrieve FPHDF5 property") HDmemset(&fp_alloc, 0, sizeof(fp_alloc)); diff --git a/src/H5FDfphdf5.c b/src/H5FDfphdf5.c index 3aca1ad..db2ca11 100644 --- a/src/H5FDfphdf5.c +++ b/src/H5FDfphdf5.c @@ -934,11 +934,6 @@ H5FD_fphdf5_close(H5FD_t *_file) if (H5FP_request_close(_file, file->file_id, &req_id, &status) == FAIL) HGOTO_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "can't inform SAP of file close") - /* Let all of the processes catch up to this point. */ - /* XXX: This barrier isn't necessary, MPI-I/O will syncronize for you -QAK */ - if ((mrc = MPI_Barrier(H5FP_SAP_BARRIER_COMM)) != MPI_SUCCESS) - HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mrc) - /* MPI_File_close sets argument to MPI_FILE_NULL */ if ((mrc = MPI_File_close(&file->f)) != MPI_SUCCESS) HMPI_GOTO_ERROR(FAIL, "MPI_File_close failed", mrc) diff --git a/src/H5FPclient.c b/src/H5FPclient.c index f14b103..7dcca9e 100644 --- a/src/H5FPclient.c +++ b/src/H5FPclient.c @@ -326,18 +326,31 @@ H5FP_request_read_metadata(H5FD_t *file, unsigned file_id, hid_t dxpl_id, H5FP_SAP_COMM, &mpi_status)) != MPI_SUCCESS) HMPI_GOTO_ERROR(FAIL, "MPI_Recv failed", mrc); - HDmemset(*buf, '\0', size); - switch (sap_read.status) { case H5FP_STATUS_OK: /* use the info in the H5FP_read_t structure to update the metadata */ *status = H5FP_STATUS_OK; + HDmemset(*buf, '\0', size); HDmemset(&mpi_status, 0, sizeof(mpi_status)); - if ((mrc = MPI_Recv(*buf, (int)size, MPI_BYTE, (int)H5FP_sap_rank, - H5FP_TAG_METADATA, H5FP_SAP_COMM, - &mpi_status)) != MPI_SUCCESS) - HMPI_GOTO_ERROR(FAIL, "MPI_Recv failed", mrc); + if (size < sap_read.md_size) { + char *mdata; + + if (H5FP_read_metadata(&mdata, (int)sap_read.md_size, (int)H5FP_sap_rank) == FAIL) { +HDfprintf(stderr, "Metadata Read Failed!!!!\n"); + } + + HDmemcpy(*buf, mdata, size); + HDfree(mdata); + } else if (size == sap_read.md_size) { + if ((mrc = MPI_Recv(*buf, (int)sap_read.md_size, MPI_BYTE, + (int)H5FP_sap_rank, H5FP_TAG_METADATA, + H5FP_SAP_COMM, &mpi_status)) != MPI_SUCCESS) + HMPI_GOTO_ERROR(FAIL, "MPI_Recv failed", mrc); + } else { +HDfprintf(stderr, "Buffer not big enough to hold metadata!!!!\n"); +assert(0); + } *bytes_read = size; break; @@ -395,7 +408,7 @@ H5FP_request_write_metadata(H5FD_t *file, unsigned file_id, hid_t dxpl_id, int mrc, my_rank; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(H5FP_request_change, FAIL); + FUNC_ENTER_NOAPI(H5FP_request_write_metadata, FAIL); /* check args */ assert(file); diff --git a/src/H5FPserver.c b/src/H5FPserver.c index 4b3df6b..d45f1da 100644 --- a/src/H5FPserver.c +++ b/src/H5FPserver.c @@ -313,7 +313,7 @@ H5FP_object_lock_cmp(H5FP_object_lock *o1, FUNC_ENTER_NOINIT(H5FP_object_lock_cmp); assert(o1); assert(o2); - FUNC_LEAVE_NOAPI(o1->oid - o2->oid); + FUNC_LEAVE_NOAPI(o2->oid - o1->oid); } /* @@ -441,7 +441,7 @@ H5FP_file_mod_cmp(H5FP_mdata_mod *k1, FUNC_ENTER_NOINIT(H5FP_file_mod_cmp); assert(k1); assert(k2); - FUNC_LEAVE_NOAPI(k1->addr - k2->addr); + FUNC_LEAVE_NOAPI(k2->addr - k1->addr); } /* @@ -1114,6 +1114,7 @@ done: if (ret_value != SUCCEED) { /* Can't lock the whole group at one time for some reason */ HDfprintf(stderr, "%s: locking failure (%d)!!\n", FUNC, ret_value); +assert(0); } HDfree(oids); @@ -1272,13 +1273,27 @@ H5FP_sap_handle_read_request(H5FP_request_t *req) mod.addr = req->addr; /* This is the key field for the TBBT */ - if ((node = H5TB_dfind(info->mod_tree, (void *)&mod, NULL)) != NULL) { + if ((node = H5TB_dless(info->mod_tree, (void *)&mod, NULL)) != NULL) { H5FP_mdata_mod *fm = (H5FP_mdata_mod *)node->data; - r.md_size = fm->md_size; - r.addr = fm->addr; - r.status = H5FP_STATUS_OK; - metadata = fm->metadata; /* Sent out in a separate message */ + if (H5F_addr_eq(req->addr, fm->addr)) { + r.md_size = fm->md_size; + r.addr = fm->addr; + r.status = H5FP_STATUS_OK; + metadata = fm->metadata; /* Sent out in a separate message */ + } else if (H5F_addr_gt(req->addr, fm->addr) + && H5F_addr_lt(req->addr, fm->addr + fm->md_size)) { + r.md_size = fm->md_size - (req->addr - fm->addr); + r.addr = req->addr; + r.status = H5FP_STATUS_OK; + metadata = fm->metadata + (req->addr - fm->addr); /* Sent out in a separate message */ + } else { +HDfprintf(stderr, "Panic!!!!\n"); +assert(0); + } + } else { +HDfprintf(stderr, "%s: Couldn't find metadata at req->addr == %a\n", FUNC, req->addr); +assert(0); } } @@ -1402,7 +1417,7 @@ H5FP_sap_handle_flush_request(H5FP_request_t *req) FUNC_ENTER_NOINIT(H5FP_sap_handle_flush_request); - if ((info = H5FP_find_file_info(req->file_id)) != NULL) + if ((info = H5FP_find_file_info(req->file_id)) != NULL) { if (info->num_mods) { /* * If there are any modifications not written out yet, dump @@ -1421,6 +1436,10 @@ H5FP_sap_handle_flush_request(H5FP_request_t *req) "can't dump metadata to client"); } } + } else { + HGOTO_ERROR(H5E_FPHDF5, H5E_NOTFOUND, FAIL, + "can't find information for file"); + } done: H5FP_send_reply(req->proc_rank, req->req_id, req->file_id, exit_state); @@ -1462,6 +1481,9 @@ H5FP_sap_handle_close_request(H5FP_request_t *req) "cannot remove file ID from list"); } } + } else { + HGOTO_ERROR(H5E_FPHDF5, H5E_NOTFOUND, FAIL, + "can't find information for file"); } done: @@ -102,6 +102,8 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Oprivate.h" /* Object headers */ +#include "H5FPprivate.h" /*FPHDF5 */ + /* Local macros */ #define H5G_INIT_HEAP 8192 #define H5G_RESERVED_ATOMS 0 @@ -1521,7 +1523,6 @@ done: /* If we started with a NULL grp_ent and we copied something into it, free the entry information */ if(null_grp && group_copy) H5G_free_ent_name(grp_ent); - FUNC_LEAVE_NOAPI(ret_value); } @@ -1559,6 +1560,7 @@ H5G_traverse_slink (H5G_entry_t *grp_ent/*in,out*/, char *linkval = NULL; /*the copied link value */ H5G_entry_t tmp_grp_ent; /* Temporary copy of group entry */ H5RS_str_t *tmp_user_path_r=NULL, *tmp_canon_path_r=NULL; /* Temporary pointer to object's user path & canonical path */ + H5HL_t *heap; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_traverse_slink, FAIL); @@ -1569,10 +1571,17 @@ H5G_traverse_slink (H5G_entry_t *grp_ent/*in,out*/, /* Get the link value */ if (NULL==H5O_read (grp_ent, H5O_STAB_ID, 0, &stab_mesg, dxpl_id)) HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address"); - if (NULL==(clv=H5HL_peek (grp_ent->file, dxpl_id, stab_mesg.heap_addr, - obj_ent->cache.slink.lval_offset))) - HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbolic link value"); + + if (NULL == (heap = H5HL_protect(grp_ent->file, dxpl_id, stab_mesg.heap_addr))) + HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read protect link value") + + clv = H5HL_offset_into(grp_ent->file, heap, obj_ent->cache.slink.lval_offset); + linkval = H5MM_xstrdup (clv); + assert(linkval); + + if (H5HL_unprotect(grp_ent->file, dxpl_id, heap, stab_mesg.heap_addr) < 0) + HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read unprotect link value") /* Hold the entry's name (& old_name) to restore later */ tmp_user_path_r=obj_ent->user_path_r; @@ -2508,17 +2517,26 @@ H5G_get_objinfo (H5G_entry_t *loc, const char *name, hbool_t follow_link, */ if (statbuf) { if (H5G_CACHED_SLINK==obj_ent.type) { + H5HL_t *heap; + /* Named object is a symbolic link */ - if (NULL==H5O_read (&grp_ent, H5O_STAB_ID, 0, &stab_mesg, dxpl_id) || - NULL==(s=H5HL_peek (grp_ent.file, dxpl_id, stab_mesg.heap_addr, - obj_ent.cache.slink.lval_offset))) - HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbolic link value"); - statbuf->linklen = HDstrlen(s)+1; /*count the null terminator*/ + if (NULL == H5O_read(&grp_ent, H5O_STAB_ID, 0, &stab_mesg, dxpl_id)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbolic link value") + + if (NULL == (heap = H5HL_protect(grp_ent.file, dxpl_id, stab_mesg.heap_addr))) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read protect link value") + + s = H5HL_offset_into(grp_ent.file, heap, obj_ent.cache.slink.lval_offset); + + statbuf->linklen = HDstrlen(s) + 1; /*count the null terminator*/ + + if (H5HL_unprotect(grp_ent.file, dxpl_id, heap, stab_mesg.heap_addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read unprotect link value") + statbuf->objno = 0; statbuf->nlink = 0; statbuf->type = H5G_LINK; statbuf->mtime = 0; - } else { /* Some other type of object */ statbuf->objno = obj_ent.header; @@ -2725,6 +2743,7 @@ H5G_linkval (H5G_entry_t *loc, const char *name, size_t size, char *buf/*out*/, const char *s = NULL; H5G_entry_t grp_ent, obj_ent; H5O_stab_t stab_mesg; + H5HL_t *heap; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_linkval, FAIL); @@ -2745,14 +2764,19 @@ H5G_linkval (H5G_entry_t *loc, const char *name, size_t size, char *buf/*out*/, */ if (NULL==H5O_read (&grp_ent, H5O_STAB_ID, 0, &stab_mesg, dxpl_id)) HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to determine local heap address"); - if (NULL==(s=H5HL_peek (grp_ent.file, dxpl_id, stab_mesg.heap_addr, - obj_ent.cache.slink.lval_offset))) - HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbolic link value"); + + if (NULL == (heap = H5HL_protect(grp_ent.file, dxpl_id, stab_mesg.heap_addr))) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read protect link value") + s = H5HL_offset_into(grp_ent.file, heap, obj_ent.cache.slink.lval_offset); + /* Copy to output buffer */ if (size>0 && buf) HDstrncpy (buf, s, size); + if (H5HL_unprotect(grp_ent.file, dxpl_id, heap, stab_mesg.heap_addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read unprotect link value") + done: /* Free the ID to name buffers */ H5G_free_ent_name(&grp_ent); diff --git a/src/H5Gent.c b/src/H5Gent.c index 9596eb0..dfd4886 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -498,10 +498,14 @@ H5G_ent_debug(H5F_t UNUSED *f, hid_t dxpl_id, const H5G_entry_t *ent, FILE * str "Link value offset:", (unsigned long)(ent->cache.slink.lval_offset)); if (H5F_addr_defined(heap)) { - lval = H5HL_peek (ent->file, dxpl_id, heap, ent->cache.slink.lval_offset); + const H5HL_t *heap_ptr; + + heap_ptr = H5HL_protect(ent->file, dxpl_id, heap); + lval = H5HL_offset_into(ent->file, heap_ptr, ent->cache.slink.lval_offset); HDfprintf (stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth, "Link value:", lval); + H5HL_unprotect(ent->file, dxpl_id, heap_ptr, heap); } break; diff --git a/src/H5Gnode.c b/src/H5Gnode.c index b5ac425..044bcd3 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -61,9 +61,6 @@ typedef struct H5G_node_key_t { #define PABLO_MASK H5G_node_mask -/* PRIVATE PROTOTYPES */ -static size_t H5G_node_size(H5F_t *f); - /* Metadata cache callbacks */ static H5G_node_t *H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata1, void *_udata2); @@ -73,6 +70,8 @@ static herr_t H5G_node_dest(H5F_t *f, H5G_node_t *sym); static herr_t H5G_node_clear(H5F_t *f, H5G_node_t *sym, hbool_t destroy); /* B-tree callbacks */ +static herr_t H5G_node_serialize(H5F_t *f, H5G_node_t *sym, uint8_t *buf); +static size_t H5G_node_size(H5F_t *f); static size_t H5G_node_sizeof_rkey(H5F_t *f, const void *_udata); static herr_t H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, void *_lt_key, void *_udata, void *_rt_key, @@ -256,6 +255,7 @@ H5G_node_debug_key (FILE *stream, H5F_t *f, hid_t dxpl_id, int indent, int fwidt { const H5G_node_key_t *key = (const H5G_node_key_t *) _key; const H5G_bt_ud1_t *udata = (const H5G_bt_ud1_t *) _udata; + const H5HL_t *heap = NULL; const char *s; herr_t ret_value=SUCCEED; /* Return value */ @@ -266,10 +266,16 @@ H5G_node_debug_key (FILE *stream, H5F_t *f, hid_t dxpl_id, int indent, int fwidt (unsigned)key->offset); HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Name:"); - if (NULL == (s = H5HL_peek(f, dxpl_id, udata->heap_addr, key->offset))) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbol name"); + + if (NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr))) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to protect symbol name"); + + s = H5HL_offset_into(f, heap, key->offset); HDfprintf (stream, "%s\n", s); + if (H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name"); + done: FUNC_LEAVE_NOAPI(ret_value); } @@ -298,7 +304,7 @@ H5G_node_size(H5F_t *f) FUNC_ENTER_NOINIT(H5G_node_size); FUNC_LEAVE_NOAPI(H5G_NODE_SIZEOF_HDR(f) + - (2 * H5F_SYM_LEAF_K(f)) * H5G_SIZEOF_ENTRY(f)); + (2 * H5F_SYM_LEAF_K(f)) * H5G_SIZEOF_ENTRY(f)); } @@ -420,7 +426,7 @@ done: static herr_t H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_t *sym) { - uint8_t *buf = NULL, *p = NULL; + uint8_t *buf = NULL; size_t size; int i; herr_t ret_value=SUCCEED; /* Return value */ @@ -454,26 +460,11 @@ H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_ size = H5G_node_size(f); /* Allocate temporary buffer */ - if ((buf=H5FL_BLK_MALLOC(symbol_node,size))==NULL) + if ((buf=H5FL_BLK_CALLOC(symbol_node,size))==NULL) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - p=buf; - /* magic number */ - HDmemcpy(p, H5G_NODE_MAGIC, H5G_NODE_SIZEOF_MAGIC); - p += 4; - - /* version number */ - *p++ = H5G_NODE_VERS; - - /* reserved */ - *p++ = 0; - - /* number of symbols */ - UINT16ENCODE(p, sym->nsyms); - - /* entries */ - H5G_ent_encode_vec(f, &p, sym->entry, sym->nsyms); - HDmemset(p, 0, size - (p - buf)); + if (H5G_node_serialize(f, sym, buf) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSERIALIZE, FAIL, "node serialization failed"); if (H5F_block_write(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf) < 0) HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "unable to write symbol table node to the file"); @@ -499,6 +490,58 @@ done: /*------------------------------------------------------------------------- + * Function: H5G_node_serialize + * + * Purpose: Serialize the symbol table node + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Bill Wendling + * wendling@ncsa.uiuc.edu + * Sept. 16, 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5G_node_serialize(H5F_t *f, H5G_node_t *sym, uint8_t *buf) +{ + uint8_t *p; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(H5G_node_serialize, FAIL); + + /* check args */ + assert(f); + assert(sym); + assert(buf); + + p = buf; + + /* magic number */ + HDmemcpy(p, H5G_NODE_MAGIC, H5G_NODE_SIZEOF_MAGIC); + p += 4; + + /* version number */ + *p++ = H5G_NODE_VERS; + + /* reserved */ + *p++ = 0; + + /* number of symbols */ + UINT16ENCODE(p, sym->nsyms); + + /* entries */ + if (H5G_ent_encode_vec(f, &p, sym->entry, sym->nsyms) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't serialize") + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5G_node_dest * * Purpose: Destroy a symbol table node in memory. @@ -684,6 +727,7 @@ H5G_node_cmp2(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_ke H5G_bt_ud1_t *udata = (H5G_bt_ud1_t *) _udata; H5G_node_key_t *lt_key = (H5G_node_key_t *) _lt_key; H5G_node_key_t *rt_key = (H5G_node_key_t *) _rt_key; + const H5HL_t *heap = NULL; const char *s1, *s2; const char *base; /* Base of heap */ int ret_value; @@ -695,13 +739,18 @@ H5G_node_cmp2(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_ke assert(rt_key); /* Get base address of heap */ - if (NULL == (base = H5HL_peek(f, dxpl_id, udata->heap_addr, 0))) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbol name"); + if (NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr))) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to protect symbol name"); + + base = H5HL_offset_into(f, heap, 0); /* Get pointers to string names */ s1=base+lt_key->offset; s2=base+rt_key->offset; + if (H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name"); + /* Set return value */ ret_value = HDstrcmp(s1, s2); @@ -743,6 +792,7 @@ H5G_node_cmp3(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_ke H5G_bt_ud1_t *udata = (H5G_bt_ud1_t *) _udata; H5G_node_key_t *lt_key = (H5G_node_key_t *) _lt_key; H5G_node_key_t *rt_key = (H5G_node_key_t *) _rt_key; + const H5HL_t *heap = NULL; const char *s; const char *base; /* Base of heap */ int ret_value=0; /* Return value */ @@ -750,8 +800,10 @@ H5G_node_cmp3(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_ke FUNC_ENTER_NOAPI(H5G_node_cmp3, FAIL); /* Get base address of heap */ - if (NULL == (base = H5HL_peek(f, dxpl_id, udata->heap_addr, 0))) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbol name"); + if (NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr))) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to protect symbol name"); + + base = H5HL_offset_into(f, heap, 0); /* left side */ s=base+lt_key->offset; @@ -764,6 +816,9 @@ H5G_node_cmp3(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_ke HGOTO_DONE(1); done: + if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr) < 0) + HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name"); + FUNC_LEAVE_NOAPI(ret_value); } @@ -803,6 +858,7 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key { H5G_bt_ud1_t *bt_udata = (H5G_bt_ud1_t *) _udata; H5G_node_t *sn = NULL; + const H5HL_t *heap = NULL; int lt = 0, idx = 0, rt, cmp = 1; const char *s; const char *base; /* Base of heap */ @@ -824,8 +880,10 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to protect symbol table node"); /* Get base address of heap */ - if (NULL == (base = H5HL_peek(f, dxpl_id, bt_udata->heap_addr, 0))) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbol name"); + if (NULL == (heap = H5HL_protect(f, dxpl_id, bt_udata->heap_addr))) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to protect symbol name"); + + base = H5HL_offset_into(f, heap, 0); /* * Binary search. @@ -842,6 +900,10 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key lt = idx + 1; } } + + if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name"); + if (cmp) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found"); @@ -910,6 +972,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key, H5G_bt_ud1_t *bt_udata = (H5G_bt_ud1_t *) _udata; H5G_node_t *sn = NULL, *snrt = NULL; + const H5HL_t *heap = NULL; size_t offset; /*offset of name in heap */ const char *s; const char *base; /* Base of heap */ @@ -937,8 +1000,10 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key, HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node"); /* Get base address of heap */ - if (NULL == (base = H5HL_peek(f, dxpl_id, bt_udata->heap_addr, 0))) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to read symbol name"); + if (NULL == (heap = H5HL_protect(f, dxpl_id, bt_udata->heap_addr))) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name"); + + base = H5HL_offset_into(f, heap, 0); /* * Where does the new symbol get inserted? We use a binary search. @@ -947,8 +1012,16 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key, while (lt < rt) { idx = (lt + rt) / 2; s=base+sn->entry[idx].name_off; - if (0 == (cmp = HDstrcmp(bt_udata->name, s))) /*already present */ - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5B_INS_ERROR, "symbol is already present in symbol table"); + + if (0 == (cmp = HDstrcmp(bt_udata->name, s))) /*already present */ { + HCOMMON_ERROR(H5E_SYM, H5E_CANTINSERT, "symbol is already present in symbol table"); + + if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name"); + + HGOTO_DONE(H5B_INS_ERROR); + } + if (cmp < 0) { rt = idx; } else { @@ -957,6 +1030,9 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key, } idx += cmp > 0 ? 1 : 0; + if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name"); + /* * Add the new name to the heap. */ @@ -1090,6 +1166,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, H5G_node_key_t *rt_key = (H5G_node_key_t*)_rt_key; H5G_bt_ud1_t *bt_udata = (H5G_bt_ud1_t*)_udata; H5G_node_t *sn = NULL; + const H5HL_t *heap = NULL; int lt=0, rt, idx=0, cmp=1; const char *s = NULL; const char *base; /* Base of heap */ @@ -1108,12 +1185,16 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, if (NULL==(sn=H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_WRITE))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node"); - /* Get base address of heap */ - if (NULL == (base = H5HL_peek(f, dxpl_id, bt_udata->heap_addr, 0))) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to read symbol name"); - /* "Normal" removal of a single entry from the symbol table node */ if(bt_udata->name!=NULL) { + size_t len; + + /* Get base address of heap */ + if (NULL == (heap = H5HL_protect(f, dxpl_id, bt_udata->heap_addr))) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name"); + + base = H5HL_offset_into(f, heap, 0); + /* Find the name with a binary search */ rt = sn->nsyms; while (lt<rt && cmp) { @@ -1126,13 +1207,28 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, lt = idx+1; } } + + if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr) < 0) + HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name"); + if (cmp) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "not found"); if (H5G_CACHED_SLINK==sn->entry[idx].type) { /* Remove the symbolic link value */ - if ((s=H5HL_peek(f, dxpl_id, bt_udata->heap_addr, sn->entry[idx].cache.slink.lval_offset))) - H5HL_remove(f, dxpl_id, bt_udata->heap_addr, sn->entry[idx].cache.slink.lval_offset, HDstrlen(s)+1); + if (NULL == (heap = H5HL_protect(f, dxpl_id, bt_udata->heap_addr))) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name"); + + s = H5HL_offset_into(f, heap, sn->entry[idx].cache.slink.lval_offset); + if (s) + len=HDstrlen(s)+1; + + if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name"); + + if (s) + H5HL_remove(f, dxpl_id, bt_udata->heap_addr, sn->entry[idx].cache.slink.lval_offset, len); + H5E_clear(NULL); /* no big deal */ } else { /* Decrement the reference count */ @@ -1142,8 +1238,20 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, } /* Remove the name from the local heap */ - if ((s=H5HL_peek(f, dxpl_id, bt_udata->heap_addr, sn->entry[idx].name_off))) - H5HL_remove(f, dxpl_id, bt_udata->heap_addr, sn->entry[idx].name_off, HDstrlen(s)+1); + if (NULL == (heap = H5HL_protect(f, dxpl_id, bt_udata->heap_addr))) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name"); + + s = H5HL_offset_into(f, heap, sn->entry[idx].name_off); + + if (s) + len=HDstrlen(s)+1; + + if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name"); + + if (s) + H5HL_remove(f, dxpl_id, bt_udata->heap_addr, sn->entry[idx].name_off, len); + H5E_clear(NULL); /* no big deal */ /* Remove the entry from the symbol table node */ @@ -1267,6 +1375,7 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr, { H5G_bt_ud2_t *bt_udata = (H5G_bt_ud2_t *)_udata; H5G_node_t *sn = NULL; + const H5HL_t *heap = NULL; int i, nsyms; size_t n, *name_off=NULL; const char *name; @@ -1308,9 +1417,13 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr, if (bt_udata->skip>0) { --bt_udata->skip; } else { - name = H5HL_peek (f, dxpl_id, bt_udata->ent->cache.stab.heap_addr, name_off[i]); + if (NULL == (heap = H5HL_protect(f, dxpl_id, bt_udata->ent->cache.stab.heap_addr))) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_ITER_ERROR, "unable to protect symbol name"); + + name = H5HL_offset_into(f, heap, name_off[i]); assert (name); n = HDstrlen (name); + if (n+1>sizeof(buf)) { if (NULL==(s = H5MM_malloc (n+1))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, H5B_ITER_ERROR, "memory allocation failed"); @@ -1318,6 +1431,12 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr, s = buf; } HDstrcpy (s, name); + + if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->ent->cache.stab.heap_addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name"); + + heap = NULL; + ret_value = (bt_udata->op)(bt_udata->group_id, s, bt_udata->op_data); if (s!=buf) H5MM_xfree (s); @@ -1331,10 +1450,13 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr, HERROR (H5E_SYM, H5E_CANTNEXT, "iteration operator failed"); done: + if (heap && H5HL_unprotect(f, dxpl_id, heap, bt_udata->ent->cache.stab.heap_addr) < 0) + HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name"); + if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, FALSE) != SUCCEED) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header"); - name_off = H5MM_xfree (name_off); + name_off = H5MM_xfree (name_off); FUNC_LEAVE_NOAPI(ret_value); } @@ -1406,6 +1528,7 @@ H5G_node_name(H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr, void UNUSED *_rt_key, void *_udata) { H5G_bt_ud3_t *bt_udata = (H5G_bt_ud3_t *)_udata; + const H5HL_t *heap = NULL; size_t name_off; hsize_t loc_idx; const char *name; @@ -1428,9 +1551,18 @@ H5G_node_name(H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr, if(bt_udata->idx >= bt_udata->num_objs && bt_udata->idx < (bt_udata->num_objs+sn->nsyms)) { loc_idx = bt_udata->idx - bt_udata->num_objs; name_off = sn->entry[loc_idx].name_off; - name = H5HL_peek (f, dxpl_id, bt_udata->ent->cache.stab.heap_addr, name_off); + + if (NULL == (heap = H5HL_protect(f, dxpl_id, bt_udata->ent->cache.stab.heap_addr))) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_ITER_ERROR, "unable to protect symbol name"); + + name = H5HL_offset_into(f, heap, name_off); assert (name); bt_udata->name = H5MM_strdup (name); + assert(bt_udata->name); + + if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->ent->cache.stab.heap_addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name"); + ret_value = H5B_ITER_STOP; } else { bt_udata->num_objs += sn->nsyms; @@ -1519,6 +1651,7 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int i; H5G_node_t *sn = NULL; const char *s; + const H5HL_t *heap_ptr = NULL; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_node_debug, FAIL); @@ -1559,12 +1692,21 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, fwidth = MAX(0, fwidth - 3); for (i = 0; i < sn->nsyms; i++) { fprintf(stream, "%*sSymbol %d:\n", indent - 3, "", i); - if (H5F_addr_defined(heap) && - (s = H5HL_peek(f, dxpl_id, heap, sn->entry[i].name_off))) { - fprintf(stream, "%*s%-*s `%s'\n", indent, "", fwidth, - "Name:", - s); + + + if (H5F_addr_defined(heap)) { + if (NULL == (heap_ptr = H5HL_protect(f, dxpl_id, heap))) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to protect symbol name"); + + s = H5HL_offset_into(f, heap_ptr, sn->entry[i].name_off); + + if (s) + fprintf(stream, "%*s%-*s `%s'\n", indent, "", fwidth, "Name:", s); + + if (H5HL_unprotect(f, dxpl_id, heap_ptr, heap) < 0) + HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name"); } + H5G_ent_debug(f, dxpl_id, sn->entry + i, stream, indent, fwidth, heap); } @@ -1574,4 +1716,3 @@ done: FUNC_LEAVE_NOAPI(ret_value); } - diff --git a/src/H5Gstab.c b/src/H5Gstab.c index b5591b8..f92383a 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -235,6 +235,7 @@ H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent, hi /* initialize data to pass through B-tree */ if (NULL == H5O_read(grp_ent, H5O_STAB_ID, 0, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table"); + udata.operation = H5G_OPER_INSERT; udata.name = name; udata.heap_addr = stab.heap_addr; @@ -61,7 +61,10 @@ static void *H5HL_read(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, siz static herr_t H5HL_write(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, const void *buf); #endif /* NOT_YET */ -static H5HL_free_t * H5HL_remove_free(H5HL_t *heap, H5HL_free_t *fl); + +static herr_t H5HL_serialize(H5F_t *f, H5HL_t *heap, uint8_t *buf); +static H5HL_free_t *H5HL_remove_free(H5HL_t *heap, H5HL_free_t *fl); +static herr_t H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap); /* Metadata cache callbacks */ static H5HL_t *H5HL_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1, @@ -305,6 +308,211 @@ done: /*------------------------------------------------------------------------- + * Function: H5HL_minimize_heap_space + * + * Purpose: Go through the heap's freelist and determine if we can + * eliminate the free blocks at the tail of the buffer. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Bill Wendling + * wendling@ncsa.uiuc.edu + * Sept. 16, 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap) +{ + herr_t ret_value = SUCCEED; + size_t sizeof_hdr; + + FUNC_ENTER_NOAPI(H5HL_minimize_heap_space, FAIL) + + /* check args */ + assert(f); + assert(heap); + + sizeof_hdr = H5HL_SIZEOF_HDR(f); /* cache H5HL header size for file */ + + /* + * Check to see if we can reduce the size of the heap in memory by + * eliminating free blocks at the tail of the buffer before flushing the + * buffer out. + */ + if (heap->freelist) { + H5HL_free_t *tmp_fl; + H5HL_free_t *last_fl = NULL; + + /* Search for a free block at the end of the buffer */ + for (tmp_fl = heap->freelist; tmp_fl; tmp_fl = tmp_fl->next) + /* Check if the end of this free block is at the end of the buffer */ + if (tmp_fl->offset + tmp_fl->size == heap->mem_alloc) { + last_fl = tmp_fl; + break; + } + + /* + * Found free block at the end of the buffer, decide what to do + * about it + */ + if (last_fl) { + size_t new_mem_size = heap->mem_alloc; /* New size of memory buffer */ + + /* + * If the last free block's size is more than half the memory + * buffer size (and the memory buffer is larger than the + * minimum size), reduce or eliminate it. + */ + if (last_fl->size >= (heap->mem_alloc / 2) && heap->mem_alloc > H5HL_MIN_HEAP) { + /* + * Reduce size of buffer until it's too small or would + * eliminate the free block + */ + while (new_mem_size > H5HL_MIN_HEAP && + new_mem_size >= (last_fl->offset + H5HL_SIZEOF_FREE(f))) + new_mem_size /= 2; + + /* + * Check if reducing the memory buffer size would + * eliminate the free list + */ + if (new_mem_size < (last_fl->offset + H5HL_SIZEOF_FREE(f))) { + /* Check if this is the only block on the free list */ + if (last_fl->prev == NULL && last_fl->next == NULL) { + /* Double the new memory size */ + new_mem_size *= 2; + + /* Truncate the free block */ + last_fl->size = H5HL_ALIGN(new_mem_size - last_fl->offset); + new_mem_size = last_fl->offset + last_fl->size; + assert(last_fl->size >= H5HL_SIZEOF_FREE(f)); + } else { + /* + * Set the size of the memory buffer to the start + * of the free list + */ + new_mem_size = last_fl->offset; + + /* Eliminate the free block from the list */ + last_fl = H5HL_remove_free(heap, last_fl); + } + } else { + /* Truncate the free block */ + last_fl->size = H5HL_ALIGN(new_mem_size - last_fl->offset); + new_mem_size = last_fl->offset + last_fl->size; + assert(last_fl->size >= H5HL_SIZEOF_FREE(f)); + assert(last_fl->size == H5HL_ALIGN(last_fl->size)); + } + + /* Resize the memory buffer */ + if (new_mem_size != heap->mem_alloc) { + heap->mem_alloc = new_mem_size; + heap->chunk = H5FL_BLK_REALLOC(heap_chunk, heap->chunk, (sizeof_hdr + new_mem_size)); + + if (!heap->chunk) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + } + } + } + } + + /* + * If the heap grew larger or smaller than disk storage then move the + * data segment of the heap to another contiguous block of disk + * storage. + */ + if (heap->mem_alloc != heap->disk_alloc) { + haddr_t old_addr = heap->addr, new_addr; + + /* Release old space on disk */ + H5_CHECK_OVERFLOW(heap->disk_alloc, size_t, hsize_t); + H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, old_addr, (hsize_t)heap->disk_alloc); + H5E_clear(NULL); /* don't really care if the free failed */ + + /* Allocate new space on disk */ + H5_CHECK_OVERFLOW(heap->mem_alloc, size_t, hsize_t); + + if (HADDR_UNDEF == (new_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, dxpl_id, (hsize_t)heap->mem_alloc))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate file space for heap") + + heap->addr = new_addr; + + /* Set new size of block on disk */ + heap->disk_alloc = heap->mem_alloc; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} + + +/*------------------------------------------------------------------------- + * Function: H5HL_serialize + * + * Purpose: Serialize the heap. This function will eliminate free + * blocks at the tail of the heap and also split the block + * if it needs to be split for the file. This is so that we + * can serialize it correctly. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Bill Wendling + * wendling@ncsa.uiuc.edu + * Sept. 16, 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HL_serialize(H5F_t *f, H5HL_t *heap, uint8_t *buf) +{ + H5HL_free_t *fl; + uint8_t *p; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOINIT(H5HL_serialize) + + /* check args */ + assert(buf); + assert(heap); + + /* serialize the header */ + p = buf; + fl = heap->freelist; + HDmemcpy(p, H5HL_MAGIC, H5HL_SIZEOF_MAGIC); + p += H5HL_SIZEOF_MAGIC; + *p++ = H5HL_VERSION; + *p++ = 0; /*reserved*/ + *p++ = 0; /*reserved*/ + *p++ = 0; /*reserved*/ + H5F_ENCODE_LENGTH(f, p, heap->mem_alloc); + H5F_ENCODE_LENGTH(f, p, fl ? fl->offset : H5HL_FREE_NULL); + H5F_addr_encode(f, &p, heap->addr); + + /* serialize the free list */ + for (; fl; fl = fl->next) { + assert (fl->offset == H5HL_ALIGN (fl->offset)); + p = heap->chunk + H5HL_SIZEOF_HDR(f) + fl->offset; + + if (fl->next) { + H5F_ENCODE_LENGTH(f, p, fl->next->offset); + } else { + H5F_ENCODE_LENGTH(f, p, H5HL_FREE_NULL); + } + + H5F_ENCODE_LENGTH(f, p, fl->size); + } + + FUNC_LEAVE_NOAPI(ret_value) +} + + +/*------------------------------------------------------------------------- * Function: H5HL_flush * * Purpose: Flushes a heap from memory to disk if it's dirty. Optionally @@ -317,25 +525,24 @@ done: * Jul 17 1997 * * Modifications: - * rky, 1998-08-28 - * Only p0 writes metadata to disk. + * rky, 1998-08-28 + * Only p0 writes metadata to disk. * - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. + * Robb Matzke, 1999-07-28 + * The ADDR argument is passed by value. * * Quincey Koziol, 2002-7-180 * Added dxpl parameter to allow more control over I/O from metadata * cache. + * + * Bill Wendling, 2003-09-16 + * Separated out the bit that serializes the heap. *------------------------------------------------------------------------- */ static herr_t H5HL_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HL_t *heap) { - uint8_t *p; - H5HL_free_t *fl; - haddr_t hdr_end_addr; - size_t sizeof_hdr; /* Cache H5HL header size for file */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HL_flush, FAIL); @@ -345,169 +552,45 @@ H5HL_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HL_t *heap) assert(heap); if (heap->cache_info.dirty) { - /* Cache this for later */ - sizeof_hdr= H5HL_SIZEOF_HDR(f); + haddr_t hdr_end_addr; + size_t sizeof_hdr = H5HL_SIZEOF_HDR(f); /* cache H5HL header size for file */ - /* - * Check to see if we can reduce the size of the heap in memory by - * eliminating free blocks at the tail of the buffer before flushing the - * buffer out. - */ - if(heap->freelist) { - H5HL_free_t *tmp_fl=heap->freelist; - H5HL_free_t *last_fl=NULL; - - /* Search for a free block at the end of the buffer */ - while(tmp_fl!=NULL) { - /* Check if the end of this free block is at the end of the buffer */ - if(tmp_fl->offset + tmp_fl->size == heap->mem_alloc) { - last_fl=tmp_fl; - break; - } /* end if */ - tmp_fl=tmp_fl->next; - } /* end while */ - - /* Found free block at the end of the buffer, decide what to do about it */ - if(last_fl) { - size_t new_mem_size=heap->mem_alloc; /* New size of memory buffer */ + /* Minimize the heap space size if possible */ + if (H5HL_minimize_heap_space(f, dxpl_id, heap) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to minimize local heap space") - /* - *If the last free block's size is more than half the memory - * buffer size (and the memory buffer is larger than the minimum - * size), reduce or eliminate it. - */ - if(last_fl->size>=(heap->mem_alloc/2) && heap->mem_alloc>H5HL_MIN_HEAP) { - /* Reduce size of buffer until it's too small or would eliminate the free block */ - while(new_mem_size>H5HL_MIN_HEAP && - new_mem_size>=(last_fl->offset+H5HL_SIZEOF_FREE(f))) - new_mem_size /= 2; - - /* Check if reducing the memory buffer size would eliminate the free list */ - if(new_mem_size<(last_fl->offset+H5HL_SIZEOF_FREE(f))) { - /* Check if this is the only block on the free list */ - if(last_fl->prev==NULL && last_fl->next==NULL) { - /* Double the new memory size */ - new_mem_size *=2; - - /* Truncate the free block */ - last_fl->size=H5HL_ALIGN(new_mem_size-last_fl->offset); - new_mem_size=last_fl->offset+last_fl->size; - assert(last_fl->size>=H5HL_SIZEOF_FREE(f)); - } /* end if */ - else { - /* Set the size of the memory buffer to the start of the free list */ - new_mem_size=last_fl->offset; - - /* Eliminate the free block from the list */ - last_fl = H5HL_remove_free(heap, last_fl); - } /* end else */ - } /* end if */ - else { - /* Truncate the free block */ - last_fl->size=H5HL_ALIGN(new_mem_size-last_fl->offset); - new_mem_size=last_fl->offset+last_fl->size; - assert(last_fl->size>=H5HL_SIZEOF_FREE(f)); - assert(last_fl->size==H5HL_ALIGN(last_fl->size)); - } /* end else */ - - /* Resize the memory buffer */ - if(new_mem_size!=heap->mem_alloc) { - heap->mem_alloc=new_mem_size; - heap->chunk = H5FL_BLK_REALLOC(heap_chunk,heap->chunk, - (sizeof_hdr + new_mem_size)); - if (NULL==heap->chunk) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - } /* end if */ - } /* end if */ - } /* end if */ - } /* end if */ - - /* - * If the heap grew larger or smaller than disk storage then move the - * data segment of the heap to another contiguous block of - * disk storage. - */ - if (heap->mem_alloc != heap->disk_alloc) { - haddr_t old_addr = heap->addr, new_addr; - - /* Release old space on disk */ - H5_CHECK_OVERFLOW(heap->disk_alloc,size_t,hsize_t); - H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, old_addr, (hsize_t)heap->disk_alloc); - H5E_clear(NULL); /*don't really care if the free failed */ - - /* Allocate new space on disk */ - H5_CHECK_OVERFLOW(heap->mem_alloc,size_t,hsize_t); - if (HADDR_UNDEF==(new_addr=H5MF_alloc(f, H5FD_MEM_LHEAP, dxpl_id, - (hsize_t)heap->mem_alloc))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate file space for heap"); - heap->addr = new_addr; - - /* Set new size of block on disk */ - heap->disk_alloc = heap->mem_alloc; - } - - /* - * Write the header. - */ - p = heap->chunk; - fl=heap->freelist; - HDmemcpy(p, H5HL_MAGIC, H5HL_SIZEOF_MAGIC); - p += H5HL_SIZEOF_MAGIC; - *p++ = H5HL_VERSION; - *p++ = 0; /*reserved*/ - *p++ = 0; /*reserved*/ - *p++ = 0; /*reserved*/ - H5F_ENCODE_LENGTH(f, p, heap->mem_alloc); - H5F_ENCODE_LENGTH(f, p, fl ? fl->offset : H5HL_FREE_NULL); - H5F_addr_encode(f, &p, heap->addr); - - /* - * Write the free list. - */ - while (fl) { - assert (fl->offset == H5HL_ALIGN (fl->offset)); - p = heap->chunk + sizeof_hdr + fl->offset; - if (fl->next) { - H5F_ENCODE_LENGTH(f, p, fl->next->offset); - } else { - H5F_ENCODE_LENGTH(f, p, H5HL_FREE_NULL); - } - H5F_ENCODE_LENGTH(f, p, fl->size); - fl = fl->next; - } + /* Write the header */ + if (H5HL_serialize(f, heap, heap->chunk) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTSERIALIZE, FAIL, "unable to serialize local heap") - /* - * Copy buffer to disk. - */ + /* Copy buffer to disk */ hdr_end_addr = addr + (hsize_t)sizeof_hdr; + if (H5F_addr_eq(heap->addr, hdr_end_addr)) { /* The header and data are contiguous */ - if (H5F_block_write(f, H5FD_MEM_LHEAP, addr, - (sizeof_hdr+heap->disk_alloc), + if (H5F_block_write(f, H5FD_MEM_LHEAP, addr, (sizeof_hdr + heap->disk_alloc), dxpl_id, heap->chunk) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap header and data to file"); + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap header and data to file") } else { - if (H5F_block_write(f, H5FD_MEM_LHEAP, addr, sizeof_hdr, - dxpl_id, heap->chunk)<0) - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap header to file"); + if (H5F_block_write(f, H5FD_MEM_LHEAP, addr, sizeof_hdr, dxpl_id, heap->chunk) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap header to file") + if (H5F_block_write(f, H5FD_MEM_LHEAP, heap->addr, heap->disk_alloc, dxpl_id, heap->chunk + sizeof_hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap data to file"); + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap data to file") } heap->cache_info.dirty = 0; } - /* - * Should we destroy the memory version? - */ + /* Should we destroy the memory version? */ if (destroy) { - if(H5HL_dest(f,heap)<0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap collection"); + if (H5HL_dest(f,heap) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap collection") } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -652,60 +735,121 @@ done: /*------------------------------------------------------------------------- - * Function: H5HL_peek + * Function: H5HL_protect + * + * Purpose: This function is a wrapper for the H5AC_protect call. The + * old H5HL_peek call (which this once was) wasn't "safe" + * for FPHDF5. (It'd get a read lock on an object but once + * it got that object, it'd release it keeping the old + * pointer value, which is no longer valid. This won't work + * since the pointer into some metdata block can become + * invalid.) + * + * N.B.: This function is always called in conjunction with + * the H5HL_offset_into function. The return from that + * function is the proper pointer to the heap's object. This + * is done so that the return from this function can be sent + * to H5HL_unprotect. + * + * Return: Success: Ptr to the object. The pointer points to a + * chunk of memory large enough to hold the + * object from the specified offset (usually the + * beginning of the object) to the end of the + * object. Do not attempt to read past the end + * of the object. + * Failure: NULL + * + * Programmer: Bill Wendling + * wendling@ncsa.uiuc.edu + * Sept. 17, 2003 * - * Purpose: This function is a more efficient version of H5HL_read. - * Instead of copying a heap object into a caller-supplied - * buffer, this function returns a pointer directly into the - * cache where the heap is being held. Thus, the return pointer - * is valid only until the next call to the cache. + * Modifications: * - * The address of the heap is ADDR in file F. OFFSET is the - * byte offset of the object from the beginning of the heap and - * may include an offset into the interior of the object. + *------------------------------------------------------------------------- + */ +const H5HL_t * +H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr) +{ + H5HL_t *ret_value = NULL; + + FUNC_ENTER_NOAPI(H5HL_protect, NULL); + + /* check arguments */ + assert(f); + assert(H5F_addr_defined(addr)); + + if (NULL == (ret_value = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap"); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- + * Function: H5HL_offset_into * - * Return: Success: Ptr to the object. The pointer points to - * a chunk of memory large enough to hold the - * object from the specified offset (usually - * the beginning of the object) to the end - * of the object. Do not attempt to read past - * the end of the object. + * Purpose: Called directly after the call to H5HL_protect so that + * a pointer to the object in the heap can be got. * - * Failure: NULL + * Return: Success: Valid pointer. + * Failure: NULL * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 16 1997 + * Programmer: Bill Wendling + * wendling@ncsa.uiuc.edu + * Sept. 17, 2003 * * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. + * + *------------------------------------------------------------------------- + */ +void * +H5HL_offset_into(H5F_t *f, const H5HL_t *heap, size_t offset) +{ + /* + * We need to have called some other function before this to get a + * valid heap pointer. So, this can remain "FUNC_ENTER_NOINIT" + */ + FUNC_ENTER_NOINIT(H5HL_offset_into) + assert(f); + assert(heap); + assert(offset < heap->mem_alloc); + FUNC_LEAVE_NOAPI(heap->chunk + H5HL_SIZEOF_HDR(f) + offset) +} + + +/*------------------------------------------------------------------------- + * Function: H5HL_unprotect + * + * Purpose: Unprotect the data retrieved by the H5HL_protect call. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Bill Wendling + * wendling@ncsa.uiuc.edu + * Sept. 17, 2003 + * + * Modifications: + * *------------------------------------------------------------------------- */ -const void * -H5HL_peek(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset) +herr_t +H5HL_unprotect(H5F_t *f, hid_t dxpl_id, const H5HL_t *heap, haddr_t addr) { - H5HL_t *heap; - const void *ret_value; + herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(H5HL_peek, NULL); + FUNC_ENTER_NOAPI(H5HL_peek, FAIL); /* check arguments */ assert(f); + assert(heap); assert(H5F_addr_defined(addr)); - if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap"); - - assert(offset < heap->mem_alloc); - - /* Set return value */ - ret_value = heap->chunk + H5HL_SIZEOF_HDR(f) + offset; + if (H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, FALSE) != SUCCEED) + HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header"); done: - if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, FALSE) != SUCCEED) - HDONE_ERROR(H5E_HEAP, H5E_PROTECT, NULL, "unable to release object header"); - FUNC_LEAVE_NOAPI(ret_value); } diff --git a/src/H5HLpkg.h b/src/H5HLpkg.h index 0b52c5f..8b099cc 100644 --- a/src/H5HLpkg.h +++ b/src/H5HLpkg.h @@ -61,7 +61,7 @@ typedef struct H5HL_free_t { struct H5HL_free_t *next; /*next entry in free list */ } H5HL_free_t; -typedef struct H5HL_t { +struct H5HL_t { H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ /* first field in structure */ haddr_t addr; /*address of data */ @@ -69,7 +69,8 @@ typedef struct H5HL_t { size_t mem_alloc; /*data bytes allocated in mem */ uint8_t *chunk; /*the chunk, including header */ H5HL_free_t *freelist; /*the free list */ -} H5HL_t; +}; + /******************************/ /* Package Private Prototypes */ /******************************/ diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h index 9c2e64b..5b56ad7 100644 --- a/src/H5HLprivate.h +++ b/src/H5HLprivate.h @@ -51,11 +51,20 @@ H5HL_ALIGN(H5F_SIZEOF_SIZE (F) + /*ptr to next free block */ \ H5F_SIZEOF_SIZE (F)) /*size of this free block */ +/****************************/ +/* Library Private Typedefs */ +/****************************/ + +/* Typedef for local heap in memory (defined in H5HLpkg.h) */ +typedef struct H5HL_t H5HL_t; + /* * Library prototypes... */ H5_DLL herr_t H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr/*out*/); -H5_DLL const void *H5HL_peek(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset); +H5_DLL const H5HL_t *H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr); +H5_DLL void *H5HL_offset_into(H5F_t *f, const H5HL_t *heap, size_t offset); +H5_DLL herr_t H5HL_unprotect(H5F_t *f, hid_t dxpl_id, const H5HL_t *heap, haddr_t addr); H5_DLL size_t H5HL_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf); H5_DLL herr_t H5HL_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size); diff --git a/src/H5Oefl.c b/src/H5Oefl.c index c9369e5..ec33293 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -91,6 +91,7 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *s H5O_efl_t *mesg = NULL; int i, version; const char *s = NULL; + const H5HL_t *heap; void *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5O_efl_decode, NULL); @@ -119,10 +120,19 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *s /* Heap address */ H5F_addr_decode(f, &p, &(mesg->heap_addr)); + #ifndef NDEBUG assert (H5F_addr_defined(mesg->heap_addr)); - s = H5HL_peek (f, dxpl_id, mesg->heap_addr, 0); + + if (NULL == (heap = H5HL_protect(f, dxpl_id, mesg->heap_addr))) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read protect link value") + + s = H5HL_offset_into(f, heap, 0); + assert (s && !*s); + + if (H5HL_unprotect(f, dxpl_id, heap, mesg->heap_addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read unprotect link value") #endif /* Decode the file list */ @@ -132,9 +142,17 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *s for (i=0; i<mesg->nused; i++) { /* Name */ H5F_DECODE_LENGTH (f, p, mesg->slot[i].name_offset); - s = H5HL_peek(f, dxpl_id, mesg->heap_addr, mesg->slot[i].name_offset); + + if (NULL == (heap = H5HL_protect(f, dxpl_id, mesg->heap_addr))) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read protect link value") + + s = H5HL_offset_into(f, heap, mesg->slot[i].name_offset); assert (s && *s); mesg->slot[i].name = H5MM_xstrdup (s); + assert(mesg->slot[i].name); + + if (H5HL_unprotect(f, dxpl_id, heap, mesg->heap_addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read unprotect link value") /* File offset */ H5F_DECODE_LENGTH (f, p, mesg->slot[i].offset); @@ -580,11 +580,15 @@ H5TB_less(H5TB_NODE * root, void * key, H5TB_cmp_t compar, int arg, H5TB_NODE ** /* didn't find an exact match, search back up the tree until a node */ /* is found with a key less than the key searched for */ if(cmp!=0) { - while((ptr=ptr->Parent)!=NULL) { - cmp = KEYcmp(key, ptr->key, arg); - if(cmp<0) /* found a node which is less than the search for one */ - break; - } /* end while */ + /* If we haven't already found the least node, then backtrack to + * find it */ + if(cmp>0) { + while((ptr=ptr->Parent)!=NULL) { + cmp = KEYcmp(key, ptr->key, arg); + if(cmp<0) /* found a node which is less than the search for one */ + break; + } /* end while */ + } /* end if */ if(ptr==NULL) /* didn't find a node in the tree which was less */ cmp=1; else /* reset this for cmp test below */ diff --git a/src/H5err.txt b/src/H5err.txt index d36a5fa..2f26e7d 100644 --- a/src/H5err.txt +++ b/src/H5err.txt @@ -142,6 +142,7 @@ MINOR, ATOM, H5E_NOIDS, Out of IDs for group # Cache related errors MINOR, CACHE, H5E_CANTFLUSH, Unable to flush data from cache +MINOR, CACHE, H5E_CANTSERIALIZE, Unable to serialize data from cache MINOR, CACHE, H5E_CANTLOAD, Unable to load metadata into cache MINOR, CACHE, H5E_PROTECT, Protected metadata error MINOR, CACHE, H5E_NOTCACHED, Metadata not currently cached |