diff options
author | Robb Matzke <matzke@llnl.gov> | 1999-02-15 17:38:04 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1999-02-15 17:38:04 (GMT) |
commit | c22bac0d207abbdd81123c35681f0558f75de488 (patch) | |
tree | 98db51d9303724a07f13558a7490881e89c6e6ad /src | |
parent | f6272d42929093a81aa2da79f150333793de49e0 (diff) | |
download | hdf5-c22bac0d207abbdd81123c35681f0558f75de488.zip hdf5-c22bac0d207abbdd81123c35681f0558f75de488.tar.gz hdf5-c22bac0d207abbdd81123c35681f0558f75de488.tar.bz2 |
[svn-r1065] Changes since 19990121
----------------------
./configure.in
./acconfig.h
./configure [REGENERATED]
./src/H5config.h.in [REGENERATED]
./src/H5public.h
./src/H5Omtime.c
Check for <stddef.h>
Checks for `__tm_gmtoff' in `struct tm' because old versions
of GNU libc are different than recent versions. This fixes the
failing mtime test.
./bin/config.guess
./config/freebsd2.2.7 [REMOVED]
./config/freebsd [ADDED]
Changed the name so it works with all versions of FreeBSD.
./src/H5.c
Moved H5F after H5T and H5G in H5_term_library() to satisfy
dependencies.
./src/H5G.c
Fixed a bug that caused H5Gcreate() to fail if the group name
had trailing slashes.
./src/H5Gpublic.h
Changed `group_name' to `name' in a prototype.
./src/Makefile.in
Dynamic library on Linux, but needs for work to be generally
useful.
./src/H5HG.c
./src/H5HGprivate.h
Fixed alignment problems when using old GCC compilers (like
the one shipped with RedHad Linux).
./tools/h5ls.c
Fixed a bug where the contents of the root group could be
listed twice if there was a link back to the root
group. Similarly for groups that are mentioned on the command
line.
Fixed a bug where unknown types were printed with a random
type class number.
./src/H5T.c
./src/H5Tconv.c
./src/H5Tprivate.h
Fixed O(log N) conversion bugs.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5.c | 13 | ||||
-rw-r--r-- | src/H5G.c | 5 | ||||
-rw-r--r-- | src/H5Gpublic.h | 2 | ||||
-rw-r--r-- | src/H5HG.c | 28 | ||||
-rw-r--r-- | src/H5HGprivate.h | 25 | ||||
-rw-r--r-- | src/H5Omtime.c | 5 | ||||
-rw-r--r-- | src/H5T.c | 39 | ||||
-rw-r--r-- | src/H5Tconv.c | 28 | ||||
-rw-r--r-- | src/H5Tprivate.h | 5 | ||||
-rw-r--r-- | src/H5config.h.in | 6 | ||||
-rw-r--r-- | src/H5public.h | 8 | ||||
-rw-r--r-- | src/Makefile.in | 5 |
12 files changed, 127 insertions, 42 deletions
@@ -143,6 +143,17 @@ H5_term_library(void) * interface later. */ + /* + * Cycles: The H5F layer participates in quite a few dependency cycles + * because it's cache depends on almost all other meta object + * packages and those packages depend on H5O which depends on H5F + * (because H5F_close() can delay until all object headers are + * closed). We handle this cycle by closing the H5F interface, + * which flushes the cache of all files, breaking any cycles. + */ + H5F_term_interface(-1); + H5F_term_interface(0); + /* Function What depends on it? */ /*------------------------- ------------------------------- */ H5D_term_interface(-1); /* */ @@ -150,12 +161,12 @@ H5_term_library(void) H5Z_term_interface(-1); /* */ H5A_term_interface(-1); /* */ H5RA_term_interface(-1); /* */ - H5F_term_interface(-1); /* T */ H5G_term_interface(-1); /* */ H5R_term_interface(-1); /* */ H5S_term_interface(-1); /* */ H5T_native_close(-1); /* D RA */ H5T_term_interface(-1); /* D RA */ + H5F_term_interface(-1); /* G T */ H5P_term_interface(-1); /* D */ H5I_term_interface(-1); /* A D F G P RA S T TB Z */ /*------------------------- --------------------------------- */ @@ -1263,9 +1263,10 @@ H5G_create(H5G_entry_t *loc, const char *name, size_t size_hint) rest = H5G_component(rest, &nchars); assert(rest && *rest); if (rest[nchars]) { - if (H5G_component(rest + nchars, NULL)) { + const char *t = H5G_component(rest+nchars, NULL); + if (t && *t) { HRETURN_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "missing component"); - } else if (nchars + 1 > sizeof _comp) { + } else if (nchars+1 > sizeof _comp) { HRETURN_ERROR(H5E_SYM, H5E_COMPLEN, NULL, "component is too long"); } else { /* null terminate */ diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index 8c01bae..f2b9fbf 100644 --- a/src/H5Gpublic.h +++ b/src/H5Gpublic.h @@ -67,7 +67,7 @@ typedef struct H5G_stat_t { } H5G_stat_t; -typedef herr_t (*H5G_iterate_t)(hid_t group, const char *group_name, +typedef herr_t (*H5G_iterate_t)(hid_t group, const char *name, void *op_data); __DLL__ hid_t H5Gcreate (hid_t loc_id, const char *name, size_t size_hint); @@ -96,6 +96,7 @@ H5HG_create (H5F_t *f, size_t size) H5HG_heap_t *ret_value = NULL; uint8_t *p = NULL; haddr_t addr; + size_t n; FUNC_ENTER (H5HG_create, NULL); @@ -135,8 +136,18 @@ H5HG_create (H5F_t *f, size_t size) *p++ = 0; /*reserved*/ H5F_encode_length (f, p, size); + /* + * Padding so free space object is aligned. If malloc returned memory + * which was always at least H5HG_ALIGNMENT aligned then we could just + * align the pointer, but this might not be the case. + */ + n = H5HG_ALIGN(p-heap->chunk) - (p-heap->chunk); + memset(p, 0, n); + p += n; + /* The freespace object */ heap->obj[0].size = size - H5HG_SIZEOF_HDR(f); + assert(H5HG_ISALIGNED(heap->obj[0].size)); heap->obj[0].begin = p; UINT16ENCODE(p, 0); /*object ID*/ UINT16ENCODE(p, 0); /*reference count*/ @@ -301,7 +312,7 @@ H5HG_load (H5F_t *f, const haddr_t *addr, const void __unused__ *udata1, * size is never padded and already includes the object header. */ if (idx>0) { - need = H5HG_ALIGN(H5HG_SIZEOF_OBJHDR(f) + heap->obj[idx].size); + need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(heap->obj[idx].size); } else { need = heap->obj[idx].size; } @@ -309,7 +320,7 @@ H5HG_load (H5F_t *f, const haddr_t *addr, const void __unused__ *udata1, } } assert(p==heap->chunk+heap->size); - assert(heap->obj[0].size==H5HG_ALIGN(heap->obj[0].size)); + assert(H5HG_ISALIGNED(heap->obj[0].size)); /* * Add the new heap to the CWFS list, removing some other entry if @@ -434,7 +445,7 @@ H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, int cwfsno, size_t size) { int idx; uint8_t *p = NULL; - size_t need = H5HG_ALIGN(H5HG_SIZEOF_OBJHDR(f) + size); + size_t need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size); FUNC_ENTER (H5HG_alloc, FAIL); @@ -487,6 +498,7 @@ H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, int cwfsno, size_t size) UINT16ENCODE(p, 0); /*nrefs*/ UINT32ENCODE(p, 0); /*reserved*/ H5F_encode_length (f, p, heap->obj[0].size); + assert(H5HG_ISALIGNED(heap->obj[0].size)); } else { /* @@ -495,6 +507,7 @@ H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, int cwfsno, size_t size) */ heap->obj[0].size -= need; heap->obj[0].begin += need; + assert(H5HG_ISALIGNED(heap->obj[0].size)); } heap->dirty = 1; @@ -546,7 +559,7 @@ H5HG_insert (H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/) } /* Find a large enough collection on the CWFS list */ - need = H5HG_ALIGN(size + H5HG_SIZEOF_OBJHDR(f)); + need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size); for (cwfsno=0; cwfsno<f->shared->ncwfs; cwfsno++) { if (f->shared->cwfs[cwfsno]->obj[0].size>=need) { /* @@ -819,8 +832,11 @@ H5HG_remove (H5F_t *f, H5HG_t *hobj) assert (hobj->idx>0 && hobj->idx<heap->nalloc); assert (heap->obj[hobj->idx].begin); obj_start = heap->obj[hobj->idx].begin; - need = H5HG_ALIGN(heap->obj[hobj->idx].size); - + need = H5HG_ALIGN(heap->obj[hobj->idx].size); /* + * should this include the + * object header size? -rpm + */ + /* Move the new free space to the end of the heap */ for (i=0; i<heap->nalloc; i++) { if (heap->obj[i].begin > heap->obj[hobj->idx].begin) { diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h index 6b64e8d..c4e0f1f 100644 --- a/src/H5HGprivate.h +++ b/src/H5HGprivate.h @@ -32,6 +32,7 @@ #define H5HG_ALIGNMENT 8 #define H5HG_ALIGN(X) (H5HG_ALIGNMENT*(((X)+H5HG_ALIGNMENT-1)/ \ H5HG_ALIGNMENT)) +#define H5HG_ISALIGNED(X) ((X)==H5HG_ALIGN(X)) /* * All global heap collections are at least this big. This allows us to read @@ -53,20 +54,24 @@ #define H5HG_MAXLINK 65535 /* - * The size of the collection header. + * The size of the collection header, always a multiple of the alignment so + * that the stuff that follows the header is aligned. */ -#define H5HG_SIZEOF_HDR(f) (4 + /*magic number */ \ - 1 + /*version number */ \ - 3 + /*reserved */ \ - H5F_SIZEOF_SIZE(f)) /*collection size */ +#define H5HG_SIZEOF_HDR(f) \ + H5HG_ALIGN(4 + /*magic number */ \ + 1 + /*version number */ \ + 3 + /*reserved */ \ + H5F_SIZEOF_SIZE(f)) /*collection size */ /* - * The overhead associated with each object in the heap. + * The overhead associated with each object in the heap, always a multiple of + * the alignment so that the stuff that follows the header is aligned. */ -#define H5HG_SIZEOF_OBJHDR(f) (2 + /*object id number */ \ - 2 + /*reference count */ \ - 4 + /*reserved */ \ - H5F_SIZEOF_SIZE(f)) /*object data size */ +#define H5HG_SIZEOF_OBJHDR(f) \ + H5HG_ALIGN(2 + /*object id number */ \ + 2 + /*reference count */ \ + 4 + /*reserved */ \ + H5F_SIZEOF_SIZE(f)) /*object data size */ /* * The initial guess for the number of messages in a collection. We assume diff --git a/src/H5Omtime.c b/src/H5Omtime.c index 3e4acb0..36157be 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -109,8 +109,11 @@ H5O_mtime_decode(H5F_t __unused__ *f, const uint8_t *p, #if defined(HAVE_TM_GMTOFF) /* FreeBSD, OSF 4.0 */ the_time += tm.tm_gmtoff; +#elif defined(HAVE___TM_GMTOFF) + /* Linux libc-4 */ + the_time += tm.__tm_gmtoff; #elif defined(HAVE_TIMEZONE) - /* Linux */ + /* Linux libc-5 */ the_time -= timezone - (tm.tm_isdst?3600:0); #elif defined(HAVE_BSDGETTIMEOFDAY) && defined(HAVE_STRUCT_TIMEZONE) /* Irix5.3 */ @@ -5075,7 +5075,7 @@ H5T_pack(H5T_t *dt) } /* Remove padding between members */ - H5T_sort_value(dt); + H5T_sort_value(dt, NULL); for (i=0, offset=0; i<dt->u.compnd.nmembs; i++) { dt->u.compnd.memb[i].offset = offset; offset += dt->u.compnd.memb[i].size; @@ -5095,7 +5095,8 @@ H5T_pack(H5T_t *dt) * Purpose: Sorts the members of a compound data type by their offsets; * sorts the members of an enum type by their values. This even * works for locked data types since it doesn't change the value - * of the type. + * of the type. MAP is an optional parallel integer array which + * is also swapped along with members of DT. * * Return: Non-negative on success/Negative on failure * @@ -5107,7 +5108,7 @@ H5T_pack(H5T_t *dt) *------------------------------------------------------------------------- */ herr_t -H5T_sort_value(H5T_t *dt) +H5T_sort_value(H5T_t *dt, int *map) { int i, j, nmembs; size_t size; @@ -5132,6 +5133,11 @@ H5T_sort_value(H5T_t *dt) H5T_cmemb_t tmp = dt->u.compnd.memb[j]; dt->u.compnd.memb[j] = dt->u.compnd.memb[j+1]; dt->u.compnd.memb[j+1] = tmp; + if (map) { + int x = map[j]; + map[j] = map[j+1]; + map[j+1] = x; + } swapped = TRUE; } } @@ -5166,6 +5172,13 @@ H5T_sort_value(H5T_t *dt) dt->u.enumer.value+(j+1)*size, size); HDmemcpy(dt->u.enumer.value+(j+1)*size, tbuf, size); + /* Swap map */ + if (map) { + int x = map[j]; + map[j] = map[j+1]; + map[j+1] = x; + } + swapped = TRUE; } } @@ -5204,7 +5217,7 @@ H5T_sort_value(H5T_t *dt) *------------------------------------------------------------------------- */ herr_t -H5T_sort_name(H5T_t *dt) +H5T_sort_name(H5T_t *dt, int *map) { int i, j, nmembs; size_t size; @@ -5230,6 +5243,11 @@ H5T_sort_name(H5T_t *dt) dt->u.compnd.memb[j] = dt->u.compnd.memb[j+1]; dt->u.compnd.memb[j+1] = tmp; swapped = TRUE; + if (map) { + int x = map[j]; + map[j] = map[j+1]; + map[j+1] = x; + } } } } @@ -5261,7 +5279,14 @@ H5T_sort_name(H5T_t *dt) HDmemcpy(dt->u.enumer.value+j*size, dt->u.enumer.value+(j+1)*size, size); HDmemcpy(dt->u.enumer.value+(j+1)*size, tbuf, size); - + + /* Swap map */ + if (map) { + int x = map[j]; + map[j] = map[j+1]; + map[j+1] = x; + } + swapped = TRUE; } } @@ -5390,7 +5415,7 @@ H5T_enum_nameof(H5T_t *dt, void *value, char *name/*out*/, size_t size) if (name && size>0) *name = '\0'; /* Do a binary search over the values to find the correct one */ - H5T_sort_value(dt); + H5T_sort_value(dt, NULL); lt = 0; rt = dt->u.enumer.nmembs; md = -1; @@ -5458,7 +5483,7 @@ H5T_enum_valueof(H5T_t *dt, const char *name, void *value/*out*/) assert(value); /* Do a binary search over the names to find the correct one */ - H5T_sort_name(dt); + H5T_sort_name(dt, NULL); lt = 0; rt = dt->u.enumer.nmembs; md = -1; diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 86ccea3..8816894 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -550,8 +550,8 @@ H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) /* * Insure that members are sorted. */ - H5T_sort_value(src); - H5T_sort_value(dst); + H5T_sort_value(src, NULL); + H5T_sort_value(dst, NULL); /* * Build a mapping from source member number to destination member @@ -761,8 +761,8 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* * Insure that members are sorted. */ - H5T_sort_value(src); - H5T_sort_value(dst); + H5T_sort_value(src, NULL); + H5T_sort_value(dst, NULL); src2dst = priv->src2dst; /* @@ -910,8 +910,8 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) * symbol names and build a map from source member index to destination * member index. */ - H5T_sort_name(src); - H5T_sort_name(dst); + H5T_sort_name(src, NULL); + H5T_sort_name(dst, NULL); if (NULL==(priv->src2dst=H5MM_malloc(src->u.enumer.nmembs*sizeof(int)))) { HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");; @@ -994,6 +994,9 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) H5MM_xfree(priv->src2dst); priv->src2dst = map; HGOTO_DONE(SUCCEED); + } else { + /* Sort source type by value and adjust src2dst[] appropriately */ + H5T_sort_value(src, priv->src2dst); } } ret_value = SUCCEED; @@ -1082,9 +1085,17 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, } assert (H5T_ENUM==src->type); assert (H5T_ENUM==dst->type); - H5T_sort_name(src); - H5T_sort_name(dst); + if (priv->length) { + /* Use O(1) lookup */ + H5T_sort_name(src, NULL); + H5T_sort_name(dst, NULL); + } else { + /* Use O(log N) lookup */ + H5T_sort_value(src, NULL); /*yes, by value*/ + H5T_sort_name(dst, NULL); /*yes, by name*/ + } + /* * Direction of conversion. */ @@ -1109,6 +1120,7 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, } else { n = *((int*)s); } + n -= priv->base; if (n<0 || n>=priv->length || priv->src2dst[n]<0) { if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, s, d)<0) { diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 460f0db..34fbf52 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -77,14 +77,13 @@ __DLL__ herr_t H5T_struct_insert(H5T_t *parent, const char *name, size_t offset, intn ndims, const size_t *dim, const intn *perm, const H5T_t *member); __DLL__ herr_t H5T_enum_insert(H5T_t *dt, const char *name, void *value); -__DLL__ herr_t H5T_sort_value(H5T_t *dt); __DLL__ herr_t H5T_pack(H5T_t *dt); __DLL__ herr_t H5T_debug(H5T_t *dt, FILE * stream); __DLL__ H5G_entry_t *H5T_entof(H5T_t *dt); __DLL__ H5T_path_t *H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, H5T_conv_t func); -__DLL__ herr_t H5T_sort_vaue(H5T_t *dt); -__DLL__ herr_t H5T_sort_name(H5T_t *dt); +__DLL__ herr_t H5T_sort_value(H5T_t *dt, int *map); +__DLL__ herr_t H5T_sort_name(H5T_t *dt, int *map); __DLL__ herr_t H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts, void *buf, void *bkg); __DLL__ herr_t H5T_set_size(H5T_t *dt, size_t size); diff --git a/src/H5config.h.in b/src/H5config.h.in index 12b7523..fd69a2c 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -50,6 +50,9 @@ /* Define if `tm_gmtoff' is a member of `struct tm' */ #undef HAVE_TM_GMTOFF +/* Define if `__tm_gmtoff' is a member of `struct tm' */ +#undef HAVE___TM_GMTOFF + /* Define if `timezone' is a global variable */ #undef HAVE_TIMEZONE @@ -191,6 +194,9 @@ /* Define if you have the <mfhdf.h> header file. */ #undef HAVE_MFHDF_H +/* Define if you have the <stddef.h> header file. */ +#undef HAVE_STDDEF_H + /* Define if you have the <sys/ioctl.h> header file. */ #undef HAVE_SYS_IOCTL_H diff --git a/src/H5public.h b/src/H5public.h index 57c88ef..a895834 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -29,10 +29,12 @@ static char RcsId[] = "@(#)$Revision$"; # include <limits.h> /*for H5T_NATIVE_CHAR defn in H5Tpublic.h */ #endif -#include <stddef.h> +#ifdef HAVE_STDDEF_H +# include <stddef.h> +#endif #ifdef HAVE_PARALLEL -# include <mpi.h> -# include <mpio.h> +# include <mpi.h> +# include <mpio.h> #endif #include <H5api_adpt.h> diff --git a/src/Makefile.in b/src/Makefile.in index ca2a302..7f4f84c 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -50,4 +50,9 @@ H5Tinit.c: H5detect H5detect: H5detect.o $(CC) $(CFLAGS) -o $@ H5detect.o $(LDFLAGS) $(LIBS) +# dynamic library with gcc. This needs more work to support other systems. +shared: libhdf5.so.1.2.0 +libhdf5.so.1.2.0: $(LIB_OBJ) + $(CC) $(CFLAGS) -o $@ -shared -fPIC $^ + @CONCLUDE@ |