From acd04a1aa67b182623f26979515ab8dd5b978f11 Mon Sep 17 00:00:00 2001 From: Robb Matzke Date: Thu, 6 Aug 1998 16:32:33 -0500 Subject: [svn-r579] Changes since 19980806 ---------------------- ./config/solaris2.5 Hopefully set up now so it honors the CC and CFLAGS variables and understands solaris cc flags. ./test/big.c Checks to see if creating lots of large sparse files exceeds the user disk quota and skips the test. It also checks that we can actually open ~64 files at once. ./doc/html/Files.html ./src/H5A.c ./src/H5Aprivate.h ./src/H5F.c ./src/H5Fpublic.h Added the H5Fflush() function which takes any object as an argument as long as the object is in some way associated with a file. This required an H5A_entof() ./src/H5.c ./src/H5Flow.c The `%a' format of HDfprintf() now allows a field width and justification flag etc, like the other formats. The old H5F_addr_print() was recoded to call HDfprintf() instead of vice versa. --- RELEASE | 3 + config/solaris2.5 | 44 +++++----- doc/html/Files.html | 9 +- src/.distdep | 246 +++++++++++++++++++++++++++------------------------- src/H5.c | 32 +++++-- src/H5A.c | 26 ++++++ src/H5Aprivate.h | 2 + src/H5F.c | 103 +++++++++++++++++++++- src/H5Flow.c | 23 +---- src/H5Fpublic.h | 1 + test/.distdep | 46 +++++----- test/big.c | 62 ++++++++++++- 12 files changed, 407 insertions(+), 190 deletions(-) diff --git a/RELEASE b/RELEASE index 97c7db2..63b8e9d 100644 --- a/RELEASE +++ b/RELEASE @@ -4,6 +4,9 @@ Release information for hdf5-1.0.23a * Strided hyperslab selections in dataspaces now working. +* The compression API has been replaced with a more general filter + API. See doc/html/Filters.html for details. + CHANGES SINCE THE FIRST ALPHA * Two of the packages have been renamed. The data space API has been diff --git a/config/solaris2.5 b/config/solaris2.5 index 581415e..74561c2 100644 --- a/config/solaris2.5 +++ b/config/solaris2.5 @@ -10,26 +10,30 @@ # flags like `-DH5G_DEBUG' since these are added with the # `--enable-debug' switch of configure. -# We can only use gcc -CC=gcc - -# What must *always* be present for things to compile correctly? -CFLAGS="$CFLAGS -ansi" -#CPPFLAGS="$CPPFLAGS -I." - -# What compiler flags should be used for code development? -DEBUG_CFLAGS=-g -DEBUG_CPPFLAGS= - -# What compiler flags should be used for building a production -# library? -PROD_CFLAGS=-O2 -PROD_CPPFLAGS= - -# What compiler flags enable code profiling? -PROFILE_CFLAGS=-pg -PROFILE_CPPFLAGS= - +# We use gcc unless something else is specified. +CC=${CC:-gcc} + +case $CC in + *gcc*) + CFLAGS="$CFLAGS -ansi" + DEBUG_CFLAGS="-g -fverbose-asm" + DEBUG_CPPFLAGS="-DH5F_LOW_DFLT=H5F_LOW_SEC2" + PROD_CFLAGS="-O3 -finline-functions" + PROD_CPPFLAGS= + PROFILE_CFLAGS=-pg + PROFILE_CPPFLAGS= + ;; + + *) + CFLAGS="-erroff=%none" + DEBUG_CFLAGS=-g + DEBUG_CPPFLAGS="-DH5F_LOW_DFLT=H5F_LOW_SEC2" + PROD_CFLAGS=-xO2 + PROD_CPPFLAGS= + PROFILE_CFLAGS=-xpg + PROFILE_CPPFLAGS= + ;; +esac #---------------------------------------------------------------------------- # Values for overriding configuration tests when cross compiling. diff --git a/doc/html/Files.html b/doc/html/Files.html index 791cc1f..9c13cec 100644 --- a/doc/html/Files.html +++ b/doc/html/Files.html @@ -74,6 +74,13 @@ opened by H5Fcreate() or H5Fopen(). After closing a file the file_id should not be used again. This function returns zero for success or a negative value for failure. + +

