summaryrefslogtreecommitdiffstats
path: root/src/H5Ffamily.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-04-09 20:22:11 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-04-09 20:22:11 (GMT)
commitc96611f8b54caf83b386e78ebb398d3a69be752a (patch)
tree55a6e8e66c4e099dec84bb52eca725b9bae00d27 /src/H5Ffamily.c
parentc01750fa740943c0083711b353278143c79d50a3 (diff)
downloadhdf5-c96611f8b54caf83b386e78ebb398d3a69be752a.zip
hdf5-c96611f8b54caf83b386e78ebb398d3a69be752a.tar.gz
hdf5-c96611f8b54caf83b386e78ebb398d3a69be752a.tar.bz2
[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.
Diffstat (limited to 'src/H5Ffamily.c')
-rw-r--r--src/H5Ffamily.c44
1 files changed, 26 insertions, 18 deletions
diff --git a/src/H5Ffamily.c b/src/H5Ffamily.c
index 402a96c..a138fea 100644
--- a/src/H5Ffamily.c
+++ b/src/H5Ffamily.c
@@ -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;