[svn-r339] Changes since 19980408

----------------------

./src/H5Osdspace.c
./html/H5.format.html
	In the past we were allowed to have >2GB files on a 32-bit
	machine as long as no dataset within the file was larger than
	4GB (or whatever sizeof(size_t) is).  That's been fixed now.
	All dataset size calculations are done with `hsize_t' which is
	normally defined as `unsigned long long'.

./src/H5F.c
./src/H5Ffamily.c
./src/H5Fprivate.h
./src/H5P.c
./src/H5Ppublic.h
	The file family member size can now be set/queried.  The
	default is still 64MB, but it can be set to 1GB by saying:

	    H5Pset_family (plist, 30, H5P_DEFAULT);

	When opening an existing file family the specified
	bits-per-member is ignored and the first member of the family
	determines the bits-per-member, which can be retrieved with
	H5Pget_family().

./acconfig.h
./configure.in
./src/H5config.h
./src/H5public.h
	Added `--disable-hsizet' so that those with old GCC compilers
	(<2.8.1) can still compile the code.


./src/H5.c
./src/H5private.h
	Added HDfprintf() which works just like fprintf() except you
	can give `H' as a size modifier for the integer conversions
	and supply an `hsize_t' or `hssize_t' argument without casting
	it.  For instance:

	    hsize_t npoints = H5Sget_npoints(space);
	    HDfprintf(stdout,"Dataset has %Hd (%#018Hx) points\n",
		      npoints, npoints);

	You can now give `%a' as a format to print an address, but all
	formating flags are ignored and it causes the return value of
	HDfprintf() to not include the characters in the address (but
	who uses the return value anyway :-). Example:

	    H5G_t *grp;
	    HDfprintf(stdout, "Group object header at %a\n",
	              &(grp->ent.header));

	Added HDstrtoll() which works exactly like [HD]strtol() except
	the result is an int64.

./src/debug.c
	Large addresses can now be entered from the command-line.  Use
	either decimal, octal (leading `0') or hexadecimal (leading
	`0x') when giving the address.

./src/h5ls.c
	The printf format for dataset dimensions was changed to `%Hu'
	to support large datasets.

./test/big.c		[NEW]
	A test for big datasets on 32-bit machines.  This test is not
	run by default.  Don't try to run it on an nfs-mounted file
	system or other file system that doesn't support holes because
	it creates two 32GB datasets of all zero.
This commit is contained in:
Robb Matzke 1998-04-09 15:22:11 -05:00
parent c01750fa74
commit c96611f8b5
19 changed files with 1140 additions and 593 deletions

View File

@ -185,6 +185,7 @@
./src/hdf5.h
./test/.distdep
./test/Makefile.in
./test/big.c
./test/cmpd_dset.c
./test/dsets.c
./test/dspace.c

View File

@ -6,3 +6,6 @@
/* Define if we have parallel support */
#undef HAVE_PARALLEL
/* Define if it's safe to use `long long' for hsize_t and hssize_t */
#undef HAVE_LARGE_HSIZET