+
herr_t H5Fflush (hid_t object_id) +
This function will cause all buffers associated with a file + to be immediately flushed to the file. The object_id + can be any object which is associated with a file, including + the file itself.

4. File Property Lists

@@ -523,7 +530,7 @@
Robb Matzke
-Last modified: Tue Jun 9 15:03:44 EDT 1998 +Last modified: Thu Aug 6 16:17:08 EDT 1998 diff --git a/src/.distdep b/src/.distdep index d7abd6d..499fcc6 100644 --- a/src/.distdep +++ b/src/.distdep @@ -1,36 +1,3 @@ -H5A.o: \ - H5A.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Iprivate.h \ - H5Ipublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ - H5Dprivate.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Pprivate.h \ - H5Ppublic.h \ - H5Apkg.h \ - H5Aprivate.h H5E.o: \ H5E.c \ H5private.h \ @@ -39,29 +6,6 @@ H5E.o: \ H5Iprivate.h \ H5Ipublic.h \ H5Eprivate.h -H5F.o: \ - H5F.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Iprivate.h \ - H5Ipublic.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Pprivate.h \ - H5Ppublic.h \ - H5Zpublic.h H5Farray.o: \ H5Farray.c \ H5private.h \ @@ -106,19 +50,6 @@ H5Ffamily.o: \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h -H5Flow.o: \ - H5Flow.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ - H5MMprivate.h \ - H5MMpublic.h H5Fmpio.o: \ H5Fmpio.c \ H5private.h \ @@ -771,37 +702,6 @@ H5V.o: \ H5Tpublic.h \ H5Sprivate.h \ H5Spublic.h -H5.o: \ - H5.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Ipublic.h \ - H5Dpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Iprivate.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Pprivate.h \ - H5Ppublic.h \ - H5Zpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h H5AC.o: \ H5AC.c \ H5private.h \ @@ -973,6 +873,61 @@ H5Oefl.o: \ H5Sprivate.h \ H5Spublic.h \ H5Zprivate.h +H5Sselect.o: \ + H5Sselect.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Ipublic.h \ + H5Iprivate.h \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Zprivate.h \ + H5Zpublic.h +H5Z.o: \ + H5Z.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Ipublic.h \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Zprivate.h \ + H5Zpublic.h H5P.o: \ H5P.c \ H5private.h \ @@ -1024,48 +979,86 @@ H5S.o: \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h -H5Sselect.o: \ - H5Sselect.c \ +H5.o: \ + H5.c \ H5private.h \ H5public.h \ H5config.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Ipublic.h \ + H5Dpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ H5Eprivate.h \ H5Epublic.h \ - H5Ipublic.h \ H5Iprivate.h \ H5MMprivate.h \ H5MMpublic.h \ + H5Pprivate.h \ + H5Ppublic.h \ + H5Zpublic.h \ H5Sprivate.h \ H5Spublic.h \ H5Gprivate.h \ H5Gpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h +H5A.o: \ + H5A.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Iprivate.h \ + H5Ipublic.h \ H5Bprivate.h \ H5Bpublic.h \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ + H5Dprivate.h \ + H5Gprivate.h \ + H5Gpublic.h \ H5Oprivate.h \ H5Opublic.h \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ H5Zprivate.h \ - H5Zpublic.h -H5T.o: \ - H5T.c \ + H5Zpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Pprivate.h \ + H5Ppublic.h \ + H5Apkg.h \ + H5Aprivate.h +H5F.o: \ + H5F.c \ H5private.h \ H5public.h \ H5config.h \ - H5Dprivate.h \ - H5Dpublic.h \ + H5Aprivate.h \ + H5Apublic.h \ H5Ipublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ H5Gprivate.h \ H5Gpublic.h \ H5Bprivate.h \ H5Bpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Dprivate.h \ H5Oprivate.h \ H5Opublic.h \ H5HGprivate.h \ @@ -1077,28 +1070,41 @@ H5T.o: \ H5Zprivate.h \ H5Zpublic.h \ H5Iprivate.h \ + H5ACprivate.h \ + H5ACpublic.h \ H5Eprivate.h \ H5Epublic.h \ - H5MMprivate.h -H5Z.o: \ - H5Z.c \ + H5MMprivate.h \ + H5MMpublic.h +H5Flow.o: \ + H5Flow.c \ H5private.h \ H5public.h \ H5config.h \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ + H5MMprivate.h \ + H5MMpublic.h +H5T.o: \ + H5T.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Dprivate.h \ + H5Dpublic.h \ + H5Ipublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ H5Gprivate.h \ H5Gpublic.h \ H5Bprivate.h \ H5Bpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ @@ -1106,4 +1112,8 @@ H5Z.o: \ H5Sprivate.h \ H5Spublic.h \ H5Zprivate.h \ - H5Zpublic.h + H5Zpublic.h \ + H5Iprivate.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MMprivate.h diff --git a/src/H5.c b/src/H5.c index 84e6018..94291c0 100644 --- a/src/H5.c +++ b/src/H5.c @@ -452,9 +452,7 @@ H5close (void) * prints an `hsize_t' value as a hex number right justified and * zero filled in an 18-character field. * - * The conversion `a' refers to an `haddr_t*' type. Field widths - * and other flags are ignored and the address is printed by - * calling H5F_addr_print(). + * The conversion `a' refers to an `haddr_t*' type. * * Bugs: Return value will be incorrect if `%a' appears in the format * string. @@ -666,8 +664,32 @@ HDfprintf (FILE *stream, const char *fmt, ...) case 'a': if (1) { haddr_t *x = va_arg (ap, haddr_t*); - H5F_addr_print (stream, x); - n = 0; + if (x && H5F_addr_defined(x)) { + sprintf(template, "%%%s%s%s%s%s", + leftjust?"-":"", plussign?"+":"", + ldspace?" ":"", prefix?"#":"", + zerofill?"0":""); + if (fwidth>0) { + sprintf(template+strlen(template), "%d", fwidth); + } + if (sizeof(x->offset)==SIZEOF_INT) { + strcat(template, "d"); + } else if (sizeof(x->offset)==SIZEOF_LONG) { + strcat(template, "ld"); + } else if (sizeof(x->offset)==SIZEOF_LONG_LONG) { + strcat(template, PRINTF_LL_WIDTH); + strcat(template, "d"); + } + n = fprintf(stream, template, x->offset); + } else { + strcpy(template, "%"); + if (leftjust) strcat(template, "-"); + if (fwidth) { + sprintf(template+strlen(template), "%d", fwidth); + } + strcat(template, "s"); + fprintf(stream, template, x?"UNDEF":"NULL"); + } } break; diff --git a/src/H5A.c b/src/H5A.c index befe020..960f988 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -1494,3 +1494,29 @@ H5A_close(H5A_t *attr) FUNC_LEAVE(SUCCEED); } + +/*------------------------------------------------------------------------- + * Function: H5A_entof + * + * Purpose: Return the symbol table entry for an attribute. It's the + * symbol table entry for the object to which the attribute + * belongs, not the attribute itself. + * + * Return: Success: Ptr to entry + * + * Failure: NULL + * + * Programmer: Robb Matzke + * Thursday, August 6, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +H5G_entry_t * +H5A_entof(H5A_t *attr) +{ + FUNC_ENTER(H5A_entof, NULL); + assert(attr); + FUNC_LEAVE(&(attr->ent)); +} diff --git a/src/H5Aprivate.h b/src/H5Aprivate.h index 9557ddd..a1daf99 100644 --- a/src/H5Aprivate.h +++ b/src/H5Aprivate.h @@ -17,6 +17,7 @@ #define _H5Aprivate_H #include +#include #define H5A_RESERVED_ATOMS 0 typedef struct H5A_t H5A_t; @@ -26,5 +27,6 @@ typedef struct H5A_t H5A_t; /* Functions defined in H5A.c */ H5A_t * H5A_copy(const H5A_t *old_attr); herr_t H5A_close(H5A_t *attr); +H5G_entry_t *H5A_entof(H5A_t *attr); #endif diff --git a/src/H5F.c b/src/H5F.c index 5bacfef..b04b162 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -38,7 +38,9 @@ static char RcsId[] = "@(#)$Revision$"; /* Packages needed by this file... */ #include /*library functions */ -#include /* IDs */ +#include /*attributes */ +#include /*datasets */ +#include /*object IDs */ #include /*cache */ #include /*error handling */ #include /*symbol tables */ @@ -1287,6 +1289,105 @@ H5Fopen (const char *filename, unsigned flags, hid_t access_id) FUNC_LEAVE(ret_value); } + + +/*------------------------------------------------------------------------- + * Function: H5Fflush + * + * Purpose: Flushes all outstanding buffers of a file to disk but does + * not remove them from the cache. The OBJECT_ID can be a file, + * dataset, group, attribute, or named data type. + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Thursday, August 6, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5Fflush (hid_t object_id) +{ + H5F_t *f = NULL; + H5G_t *grp = NULL; + H5T_t *type = NULL; + H5D_t *dset = NULL; + H5A_t *attr = NULL; + H5G_entry_t *ent = NULL; + + FUNC_ENTER(H5Fflush, FAIL); + H5TRACE1("e","i",object_id); + + switch (H5I_group(object_id)) { + case H5_FILE: + if (NULL==(f=H5I_object(object_id))) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "invalid file identifier"); + } + break; + + case H5_GROUP: + if (NULL==(grp=H5I_object(object_id))) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "invalid group identifier"); + } + ent = H5G_entof(grp); + break; + + case H5_DATATYPE: + if (NULL==(type=H5I_object(object_id))) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "invalid type identifier"); + } + ent = H5T_entof(type); + break; + + case H5_DATASET: + if (NULL==(dset=H5I_object(object_id))) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "invalid dataset identifier"); + } + ent = H5D_entof(dset); + break; + + case H5_ATTR: + if (NULL==(attr=H5I_object(object_id))) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "invalid attribute identifier"); + } + ent = H5A_entof(attr); + break; + + default: + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "not a file or file object"); + } + + if (!f) { + if (!ent) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "object is not assocated with a file"); + } + f = ent->file; + } + if (!f) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "object is not associated with a file"); + } + + /* Flush the file */ + if (H5F_flush(f, FALSE)<0) { + HRETURN_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, + "flush failed"); + } + + FUNC_LEAVE(SUCCEED); +} + /*------------------------------------------------------------------------- * Function: H5F_flush diff --git a/src/H5Flow.c b/src/H5Flow.c index 2196341..f929e44 100644 --- a/src/H5Flow.c +++ b/src/H5Flow.c @@ -840,31 +840,12 @@ H5F_addr_decode(H5F_t *f, const uint8 **pp, haddr_t *addr/*out*/) void H5F_addr_print(FILE *stream, const haddr_t *addr) { - haddr_t tmp; - assert(stream); assert(addr); - if (addr_defined(addr)) { - /* - * It would be nice if we could use the `%Lu', `%llu', or `%qu', but - * we don't know which is supported. So we split the address into a - * low 4-bytes and a high 4-bytes. If the high 4-bytes are non-zero - * then we print the address in hexadecimal, otherwise we use decimal. - */ - tmp = *addr; - tmp.offset >>= 32; - if (tmp.offset) { - fprintf(stream, "0x%08lx%08lx", - (unsigned long) (tmp.offset), - (unsigned long) (addr->offset & 0xffffffff)); - } else { - fprintf(stream, "%lu", (unsigned long) (addr->offset)); - } - } else { - fprintf(stream, "UNDEF"); - } + HDfprintf(stream, "%a", addr); } + /*------------------------------------------------------------------------- * Function: H5F_addr_pow2 diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index b0536e7..90efdfa 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -81,6 +81,7 @@ hbool_t H5Fis_hdf5 (const char *filename); hid_t H5Fcreate (const char *filename, unsigned flags, hid_t create_plist, hid_t access_plist); hid_t H5Fopen (const char *filename, unsigned flags, hid_t access_plist); +herr_t H5Fflush(hid_t object_id); herr_t H5Fclose (hid_t file_id); hid_t H5Fget_create_template (hid_t file_id); hid_t H5Fget_access_template (hid_t file_id); diff --git a/test/.distdep b/test/.distdep index 2b28ca4..020d41a 100644 --- a/test/.distdep +++ b/test/.distdep @@ -388,29 +388,6 @@ shtype.o: \ ../src/H5Ppublic.h \ ../src/H5Zpublic.h \ ../src/H5Spublic.h -big.o: \ - big.c \ - ../src/hdf5.h \ - ../src/H5public.h \ - ../src/H5config.h \ - ../src/H5Ipublic.h \ - ../src/H5Apublic.h \ - ../src/H5ACpublic.h \ - ../src/H5Bpublic.h \ - ../src/H5Dpublic.h \ - ../src/H5Epublic.h \ - ../src/H5Fpublic.h \ - ../src/H5Gpublic.h \ - ../src/H5HGpublic.h \ - ../src/H5HLpublic.h \ - ../src/H5MFpublic.h \ - ../src/H5MMpublic.h \ - ../src/H5Opublic.h \ - ../src/H5Ppublic.h \ - ../src/H5Zpublic.h \ - ../src/H5Spublic.h \ - ../src/H5Tpublic.h \ - ../src/H5private.h links.o: \ links.c \ ../src/hdf5.h \ @@ -494,3 +471,26 @@ mtime.o: \ ../src/H5Spublic.h \ ../src/H5Tpublic.h \ ../src/H5private.h +big.o: \ + big.c \ + ../src/hdf5.h \ + ../src/H5public.h \ + ../src/H5config.h \ + ../src/H5Ipublic.h \ + ../src/H5Apublic.h \ + ../src/H5ACpublic.h \ + ../src/H5Bpublic.h \ + ../src/H5Dpublic.h \ + ../src/H5Epublic.h \ + ../src/H5Fpublic.h \ + ../src/H5Gpublic.h \ + ../src/H5HGpublic.h \ + ../src/H5HLpublic.h \ + ../src/H5MFpublic.h \ + ../src/H5MMpublic.h \ + ../src/H5Opublic.h \ + ../src/H5Ppublic.h \ + ../src/H5Zpublic.h \ + ../src/H5Spublic.h \ + ../src/H5Tpublic.h \ + ../src/H5private.h diff --git a/test/big.c b/test/big.c index c5aadd6..1ad79a2 100644 --- a/test/big.c +++ b/test/big.c @@ -92,6 +92,61 @@ is_sparse(void) /*------------------------------------------------------------------------- + * Function: enough_room + * + * Purpose: Tries to create a bunch of sparse files to see if quotas will + * get in the way. Some systems also have problems opening + * enough files and we'll check that too. + * + * Return: Success: Non-zero + * + * Failure: zero + * + * Programmer: Robb Matzke + * Thursday, August 6, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +enough_room(void) +{ + int ret_value=0; + int fd[68]; + size_t i, size = (size_t)1 << 30; + char name[32]; + + /* Initialize file descriptors */ + for (i=0; i=0; i++) { + sprintf(name, FNAME, i); + close(fd[i]); + unlink(name); + } + + return ret_value; +} + + +/*------------------------------------------------------------------------- * Function: writer * * Purpose: Creates a *big* dataset. @@ -327,11 +382,16 @@ main (void) * We shouldn't run this test if the file system doesn't support holes * because we would generate multi-gigabyte files. */ + puts("Checking if file system is adequate for this test..."); if (!is_sparse()) { puts("Test skipped because file system does not support holes."); exit(0); } - + if (!enough_room()) { + puts("Test skipped because of quota (file size or num open files)."); + exit(0); + } + /* Set the error handler */ H5Eset_auto (display_error_cb, NULL); -- cgit v0.12