summaryrefslogtreecommitdiffstats
path: root/src/H5Fprivate.h
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1997-08-01 16:51:29 (GMT)
committerRobb Matzke <matzke@llnl.gov>1997-08-01 16:51:29 (GMT)
commitfc4bcbc21f9a530aa03e1525516507de2c8dadb5 (patch)
tree0d79d7649f3c58b67d8d0a0cfeff64b50bdcb79f /src/H5Fprivate.h
parent3ecc8c71b5f8e546f608f5d15f272c98fd593f61 (diff)
downloadhdf5-fc4bcbc21f9a530aa03e1525516507de2c8dadb5.zip
hdf5-fc4bcbc21f9a530aa03e1525516507de2c8dadb5.tar.gz
hdf5-fc4bcbc21f9a530aa03e1525516507de2c8dadb5.tar.bz2
[svn-r4] Changed SIZEOF_OFFSET and SIZEOF_SIZE to H5F_SIZEOF_OFFSET and
H5F_SIZEOF_SIZE. Modified files to use these instead of accessing the hdf5_file_t struct directly. Changed address return values from H5B to -1 for error. Changed off_t to haddr_t for anything that's a file address.
Diffstat (limited to 'src/H5Fprivate.h')
-rw-r--r--src/H5Fprivate.h52
1 files changed, 31 insertions, 21 deletions
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 2151b29..9d45af8 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -29,12 +29,22 @@
-#define SIZEOF_OFFSET(F) ((F)->file_create_parms.offset_size)
-#define SIZEOF_SIZE(F) ((F)->file_create_parms.length_size)
+#define H5F_SIZEOF_OFFSET(F) ((F)->file_create_parms.offset_size)
+#define H5F_SIZEOF_SIZE(F) ((F)->file_create_parms.length_size)
/* Size of the default error stack for file IDs */
#define HDF5_FILE_ERRSTACK 16
+/*
+ * If we're using POSIXUNBUFIO and lseek64() is available, then use
+ * 64-bit file offsets. Otherwise use whatever `off_t' is.
+ */
+#if (FILELIB==POSIXUNBUFIO) && defined(H5_HAVE_OFF64_T) && defined(H5_HAVE_LSEEK64)
+typedef off64_t haddr_t;
+#else
+typedef off_t haddr_t;
+#endif
+
/* Define the structure to store the file information for HDF5 files */
typedef struct {
char *dir; /* Directory the file is located within */
@@ -44,8 +54,8 @@ typedef struct {
int32 file_err; /* Error stack ID for this file */
uintn ref_count; /* Reference count for number of times file is opened */
uint32 consist_flags; /* File Consistency Flags */
- size_t smallobj_off; /* Offset of small-object heap within the file */
- size_t freespace_off; /* Offset of free-space info within the file */
+ haddr_t smallobj_off; /* Offset of small-object heap within the file */
+ haddr_t freespace_off; /* Offset of free-space info within the file */
size_t logical_len; /* Logical length of file */
struct H5AC_cache_t *cache; /* The object cache */
file_create_temp_t file_create_parms; /* File-creation template parameters */
@@ -56,37 +66,37 @@ typedef struct {
} hdf5_file_t;
/* Define a macro to ease calculation of the symbol-table entry size */
-#define H5F_symbol_table_size(f) (4+ /* "Symbol-type" bytes */ \
- f->file_create_parms.offset_size+ /* Offset bytes */ \
- f->file_create_parms.length_size+ /* Length bytes */ \
- 4+ /* Name offset in local heap */ \
- 24) /* "Scratch" space */ \
+#define H5F_symbol_table_size(f) (4+ /* "Symbol-type" bytes */ \
+ H5F_SIZEOF_OFFSET(f)+ /* Offset bytes */ \
+ H5F_SIZEOF_SIZE(f)+ /* Length bytes */ \
+ 4+ /* Name offset in local heap */ \
+ 24) /* "Scratch" space */
#ifdef NOT_YET
-#define H5F_encode_offset(f,p,o) (f->file_create_parms.offset_size==4 ? UINT32ENCODE(p,o) \
- : f->file_create_parms.offset_size==8 ? UINT64ENCODE(p,o) \
- : f->file_create_parms.offset_size==2 ? UINT16ENCODE(p,o) \
+#define H5F_encode_offset(f,p,o) (H5F_SIZEOF_OFFSET(f)==4 ? UINT32ENCODE(p,o) \
+ : H5F_SIZEOF_OFFSET(f)==8 ? UINT64ENCODE(p,o) \
+ : H5F_SIZEOF_OFFSET(f)==2 ? UINT16ENCODE(p,o) \
: H5FPencode_unusual_offset(f,&(p),(uint8 *)&(o)))
#else /* NOT_YET */
-#define H5F_encode_offset(f,p,o) switch(f->file_create_parms.offset_size) { case 4: UINT32ENCODE(p,o); break;\
+#define H5F_encode_offset(f,p,o) switch(H5F_SIZEOF_OFFSET(f)) { case 4: UINT32ENCODE(p,o); break;\
case 8: UINT64ENCODE(p,o); break;\
case 2: UINT16ENCODE(p,o); break;}
#endif /* NOT_YET */
-#define H5F_decode_offset(f,p,o) switch(f->file_create_parms.offset_size) { case 4: UINT32DECODE(p,o); break;\
+#define H5F_decode_offset(f,p,o) switch(H5F_SIZEOF_OFFSET(f)) { case 4: UINT32DECODE(p,o); break;\
case 8: UINT64DECODE(p,o); break;\
case 2: UINT16DECODE(p,o); break;}
#ifdef NOT_YET
-#define H5F_encode_length(f,p,l) (f->file_create_parms.length_size==4 ? UINT32ENCODE(p,l) \
- : f->file_create_parms.length_size==8 ? UINT64ENCODE(p,l) \
- : f->file_create_parms.length_size==2 ? UINT16ENCODE(p,l) : H5FPencode_unusual_length(f,&(p),(uint8 *)&(l)))
+#define H5F_encode_length(f,p,l) (H5F_SIZEOF_SIZE(f)==4 ? UINT32ENCODE(p,l) \
+ : H5F_SIZEOF_SIZE(f)==8 ? UINT64ENCODE(p,l) \
+ : H5F_SIZEOF_SIZE(f)==2 ? UINT16ENCODE(p,l) : H5FPencode_unusual_length(f,&(p),(uint8 *)&(l)))
#else /* NOT_YET */
-#define H5F_encode_length(f,p,l) switch(f->file_create_parms.length_size) { case 4: UINT32ENCODE(p,l); break;\
+#define H5F_encode_length(f,p,l) switch(H5F_SIZEOF_SIZE(f)) { case 4: UINT32ENCODE(p,l); break;\
case 8: UINT64ENCODE(p,l); break;\
case 2: UINT16ENCODE(p,l); break;}
#endif /* NOT_YET */
-#define H5F_decode_length(f,p,l) switch(f->file_create_parms.length_size) { case 4: UINT32DECODE(p,l); break;\
+#define H5F_decode_length(f,p,l) switch(H5F_SIZEOF_SIZE(f)) { case 4: UINT32DECODE(p,l); break;\
case 8: UINT64DECODE(p,l); break;\
case 2: UINT16DECODE(p,l); break;}
@@ -94,8 +104,8 @@ typedef struct {
void H5F_encode_length_unusual(const hdf5_file_t *f, uint8 **p, uint8 *l);
void H5F_encode_offset_unusual(const hdf5_file_t *f, uint8 **p, uint8 *o);
intn H5F_compare_filename(const VOIDP obj, const VOIDP key);
-herr_t H5F_block_read (hdf5_file_t *f, off_t addr, size_t size, void *buf);
-herr_t H5F_block_write (hdf5_file_t *f, off_t addr, size_t size, void *buf);
+herr_t H5F_block_read (hdf5_file_t *f, haddr_t addr, size_t size, void *buf);
+herr_t H5F_block_write (hdf5_file_t *f, haddr_t addr, size_t size, void *buf);
#endif /* HDF5FILE_H */