976
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -136,27 +136,10 @@ AC_CHECK_HEADERS(unistd.h)
dnl ----------------------------------------------------------------------
dnl Data types.
dnl Data types and their sizes.
dnl
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
dnl ----------------------------------------------------------------------
dnl Check for functions.
dnl
AC_CHECK_FUNCS(getpwuid gethostname system)
AC_TRY_COMPILE([#include<sys/types.h>],
[off64_t n = 0;],
AC_CHECK_FUNCS(lseek64 fseek64),
AC_MSG_RESULT([skipping test for lseek64() and fseek64()]))
dnl ----------------------------------------------------------------------
dnl Check sizes of various integral data types.
dnl
AC_C_BIGENDIAN
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
@ -170,6 +153,35 @@ cat >>confdefs.h <<\EOF
EOF
AC_CHECK_SIZEOF(off_t, 4)
AC_ARG_ENABLE(hsizet,
[--disable-hsizet Datasets can normally be larger than memory
and/or files but some compilers are unable to
handle this (including versions of GCC before
2.8.0). Disabling the feature causes dataset
sizes to be restricted to the size of core memory,
or 'size_t'.],
HSIZET=$enableval)
AC_MSG_CHECKING(for sizeof hsize_t and hssize_t)
case $HSIZET in
no|small)
AC_MSG_RESULT(small)
;;
*)
AC_MSG_RESULT(large)
AC_DEFINE(HAVE_LARGE_HSIZET)
;;
esac
dnl ----------------------------------------------------------------------
dnl Check for functions.
dnl
AC_CHECK_FUNCS(getpwuid gethostname system)
AC_TRY_COMPILE([#include<sys/types.h>],
[off64_t n = 0;],
AC_CHECK_FUNCS(lseek64 fseek64),
AC_MSG_RESULT([skipping test for lseek64() and fseek64()]))
dnl ----------------------------------------------------------------------

369
src/H5.c
View File

@ -35,6 +35,10 @@ static char RcsId[] = "@(#)$Revision$";
H5_init_interface -- initialize the H5 interface
+ */
#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
/* private headers */
#include <H5private.h> /*library */
#include <H5ACprivate.h> /*cache */
@ -369,3 +373,368 @@ H5close (void)
H5_term_library ();
return SUCCEED;
}
/*-------------------------------------------------------------------------
* Function: HDfprintf
*
* Purpose: Prints the optional arguments under the control of the format
* string FMT to the stream STREAM. This function takes the
* same format as fprintf(3c) with a few added features:
*
* The conversion modifier `H' refers to the size of an
* `hsize_t' or `hssize_t' type. For instance, "0x%018Hx"
* 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().
*
* Bugs: Return value will be incorrect if `%a' appears in the format
* string.
*
* Return: Success: Number of characters printed
*
* Failure: -1
*
* Programmer: Robb Matzke
* Thursday, April 9, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
int
HDfprintf (FILE *stream, const char *fmt, ...)
{
int n, nout = 0;
int fwidth, prec;
int zerofill;
int leftjust;
int plussign;
int ldspace;
int prefix;
int modifier;
int conv;
char *rest, template[128];
const char *s;
va_list ap;
assert (stream);
assert (fmt);
va_start (ap, fmt);
while (*fmt) {
fwidth = prec = 0;
zerofill = 0;
leftjust = 0;
plussign = 0;
prefix = 0;
ldspace = 0;
modifier = 0;
if ('%'==fmt[0] && '%'==fmt[1]) {
putc ('%', stream);
fmt += 2;
nout++;
} else if ('%'==fmt[0]) {
s = fmt+1;
/* Flags */
while (strchr ("-+ #", *s)) {
switch (*s) {
case '-':
leftjust = 1;
break;
case '+':
plussign = 1;
break;
case ' ':
ldspace = 1;
break;
case '#':
prefix = 1;
break;
}
s++;
}
/* Field width */
if (isdigit (*s)) {
zerofill = ('0'==*s);
fwidth = strtol (s, &rest, 10);
s = rest;
} else if ('*'==*s) {
fwidth = va_arg (ap, int);
if (fwidth<0) {
leftjust = 1;
fwidth = -fwidth;
}
s++;
}
/* Precision */
if ('.'==*s) {
s++;
if (isdigit (*s)) {
prec = strtol (s+1, &rest, 10);
s = rest;
} else if ('*'==*s) {
prec = va_arg (ap, int);
s++;
}
if (prec<1) prec = 1;
}
/* Type modifier */
if (strchr ("Hhlq", *s)) {
switch (*s) {
case 'H':
if (sizeof(hsize_t)==sizeof(long)) {
modifier = 'l';
} else if (sizeof(hsize_t)==sizeof(long long)) {
modifier = 'q';
}
break;
default:
modifier = *s;
break;
}
s++;
}
/* Conversion */
conv = *s++;
/* Create the format template */
sprintf (template, "%%%s%s%s%s%s",
leftjust?"-":"", plussign?"+":"",
ldspace?" ":"", prefix?"#":"", zerofill?"0":"");
if (fwidth>0) {
sprintf (template+strlen (template), "%d", fwidth);
}
if (prec>0) {
sprintf (template+strlen (template), ".%d", prec);
}
if (modifier) {
sprintf (template+strlen (template), "%c", modifier);
}
sprintf (template+strlen (template), "%c", conv);
/* Conversion */
switch (conv) {
case 'd':
case 'i':
if ('h'==modifier) {
short x = va_arg (ap, short);
n = fprintf (stream, template, x);
} else if (!modifier) {
int x = va_arg (ap, int);
n = fprintf (stream, template, x);
} else if ('l'==modifier) {
long x = va_arg (ap, long);
n = fprintf (stream, template, x);
} else if ('q'==modifier) {
long long x = va_arg (ap, long long);
n = fprintf (stream, template, x);
}
break;
case 'o':
case 'u':
case 'x':
case 'X':
if ('h'==modifier) {
unsigned short x = va_arg (ap, unsigned short);
n = fprintf (stream, template, x);
} else if (!modifier) {
unsigned int x = va_arg (ap, unsigned int);
n = fprintf (stream, template, x);
} else if ('l'==modifier) {
unsigned long x = va_arg (ap, unsigned long);
n = fprintf (stream, template, x);
} else if ('q'==modifier) {
unsigned long long x = va_arg (ap, unsigned long long);
n = fprintf (stream, template, x);
}
break;
case 'f':
case 'e':
case 'E':
case 'g':
case 'G':
if ('h'==modifier) {
float x = va_arg (ap, float);
n = fprintf (stream, template, x);
} else if (!modifier || 'l'==modifier) {
double x = va_arg (ap, double);
n = fprintf (stream, template, x);
} else if ('q'==modifier) {
long double x = va_arg (ap, long double);
n = fprintf (stream, template, x);
}
case 'a':
if (1) {
haddr_t *x = va_arg (ap, haddr_t*);
H5F_addr_print (stream, x);
n = 0;
}
break;
case 'c':
if (1) {
char x = va_arg (ap, char);
n = fprintf (stream, template, x);
}
break;
case 's':
case 'p':
if (1) {
char *x = va_arg (ap, char*);
n = fprintf (stream, template, x);
}
break;
case 'n':
if (1) {
template[strlen(template)-1] = 'u';
n = fprintf (stream, template, nout);
}
break;
default:
fputs (template, stream);
n = strlen (template);
break;
}
nout += n;
fmt = s;
} else {
putc (*fmt, stream);
fmt++;
nout++;
}
}
va_end (ap);
return nout;
}
/*-------------------------------------------------------------------------
* Function: HDstrtoll
*
* Purpose: Converts the string S to an int64 value according to the
* given BASE, which must be between 2 and 36 inclusive, or be
* the special value zero.
*
* The string must begin with an arbitrary amount of white space
* (as determined by isspace(3c)) followed by a single optional
* `+' or `-' sign. If BASE is zero or 16 the string may then
* include a `0x' or `0X' prefix, and the number will be read in
* base 16; otherwise a zero BASE is taken as 10 (decimal)
* unless the next character is a `0', in which case it is taken
* as 8 (octal).
*
* The remainder of the string is converted to an int64 in the
* obvious manner, stopping at the first character which is not
* a valid digit in the given base. (In bases above 10, the
* letter `A' in either upper or lower case represetns 10, `B'
* represents 11, and so forth, with `Z' representing 35.)
*
* If REST is not null, the address of the first invalid
* character in S is stored in *REST. If there were no digits
* at all, the original value of S is stored in *REST. Thus, if
* *S is not `\0' but **REST is `\0' on return the entire string
* was valid.
*
* Return: Success: The result.
*
* Failure: If the input string does not contain any
* digits then zero is returned and REST points
* to the original value of S. If an overflow
* or underflow occurs then the maximum or
* minimum possible value is returned and the
* global `errno' is set to ERANGE. If BASE is
* incorrect then zero is returned.
*
* Programmer: Robb Matzke
* Thursday, April 9, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
int64
HDstrtoll (const char *s, const char **rest, int base)
{
int64 sign=1, acc=0;
hbool_t overflow = FALSE;
errno = 0;
if (!s || (base && (base<2 || base>36))) {
if (rest) *rest = s;
return 0;
}
/* Skip white space */
while (isspace (*s)) s++;
/* Optional minus or plus sign */
if ('+'==*s) {
s++;
} else if ('-'==*s) {
sign = -1;
s++;
}
/* Zero base prefix */
if (0==base && '0'==*s && ('x'==s[1] || 'X'==s[1])) {
base = 16;
s += 2;
} else if (0==base && '0'==*s) {
base = 8;
s++;
} else if (0==base) {
base = 10;
}
/* Digits */
while ((base<=10 && *s>='0' && *s<'0'+base) ||
(base>10 && ((*s>='0' && *s<='9') ||
(*s>='a' && *s<'a'+base-10) ||
(*s>='A' && *s<'A'+base-10)))) {
if (!overflow) {
int64 digit;
if (*s>='0' && *s<='9') digit = *s - '0';
else if (*s>='a' && *s<='z') digit = *s-'a'+10;
else digit = *s-'A'+10;
if (acc*base+digit < acc) {
overflow = TRUE;
} else {
acc = acc*base + digit;
}
}
s++;
}
/* Overflow */
if (overflow) {
if (sign>0) {
acc = ((uint64)1<<(8*sizeof(int64)-1))-1;
} else {
acc = (uint64)1<<(8*sizeof(int64)-1);
}
errno = ERANGE;
}
/* Return values */
acc *= sign;
if (rest) *rest = s;
return acc;
}

