diff options
author | Robb Matzke <matzke@llnl.gov> | 1997-12-11 21:35:46 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1997-12-11 21:35:46 (GMT) |
commit | faca6fbaa8c557b18d6b264841fc8717d1e73816 (patch) | |
tree | 2123e6290a24e6ad94c776e45283800cc6917f92 /src/H5H.c | |
parent | 3c16901751f40fcbbf36878fe13b0237a3753bc9 (diff) | |
download | hdf5-faca6fbaa8c557b18d6b264841fc8717d1e73816.zip hdf5-faca6fbaa8c557b18d6b264841fc8717d1e73816.tar.gz hdf5-faca6fbaa8c557b18d6b264841fc8717d1e73816.tar.bz2 |
[svn-r145] ./src/H5Osdtyp.c -> H5Odtype.c
./src/H5Osdim.c -> H5Osdspace.c
./src/Makefile.in
Changed the names of these files to better reflect what they
actually do.
./src/H5.c
./src/H5AC.c
./src/H5B.c
./src/H5C.c
./src/H5D.c
./src/H5E.c
./src/H5Eprivate.h
./src/H5Epublic.h
./src/H5F.c
./src/H5Fcore.c
./src/H5Ffamily.c
./src/H5Fistore.c
./src/H5Flow.c
./src/H5Fsec2.c
./src/H5Fsplit.c
./src/H5Fstdio.c
./src/H5G.c
./src/H5Gent.c
./src/H5Gnode.c
./src/H5Gshad.c
./src/H5Gstab.c
./src/H5H.c
./src/H5M.c
./src/H5MF.c
./src/H5O.c
./src/H5Osdtyp.c (./src/H5Odtype.c)
./src/H5P.c
./src/H5T.c
./src/H5detect.c
./src/H5private.h
Added an argument to the HRETURN_ERROR(), HGOTO_ERROR(), and
HERROR() macros which is a string error message. This allows
us to give extra information which can't be represented by the
major and minor error numbers. This information was
previously in comments just before or after the macro call.
The string isn't currently used, but I'm planning to change
the test files so they print an error trace when something
fails. This should make debugging a little faster since it's
often obvious what's wrong if we could just see the error
stack without even having to start a debugger.
Diffstat (limited to 'src/H5H.c')
-rw-r--r-- | src/H5H.c | 54 |
1 files changed, 36 insertions, 18 deletions
@@ -117,7 +117,8 @@ H5H_create (H5F_t *f, H5H_type_t heap_type, size_t size_hint, /* allocate file version */ total_size = H5H_SIZEOF_HDR(f) + size_hint; if (H5MF_alloc (f, H5MF_META, total_size, addr/*out*/)<0) { - HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL); + HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, + "unable to allocate file memory"); } /* allocate memory version */ @@ -143,7 +144,8 @@ H5H_create (H5F_t *f, H5H_type_t heap_type, size_t size_hint, if (H5AC_set (f, H5AC_HEAP, addr, heap)<0) { heap->chunk = H5MM_xfree (heap->chunk); heap->freelist = H5MM_xfree (heap->freelist); - HRETURN_ERROR (H5E_HEAP, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_HEAP, H5E_CANTINIT, FAIL, + "unable to cache heap"); } FUNC_LEAVE (SUCCEED); @@ -187,14 +189,16 @@ H5H_load (H5F_t *f, const haddr_t *addr, const void *udata1, void *udata2) assert (!udata2); if (H5F_block_read (f, addr, H5H_SIZEOF_HDR(f), hdr)<0) { - HRETURN_ERROR (H5E_HEAP, H5E_READERROR, NULL); + HRETURN_ERROR (H5E_HEAP, H5E_READERROR, NULL, + "unable to read heap header"); } p = hdr; heap = H5MM_xcalloc (1, sizeof(H5H_t)); /* magic number */ if (HDmemcmp (hdr, H5H_MAGIC, H5H_SIZEOF_MAGIC)) { - HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL); + HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, + "bad heap signature"); } p += H5H_SIZEOF_MAGIC; @@ -205,7 +209,8 @@ H5H_load (H5F_t *f, const haddr_t *addr, const void *udata1, void *udata2) /* free list head */ H5F_decode_length (f, p, free_block); if (free_block!=H5H_FREE_NULL && free_block>=heap->disk_alloc) { - HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL); + HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, + "bad heap free list"); } /* data */ @@ -214,13 +219,15 @@ H5H_load (H5F_t *f, const haddr_t *addr, const void *udata1, void *udata2) if (heap->disk_alloc && H5F_block_read (f, &(heap->addr), heap->disk_alloc, heap->chunk + H5H_SIZEOF_HDR(f))<0) { - HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL); + HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, + "unable to read heap data"); } /* free list */ while (H5H_FREE_NULL!=free_block) { if (free_block>=heap->disk_alloc) { - HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL); + HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, + "bad heap free list"); } fl = H5MM_xmalloc (sizeof (H5H_free_t)); fl->offset = free_block; @@ -235,7 +242,8 @@ H5H_load (H5F_t *f, const haddr_t *addr, const void *udata1, void *udata2) H5F_decode_length (f, p, fl->size); if (fl->offset + fl->size > heap->disk_alloc) { - HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL); + HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, + "bad heap free list"); } } @@ -297,7 +305,8 @@ H5H_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, H5H_t *heap) if (heap->mem_alloc > heap->disk_alloc) { haddr_t old_addr = heap->addr, new_addr; if (H5MF_alloc (f, H5MF_META, heap->mem_alloc, &new_addr/*out*/)<0) { - HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL); + HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, + "unable to allocate file space for heap"); } heap->addr = new_addr; H5MF_free (f, &old_addr, heap->disk_alloc); @@ -336,15 +345,18 @@ H5H_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, H5H_t *heap) /* The header and data are contiguous */ if (H5F_block_write (f, addr, H5H_SIZEOF_HDR(f)+heap->disk_alloc, heap->chunk)<0) { - HRETURN_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL); + HRETURN_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, + "unable to write heap header and data to disk"); } } else { if (H5F_block_write (f, addr, H5H_SIZEOF_HDR(f), heap->chunk)<0) { - HRETURN_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL); + HRETURN_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, + "unable to write heap header to disk"); } if (H5F_block_write (f, &(heap->addr), heap->disk_alloc, heap->chunk + H5H_SIZEOF_HDR(f))<0) { - HRETURN_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL); + HRETURN_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, + "unable to write heap data to disk"); } } @@ -411,7 +423,8 @@ H5H_read (H5F_t *f, const haddr_t *addr, size_t offset, size_t size, void *buf) assert (offset>=0); if (NULL==(heap=H5AC_find (f, H5AC_HEAP, addr, NULL, NULL))) { - HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL); + HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, + "unable to load heap"); } assert (offset<heap->mem_alloc); assert (offset+size<=heap->mem_alloc); @@ -471,7 +484,8 @@ H5H_peek (H5F_t *f, const haddr_t *addr, size_t offset) assert (offset>=0); if (NULL==(heap=H5AC_find (f, H5AC_HEAP, addr, NULL, NULL))) { - HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL); + HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, + "unable to load heap"); } assert (offset<heap->mem_alloc); @@ -549,7 +563,8 @@ H5H_insert (H5F_t *f, const haddr_t *addr, size_t buf_size, const void *buf) assert (buf); if (NULL==(heap=H5AC_find (f, H5AC_HEAP, addr, NULL, NULL))) { - HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL); + HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL, + "unable to load heap"); } heap->dirty += 1; @@ -704,7 +719,8 @@ H5H_write (H5F_t *f, const haddr_t *addr, size_t offset, size_t size, assert (buf); if (NULL==(heap=H5AC_find (f, H5AC_HEAP, addr, NULL, NULL))) { - HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL); + HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL, + "unable to load heap"); } assert (offset<heap->mem_alloc); assert (offset+size<=heap->mem_alloc); @@ -766,7 +782,8 @@ H5H_remove (H5F_t *f, const haddr_t *addr, size_t offset, size_t size) assert (size>0); if (NULL==(heap=H5AC_find (f, H5AC_HEAP, addr, NULL, NULL))) { - HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL); + HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL, + "unable to load heap"); } assert (offset<heap->mem_alloc); assert (offset+size<=heap->mem_alloc); @@ -882,7 +899,8 @@ H5H_debug (H5F_t *f, const haddr_t *addr, FILE *stream, intn indent, intn fwidth assert (fwidth>=0); if (NULL==(h=H5AC_find (f, H5AC_HEAP, addr, NULL, NULL))) { - HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL); + HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL, + "unable to load heap"); } fprintf (stream, "%*sHeap...\n", indent, ""); |