View File

@ -155,7 +155,7 @@ H5F_init_interface(void)
#elif (H5F_LOW_DFLT == H5F_LOW_SPLIT)
/* Nothing to initialize */
#elif (H5F_LOW_DFLT == H5F_LOW_FAMILY)
/* Nothing to initialize */
H5F_access_dflt.u.fam.offset_bits = 26u; /*64MB members*/
#else
# error "Unknown default file driver"
#endif
@ -809,11 +809,16 @@ H5F_open(const char *name, uintn flags,
/*
* Update the file creation parameters and file access parameters with
* default values if this is the first time this file is opened.
* default values if this is the first time this file is opened. Some of
* the properties may need to be updated.
*/
if (1 == f->shared->nrefs) {
f->shared->create_parms = *create_parms;
f->shared->access_parms = *access_parms;
if (H5F_LOW_FAMILY==f->shared->access_parms.driver) {
size_t x = f->shared->lf->u.fam.offset_bits;
f->shared->access_parms.u.fam.offset_bits = x;
}
}
cp = &(f->shared->create_parms);

View File

@ -30,16 +30,6 @@
static hbool_t interface_initialize_g = FALSE;
#define INTERFACE_INIT NULL
/*
* Number of bits in the member address. This can be up to (but not
* including) the number of bits in the `off_t' type, but be warned that some
* operating systems are not able to write to the last possible address of a
* file, so a safe maximum is two less than the number of bits in an `off_t'.
* Smaller values result in files of a more manageable size (from a human
* perspective) but also limit the total logical size of the hdf5 file.
*/
#define H5F_FAM_DFLT_NBITS 26u /*64MB */
#define H5F_FAM_MASK(N) (((uint64)1<<(N))-1)
#define H5F_FAM_OFFSET(ADDR,N) ((off_t)((ADDR)->offset & H5F_FAM_MASK(N)))
#define H5F_FAM_MEMBNO(ADDR,N) ((intn)((ADDR)->offset >> (N)))
@ -102,7 +92,7 @@ H5F_fam_open(const char *name, const H5F_access_t *access_parms,
H5F_low_t *member = NULL; /*a family member */
char member_name[4096]; /*name of family member */
intn membno; /*member number (zero-origin) */
size_t nbits = H5F_FAM_DFLT_NBITS; /*num bits in an offset */
size_t nbits; /*num bits in an offset */
haddr_t tmp_addr; /*temporary address */
const H5F_low_class_t *memb_type; /*type of family member */
@ -123,10 +113,10 @@ H5F_fam_open(const char *name, const H5F_access_t *access_parms,
/*
* If we're truncating the file then delete all but the first family
* member. Use the default number of bits for the offset.
* member.
*/
if ((flags & H5F_ACC_RDWR) && (flags & H5F_ACC_TRUNC)) {
for (membno = 1; /*void*/; membno++) {
for (membno=1; /*void*/; membno++) {
sprintf(member_name, name, membno);
if (!H5F_low_access(memb_type, member_name,
access_parms->u.fam.memb_access,
@ -174,12 +164,13 @@ H5F_fam_open(const char *name, const H5F_access_t *access_parms,
member = NULL;
}
/*
* If the first and second files exists then round the first file size up
* to the next power of two and use that as the number of bits per family
* member.
*/
/* Calculate member size */
if (lf->u.fam.nmemb >= 2) {
/*
* If the first and second files exists then round the first file size
* up to the next power of two and use that as the number of bits per
* family member.
*/
size_t size = H5F_low_size(lf->u.fam.memb[0], &tmp_addr);
for (nbits=8*sizeof(size_t)-1; nbits>0; --nbits) {
size_t mask = (size_t)1 << nbits;
@ -194,6 +185,23 @@ H5F_fam_open(const char *name, const H5F_access_t *access_parms,
break;
}
}
} else {
/*
* Typically, the number of bits in the member offset can be up to two
* less than the number of bits in an `off_t'. On a 32-bit machine,
* for instance, files can be up to 2GB-1byte in size, but since HDF5
* must have a power of two we're restricted to just 1GB. Smaller
* values result in files of a more manageable size (from a human
* perspective) but also limit the total logical size of the hdf5 file
* since most OS's only allow a certain number of open file
* descriptors (all family members are open at once).
*/
#ifdef H5F_DEBUG
if (access_parms->u.fam.offset_bits+2>=8*sizeof(off_t)) {
fprintf (stderr, "H5F: family member size may be too large.\n");
}
#endif
nbits = MAX (access_parms->u.fam.offset_bits, 10); /*1K min*/
}
lf->u.fam.offset_bits = nbits;

View File

@ -248,7 +248,8 @@ typedef struct H5F_access_t {
/* Properties for file families */
struct {
struct H5F_access_t *memb_access; /*plist for the members*/
struct H5F_access_t *memb_access; /*plist for the members */
size_t offset_bits; /*number of bits in offset */
} fam;
/* Properties for the split driver */

View File

@ -67,10 +67,14 @@ static hbool_t interface_initialize_g = FALSE;
This function decodes the "raw" disk form of a simple dimensionality
message into a struct in memory native format. The struct is allocated
within this function using malloc() and is returned to the caller.
MODIFICATIONS
Robb Matzke, 1998-04-09
The current and maximum dimensions are now H5F_SIZEOF_SIZET bytes
instead of just four bytes.
--------------------------------------------------------------------------*/
static void *
H5O_sdspace_decode(H5F_t __unused__ *f, const uint8 *p,
H5HG_t __unused__ *hobj)
H5O_sdspace_decode(H5F_t *f, const uint8 *p, H5HG_t __unused__ *hobj)
{
H5S_simple_t *sdim = NULL;/* New simple dimensionality structure */
intn u; /* local counting variable */
@ -89,12 +93,14 @@ H5O_sdspace_decode(H5F_t __unused__ *f, const uint8 *p,
UINT32DECODE(p, flags);
if (sdim->rank > 0) {
sdim->size = H5MM_xmalloc(sizeof(sdim->size[0]) * sdim->rank);
for (u = 0; u < sdim->rank; u++)
UINT32DECODE(p, sdim->size[u]);
for (u = 0; u < sdim->rank; u++) {
H5F_decode_length (f, p, sdim->size[u]);
}
if (flags & 0x01) {
sdim->max = H5MM_xmalloc(sizeof(sdim->max[0]) * sdim->rank);
for (u = 0; u < sdim->rank; u++)
UINT32DECODE(p, sdim->max[u]);
for (u = 0; u < sdim->rank; u++) {
H5F_decode_length (f, p, sdim->max[u]);
}
}
if (flags & 0x02) {
sdim->perm = H5MM_xmalloc(sizeof(sdim->perm[0]) * sdim->rank);
@ -130,9 +136,14 @@ H5O_sdspace_decode(H5F_t __unused__ *f, const uint8 *p,
DESCRIPTION
This function encodes the native memory form of the simple
dimensionality message in the "raw" disk form.
MODIFICATIONS
Robb Matzke, 1998-04-09
The current and maximum dimensions are now H5F_SIZEOF_SIZET bytes
instead of just four bytes.
--------------------------------------------------------------------------*/
static herr_t
H5O_sdspace_encode(H5F_t __unused__ *f, uint8 *p, const void *mesg)
H5O_sdspace_encode(H5F_t *f, uint8 *p, const void *mesg)
{
const H5S_simple_t *sdim = (const H5S_simple_t *) mesg;
intn u; /* Local counting variable */
@ -153,11 +164,13 @@ H5O_sdspace_encode(H5F_t __unused__ *f, uint8 *p, const void *mesg)
UINT32ENCODE(p, sdim->rank);
UINT32ENCODE(p, flags);
if (sdim->rank > 0) {
for (u = 0; u < sdim->rank; u++)
UINT32ENCODE(p, sdim->size[u]);
for (u = 0; u < sdim->rank; u++) {
H5F_encode_length (f, p, sdim->size[u]);
}
if (flags & 0x01) {
for (u = 0; u < sdim->rank; u++)
UINT32ENCODE(p, sdim->max[u]);
for (u = 0; u < sdim->rank; u++) {
H5F_encode_length (f, p, sdim->max[u]);
}
}
if (flags & 0x02) {
for (u = 0; u < sdim->rank; u++)
@ -229,18 +242,32 @@ H5O_sdspace_copy(const void *mesg, void *dest)
This function returns the size of the raw simple dimensionality message on
success. (Not counting the message type or size fields, only the data
portion of the message). It doesn't take into account alignment.
MODIFICATIONS
Robb Matzke, 1998-04-09
The current and maximum dimensions are now H5F_SIZEOF_SIZET bytes
instead of just four bytes.
--------------------------------------------------------------------------*/
static size_t
H5O_sdspace_size(H5F_t __unused__ *f, const void *mesg)
H5O_sdspace_size(H5F_t *f, const void *mesg)
{
const H5S_simple_t *sdim = (const H5S_simple_t *) mesg;
size_t ret_value = 8; /* all dimensionality messages are at least 8 bytes long (rank and flags) */
/*
* all dimensionality messages are at least 8 bytes long (four bytes for
* rank and four bytes for flags)
*/
size_t ret_value = 8;
FUNC_ENTER(H5O_sim_dtype_size, 0);
ret_value += sdim->rank * 4; /* add in the dimension sizes */
ret_value += sdim->max ? sdim->rank * 4 : 0; /* add in the space for the maximum dimensions, if they are present */
ret_value += sdim->perm ? sdim->rank * 4 : 0; /* add in the space for the dimension permutations, if they are present */
/* add in the dimension sizes */
ret_value += sdim->rank * H5F_SIZEOF_SIZE (f);
/* add in the space for the maximum dimensions, if they are present */
ret_value += sdim->max ? sdim->rank * H5F_SIZEOF_SIZE (f) : 0;
/* add in the space for the dimension permutations, if they are present */
ret_value += sdim->perm ? sdim->rank * 4 : 0;
FUNC_LEAVE(ret_value);
}
@ -279,36 +306,35 @@ H5O_sdspace_debug(H5F_t __unused__ *f, const void *mesg,
assert(indent >= 0);
assert(fwidth >= 0);
fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
"Rank:",
(unsigned long) (sdim->rank));
fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Size:");
HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Size:");
for (u = 0; u < sdim->rank; u++) {
fprintf (stream, "%s%lu", u?", ":"", (unsigned long)(sdim->size[u]));
HDfprintf (stream, "%s%Hu", u?", ":"", sdim->size[u]);
}
fprintf (stream, "}\n");
HDfprintf (stream, "}\n");
fprintf(stream, "%*s%-*s ", indent, "", fwidth, "Dim Max:");
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Dim Max:");
if (sdim->max) {
fprintf (stream, "{");
HDfprintf (stream, "{");
for (u = 0; u < sdim->rank; u++) {
if (H5S_UNLIMITED==sdim->max[u]) {
fprintf (stream, "%sINF", u?", ":"");
HDfprintf (stream, "%sINF", u?", ":"");
} else {
fprintf (stream, "%s%lu", u?", ":"",
(unsigned long) (sdim->max[u]));
HDfprintf (stream, "%s%Hu", u?", ":"", sdim->max[u]);
}
}
fprintf (stream, "}\n");
HDfprintf (stream, "}\n");
} else {
fprintf (stream, "CONSTANT\n");
HDfprintf (stream, "CONSTANT\n");
}
if (sdim->perm) {
fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Perm:");
HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Perm:");
for (u = 0; u < sdim->rank; u++) {
fprintf (stream, "%s%lu", u?", ":"",
HDfprintf (stream, "%s%lu", u?", ":"",
(unsigned long) (sdim->perm[u]));
}
}

View File

@ -1576,7 +1576,10 @@ H5Pget_split (hid_t tid, size_t meta_ext_size, char *meta_ext/*out*/,
* Function: H5Pset_family
*
* Purpose: Sets the low-level driver to stripe the hdf5 address space
* across a family of files.
* across a family of files. The OFFSET_BITS argument indicates
* how many of the low-order bits of an address will be used for
* the offset within the file, and is only meaningful when
* creating new files.
*
* Return: Success: SUCCEED
*
@ -1590,7 +1593,7 @@ H5Pget_split (hid_t tid, size_t meta_ext_size, char *meta_ext/*out*/,
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_family (hid_t tid, hid_t memb_tid)
H5Pset_family (hid_t tid, size_t offset_bits, hid_t memb_tid)
{
H5F_access_t *tmpl = NULL;
@ -1613,6 +1616,7 @@ H5Pset_family (hid_t tid, hid_t memb_tid)
/* Set driver */
tmpl->driver = H5F_LOW_FAMILY;
tmpl->u.fam.offset_bits = offset_bits;
tmpl->u.fam.memb_access = H5P_copy (H5P_FILE_ACCESS, memb_tmpl);
FUNC_LEAVE (SUCCEED);
@ -1645,7 +1649,7 @@ H5Pset_family (hid_t tid, hid_t memb_tid)
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_family (hid_t tid, hid_t *memb_tid)
H5Pget_family (hid_t tid, size_t *offset_bits/*out*/, hid_t *memb_tid/*out*/)
{
H5F_access_t *tmpl = NULL;
@ -1670,6 +1674,7 @@ H5Pget_family (hid_t tid, hid_t *memb_tid)
} else if (memb_tid) {
*memb_tid = FAIL;
}
if (offset_bits) *offset_bits = tmpl->u.fam.offset_bits;
FUNC_LEAVE (SUCCEED);
}

View File

@ -80,8 +80,9 @@ herr_t H5Pget_split (hid_t tid, size_t meta_ext_size, char *meta_ext/*out*/,
hid_t *meta_properties/*out*/, size_t raw_ext_size,
char *raw_ext/*out*/, hid_t *raw_properties/*out*/);
herr_t H5Pset_family (hid_t tid, hid_t memb_tid);
herr_t H5Pget_family (hid_t tid, hid_t *memb_tid/*out*/);
herr_t H5Pset_family (hid_t tid, size_t offset_bits, hid_t memb_tid);
herr_t H5Pget_family (hid_t tid, size_t *offset_bits/*out*/,
hid_t *memb_tid/*out*/);
herr_t H5Pset_buffer (hid_t plist_id, size_t size, void *tconv, void *bkg);
size_t H5Pget_buffer (hid_t plist_id, void **tconv/*out*/, void **bkg/*out*/);
herr_t H5Pset_preserve (hid_t plist_id, hbool_t status);

View File

@ -28,6 +28,9 @@
/* Define if we have parallel support */
#undef HAVE_PARALLEL
/* Define if it's safe to use `long long' for hsize_t and hssize_t */
#undef HAVE_LARGE_HSIZET
/* The number of bytes in a double. */
#undef SIZEOF_DOUBLE

View File

@ -272,7 +272,7 @@ typedef struct {
#define HDfopen(S,M) fopen(S,M)
#define HDfork() fork()
#define HDfpathconf(F,N) fpathconf(F,N)
/* fprintf() variable arguments */
int HDfprintf (FILE *stream, const char *fmt, ...);
#define HDfputc(C,F) fputc(C,F)
#define HDfputs(S,F) fputs(S,F)
#define HDfread(M,Z,N,F) fread(M,Z,N,F)
@ -410,6 +410,7 @@ typedef struct {
#define HDstrtod(S,R) strtod(S,R)
#define HDstrtok(X,Y) strtok(X,Y)
#define HDstrtol(S,R,N) strtol(S,R,N)
int64 HDstrtoll (const char *s, const char **rest, int base);
#define HDstrtoul(S,R,N) strtoul(S,R,N)
#define HDstrxfrm(X,Y,Z) strxfrm(X,Y,Z)
#define HDsysconf(N) sysconf(N)

View File

@ -46,12 +46,12 @@ typedef int hbool_t;
* most systems, these are the same as size_t and ssize_t, but on systems
* with small address spaces these are defined to be larger.
*/
#if 1
typedef size_t hsize_t;
typedef ssize_t hssize_t;
#else
#ifdef HAVE_LARGE_HSIZET
typedef unsigned long long hsize_t;
typedef signed long long hssize_t;
#else
typedef size_t hsize_t;
typedef ssize_t hssize_t;
#endif
#ifdef __cplusplus

View File

@ -60,7 +60,7 @@ main(int argc, char *argv[])
*/
if (strchr (argv[1], '%')) {
plist = H5Pcreate (H5P_FILE_ACCESS);
H5Pset_family (plist, H5P_DEFAULT);
H5Pset_family (plist, 0, H5P_DEFAULT);
}
if ((fid = H5Fopen(argv[1], H5F_ACC_RDONLY, plist)) < 0) {
fprintf(stderr, "cannot open file\n");
@ -78,10 +78,10 @@ main(int argc, char *argv[])
H5F_addr_reset(&extra);
if (argc > 2) {
printf("New address: %s\n", argv[2]);
addr.offset = HDstrtol(argv[2], NULL, 0);
addr.offset = HDstrtoll(argv[2], NULL, 0);
}
if (argc > 3) {
extra.offset = HDstrtol(argv[3], NULL, 0);
extra.offset = HDstrtoll(argv[3], NULL, 0);
}
/*
* Read the signature at the specified file position.

View File

@ -11,7 +11,7 @@
#include <stdlib.h>
#include <string.h>
#include <H5config.h>
#include <H5private.h>
#ifndef HAVE_ATTRIBUTE
# undef __attribute__
# define __attribute__(X) /*void*/
@ -57,7 +57,7 @@ list (hid_t group, const char *name, void __unused__ *op_data)
int ndims = H5Sget_dims (space, size);
printf (" Dataset {");
for (i=0; i<ndims; i++) {
printf ("%s%lu", i?", ":"", (unsigned long)size[i]);
HDfprintf (stdout, "%s%Hu", i?", ":"", size[i]);
}
printf ("}\n");
H5Dclose (space);
@ -110,7 +110,7 @@ main (int argc, char *argv[])
*/
if (strchr (fname, '%')) {
plist = H5Pcreate (H5P_FILE_ACCESS);
H5Pset_family (plist, H5P_DEFAULT);
H5Pset_family (plist, 0, H5P_DEFAULT);
}
file = H5Fopen (fname, H5F_ACC_RDONLY, plist);
assert (file>=0);

View File

@ -148,6 +148,13 @@ dtypes.o: \
../src/H5private.h \
../src/H5Tprivate.h \
../src/H5Gprivate.h
hyperslab.o: \
hyperslab.c \
../src/H5private.h \
../src/H5public.h \
../src/H5config.h \
../src/H5MMprivate.h \
../src/H5MMpublic.h
istore.o: \
istore.c \
../src/H5private.h \
@ -193,6 +200,26 @@ dsets.o: \
../src/H5Ppublic.h \
../src/H5Spublic.h \
../src/H5Tpublic.h
cmpd_dset.o: \
cmpd_dset.c \
../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
../src/H5ACpublic.h \
../src/H5Bpublic.h \
../src/H5Dpublic.h \
../src/H5Ipublic.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/H5Spublic.h \
../src/H5Tpublic.h
extend.o: \
extend.c \
../src/hdf5.h \
@ -212,6 +239,26 @@ extend.o: \
../src/H5Opublic.h \
../src/H5Ppublic.h \
../src/H5Spublic.h
external.o: \
external.c \
../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
../src/H5ACpublic.h \
../src/H5Bpublic.h \
../src/H5Dpublic.h \
../src/H5Ipublic.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/H5Spublic.h \
../src/H5Tpublic.h
iopipe.o: \
iopipe.c \
../src/hdf5.h \
@ -267,15 +314,8 @@ shtype.o: \
../src/H5Opublic.h \
../src/H5Ppublic.h \
../src/H5Spublic.h
hyperslab.o: \
hyperslab.c \
../src/H5private.h \
../src/H5public.h \
../src/H5config.h \
../src/H5MMprivate.h \
../src/H5MMpublic.h
external.o: \
external.c \
big.o: \
big.c \
../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
@ -292,25 +332,4 @@ external.o: \
../src/H5MMpublic.h \
../src/H5Opublic.h \
../src/H5Ppublic.h \
../src/H5Spublic.h \
../src/H5Tpublic.h
cmpd_dset.o: \
cmpd_dset.c \
../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
../src/H5ACpublic.h \
../src/H5Bpublic.h \
../src/H5Dpublic.h \
../src/H5Ipublic.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/H5Spublic.h \
../src/H5Tpublic.h
../src/H5Spublic.h

View File

@ -12,7 +12,7 @@ CPPFLAGS=-I. -I../src @CPPFLAGS@
# These are our main targets. They should be listed in the order to be
# executed, generally most specific tests to least specific tests.
PROGS=testhdf5 gheap hyperslab istore dtypes dsets cmpd_dset extend external \
shtype iopipe
shtype iopipe big
TESTS=testhdf5 gheap hyperslab istore dtypes dsets cmpd_dset extend external \
shtype
TIMINGS=iopipe
@ -32,7 +32,7 @@ MOSTLYCLEAN=cmpd_dset.h5 dataset.h5 extend.h5 istore.h5 tfile1.h5 tfile2.h5 \
# overlap with other tests.
PROG_SRC=testhdf5.c tfile.c theap.c tmeta.c tohdr.c tstab.c th5s.c dtypes.c \
hyperslab.c istore.c dsets.c cmpd_dset.c extend.c external.c \
iopipe.c gheap.c shtype.c
iopipe.c gheap.c shtype.c big.c
PROG_OBJ=$(PROG_SRC:.c=.o)
TESTHDF5_SRC=testhdf5.c tfile.c theap.c tmeta.c tohdr.c tstab.c th5s.c
@ -71,6 +71,9 @@ SHTYPE_OBJ=$(SHTYPE_SRC:.c=.o)
IOPIPE_SRC=iopipe.c
IOPIPE_OBJ=$(IOPIPE_SRC:.c=.o)
BIG_SRC=big.c
BIG_OBJ=$(BIG_SRC:.c=.o)
# Private header files (not to be installed)...
PRIVATE_HDR=testhdf5.h
@ -121,4 +124,7 @@ iopipe: $(IOPIPE_OBJ) ../src/libhdf5.a
grptime: $(GRPTIME_OBJ) ../src/libhdf5.a
$(CC) $(CFLAGS) -o $@ $(GRPTIME_OBJ) ../src/libhdf5.a $(LIBS)
big: $(BIG_OBJ) ../src/libhdf5.a
$(CC) $(CFLAGS) -o $@ $(BIG_OBJ) ../src/libhdf5.a $(LIBS)
@CONCLUDE@

63
test/big.c Normal file
View File

@ -0,0 +1,63 @@
/*
* Copyright (C) 1998 NCSA
* All rights reserved.
*
* Programmer: Robb Matzke <matzke@llnl.gov>
* Wednesday, April 8, 1998
*/
#include <assert.h>
#include <hdf5.h>
/*-------------------------------------------------------------------------
* Function: main
*
* Purpose: Creates a *big* dataset.
*
* Return: Success:
*
* Failure:
*
* Programmer: Robb Matzke
* Wednesday, April 8, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
int
main (void)
{
hsize_t size1[4] = {8, 1024, 1024, 1024};
hsize_t size2[1] = {8589934592LL};
hid_t plist, file, space1, space2, dset;
/*
* Make sure that `hsize_t' is large enough to represent the entire data
* space.
*/
assert (sizeof(hsize_t)>4);
/*
* We might be on a machine that has 32-bit files, so create an HDF5 file
* which is a family of files. Each member of the family will be 1GB
*/
plist = H5Pcreate (H5P_FILE_ACCESS);
H5Pset_family (plist, 30, H5P_DEFAULT);
file = H5Fcreate ("big%05d.h5", H5F_ACC_TRUNC, H5P_DEFAULT, plist);
/* Create simple data spaces according to the size specified above. */
space1 = H5Screate_simple (4, size1, size1);
space2 = H5Screate_simple (1, size2, size2);
/* Create the datasets */
dset = H5Dcreate (file, "d1", H5T_NATIVE_INT, space1, H5P_DEFAULT);
H5Dclose (dset);
dset = H5Dcreate (file, "d2", H5T_NATIVE_INT, space2, H5P_DEFAULT);
H5Dclose (dset);
H5Sclose (space1);
H5Sclose (space2);
H5Fclose (file);
exit (0);
}