summaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--src/H5AC.c16
-rw-r--r--src/H5ACprivate.h15
-rw-r--r--src/H5B.c96
-rw-r--r--src/H5Bprivate.h29
-rw-r--r--src/H5F.c88
-rw-r--r--src/H5Fprivate.h52
-rw-r--r--src/H5G.c4
-rw-r--r--src/H5Gnode.c46
-rw-r--r--src/H5Gprivate.h10
-rw-r--r--src/H5H.c34
-rw-r--r--src/H5Hprivate.h12
-rw-r--r--src/H5MF.c6
-rw-r--r--src/H5MFprivate.h4
-rw-r--r--src/hdf5plat.h27
-rw-r--r--src/hdf5port.h120
15 files changed, 300 insertions, 259 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index a0123b1..cca36bc 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -99,13 +99,13 @@ H5AC_dest (hdf5_file_t *f)
*-------------------------------------------------------------------------
*/
void *
-H5AC_find (hdf5_file_t *f, const H5AC_class_t *type, off_t addr,
+H5AC_find (hdf5_file_t *f, const H5AC_class_t *type, haddr_t addr,
const void *udata)
{
unsigned idx = HASH(addr);
herr_t status;
void *thing = NULL;
- herr_t (*flush)(hdf5_file_t*,hbool_t,off_t,void*)=NULL;
+ herr_t (*flush)(hdf5_file_t*,hbool_t,haddr_t,void*)=NULL;
assert (type);
assert (type->load);
@@ -175,12 +175,12 @@ H5AC_find (hdf5_file_t *f, const H5AC_class_t *type, off_t addr,
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_flush (hdf5_file_t *f, const H5AC_class_t *type, off_t addr,
+H5AC_flush (hdf5_file_t *f, const H5AC_class_t *type, haddr_t addr,
hbool_t destroy)
{
uintn i = HASH(addr);
herr_t status;
- herr_t (*flush)(hdf5_file_t*,hbool_t,off_t,void*)=NULL;
+ herr_t (*flush)(hdf5_file_t*,hbool_t,haddr_t,void*)=NULL;
if (!type || 0==addr) {
/*
@@ -232,11 +232,11 @@ H5AC_flush (hdf5_file_t *f, const H5AC_class_t *type, off_t addr,
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_set (hdf5_file_t *f, const H5AC_class_t *type, off_t addr, void *thing)
+H5AC_set (hdf5_file_t *f, const H5AC_class_t *type, haddr_t addr, void *thing)
{
herr_t status;
uintn idx = HASH (addr);
- herr_t (*flush)(hdf5_file_t*,hbool_t,off_t,void*)=NULL;
+ herr_t (*flush)(hdf5_file_t*,hbool_t,haddr_t,void*)=NULL;
assert (type);
assert (type->flush);
@@ -274,11 +274,11 @@ H5AC_set (hdf5_file_t *f, const H5AC_class_t *type, off_t addr, void *thing)
*/
herr_t
H5AC_rename (hdf5_file_t *f, const H5AC_class_t *type,
- off_t old_addr, off_t new_addr)
+ haddr_t old_addr, haddr_t new_addr)
{
uintn old_idx = HASH (old_addr);
uintn new_idx = HASH (new_addr);
- herr_t (*flush)(hdf5_file_t*, hbool_t, off_t, void*);
+ herr_t (*flush)(hdf5_file_t*, hbool_t, haddr_t, void*);
herr_t status;
assert (type);
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index 5dce2cd..9d10f19 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -37,8 +37,9 @@
* by the LOAD method if the DEST argument is non-zero.
*/
typedef struct H5AC_class_t {
- void *(*load)(hdf5_file_t*, off_t addr, const void *udata);
- herr_t (*flush)(hdf5_file_t*, hbool_t dest, off_t addr, void *thing);
+ void *(*load)(hdf5_file_t*, haddr_t addr, const void *udata);
+ herr_t (*flush)(hdf5_file_t*, hbool_t dest, haddr_t addr,
+ void *thing);
} H5AC_class_t;
/*
@@ -50,7 +51,7 @@ typedef struct H5AC_class_t {
typedef struct H5AC_cache_t {
const H5AC_class_t *type; /*type of object stored here */
- off_t addr; /*file address for object */
+ haddr_t addr; /*file address for object */
void *thing; /*the thing which is cached */
} H5AC_cache_t;
@@ -58,14 +59,14 @@ typedef struct H5AC_cache_t {
* Library prototypes.
*/
herr_t H5AC_dest (hdf5_file_t *f);
-void *H5AC_find (hdf5_file_t *f, const H5AC_class_t *type, off_t addr,
+void *H5AC_find (hdf5_file_t *f, const H5AC_class_t *type, haddr_t addr,
const void *udata);
-herr_t H5AC_flush (hdf5_file_t *f, const H5AC_class_t *type, off_t addr,
+herr_t H5AC_flush (hdf5_file_t *f, const H5AC_class_t *type, haddr_t addr,
hbool_t destroy);
herr_t H5AC_new (hdf5_file_t *f);
herr_t H5AC_rename (hdf5_file_t *f, const H5AC_class_t *type,
- off_t old, off_t new);
-herr_t H5AC_set (hdf5_file_t *f, const H5AC_class_t *type, off_t addr,
+ haddr_t old, haddr_t new);
+herr_t H5AC_set (hdf5_file_t *f, const H5AC_class_t *type, haddr_t addr,
void *thing);
#endif /* !_H5ACprivate_H */
diff --git a/src/H5B.c b/src/H5B.c
index f3a7052..fadc6f5 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -112,22 +112,22 @@
#define true 1
/* PRIVATE PROTOTYPES */
-static off_t H5B_insert_helper (hdf5_file_t *f, off_t addr,
- const H5B_class_t *type,
- uint8 *lt_key, intn *lt_key_changed,
- uint8 *md_key, void *udata,
- uint8 *rt_key, intn *rt_key_changed);
-static herr_t H5B_flush (hdf5_file_t *f, hbool_t destroy, off_t addr,
+static haddr_t H5B_insert_helper (hdf5_file_t *f, haddr_t addr,
+ const H5B_class_t *type,
+ uint8 *lt_key, intn *lt_key_changed,
+ uint8 *md_key, void *udata,
+ uint8 *rt_key, intn *rt_key_changed);
+static herr_t H5B_flush (hdf5_file_t *f, hbool_t destroy, haddr_t addr,
H5B_t *b);
-static H5B_t *H5B_load (hdf5_file_t *f, off_t addr, const void *_data);
+static H5B_t *H5B_load (hdf5_file_t *f, haddr_t addr, const void *_data);
static herr_t H5B_decode_key (hdf5_file_t *f, H5B_t *bt, intn idx);
static size_t H5B_nodesize (hdf5_file_t *f, const H5B_class_t *type,
size_t *total_nkey_size, size_t sizeof_rkey);
/* H5B inherits cache-like properties from H5AC */
static const H5AC_class_t H5AC_BT[1] = {{
- (void*(*)(hdf5_file_t*,off_t,const void*))H5B_load,
- (herr_t(*)(hdf5_file_t*,hbool_t,off_t,void*))H5B_flush,
+ (void*(*)(hdf5_file_t*,haddr_t,const void*))H5B_load,
+ (herr_t(*)(hdf5_file_t*,hbool_t,haddr_t,void*))H5B_flush,
}};
@@ -138,7 +138,7 @@ static const H5AC_class_t H5AC_BT[1] = {{
*
* Return: Success: address of new node.
*
- * Failure: 0
+ * Failure: -1
*
* Programmer: Robb Matzke
* robb@maya.nuance.com
@@ -148,11 +148,11 @@ static const H5AC_class_t H5AC_BT[1] = {{
*
*-------------------------------------------------------------------------
*/
-off_t
+haddr_t
H5B_new (hdf5_file_t *f, const H5B_class_t *type, size_t sizeof_rkey)
{
H5B_t *bt=NULL;
- off_t addr;
+ haddr_t addr;
size_t size;
size_t total_native_keysize;
intn offset, i;
@@ -161,7 +161,7 @@ H5B_new (hdf5_file_t *f, const H5B_class_t *type, size_t sizeof_rkey)
* Allocate file and memory data structures.
*/
size = H5B_nodesize (f, type, &total_native_keysize, sizeof_rkey);
- if ((addr = H5MF_alloc (f, size))<=0) return 0;
+ if ((addr = H5MF_alloc (f, size))<=0) return -1;
bt = H5MM_xmalloc (sizeof(H5B_t));
bt->type = type;
bt->sizeof_rkey = sizeof_rkey;
@@ -173,7 +173,7 @@ H5B_new (hdf5_file_t *f, const H5B_class_t *type, size_t sizeof_rkey)
bt->nchildren = 0;
bt->page = H5MM_xmalloc (size);
bt->native = H5MM_xmalloc (total_native_keysize);
- bt->child = H5MM_xmalloc (2*type->k * sizeof(off_t));
+ bt->child = H5MM_xmalloc (2*type->k * sizeof(haddr_t));
bt->key = H5MM_xmalloc ((2*type->k+1) * sizeof(H5B_key_t));
/*
@@ -183,7 +183,7 @@ H5B_new (hdf5_file_t *f, const H5B_class_t *type, size_t sizeof_rkey)
*/
for (i=0,offset=H5B_HDR_SIZE(f);
i<2*type->k;
- i++,offset+=bt->sizeof_rkey+SIZEOF_OFFSET(f)) {
+ i++,offset+=bt->sizeof_rkey+H5F_SIZEOF_OFFSET(f)) {
bt->key[i].dirty = 0;
bt->key[i].rkey = bt->page + offset;
@@ -213,7 +213,7 @@ H5B_new (hdf5_file_t *f, const H5B_class_t *type, size_t sizeof_rkey)
*
* Return: Success: Pointer to a new B-tree node.
*
- * Failure: 0
+ * Failure: NULL
*
* Programmer: Robb Matzke
* robb@maya.nuance.com
@@ -224,7 +224,7 @@ H5B_new (hdf5_file_t *f, const H5B_class_t *type, size_t sizeof_rkey)
*-------------------------------------------------------------------------
*/
static H5B_t *
-H5B_load (hdf5_file_t *f, off_t addr, const void *_data)
+H5B_load (hdf5_file_t *f, haddr_t addr, const void *_data)
{
const H5B_class_t *type = (const H5B_class_t *)_data;
size_t size, total_nkey_size;
@@ -244,7 +244,7 @@ H5B_load (hdf5_file_t *f, off_t addr, const void *_data)
bt->page = H5MM_xmalloc (size);
bt->native = H5MM_xmalloc (total_nkey_size);
bt->key = H5MM_xmalloc ((2*type->k+1) * sizeof(H5B_key_t));
- bt->child = H5MM_xmalloc (2 * type->k * sizeof(off_t));
+ bt->child = H5MM_xmalloc (2 * type->k * sizeof(haddr_t));
H5F_block_read (f, addr, size, bt->page);
p = bt->page;
@@ -275,7 +275,7 @@ H5B_load (hdf5_file_t *f, off_t addr, const void *_data)
H5F_decode_offset (f, p, bt->child[i]);
} else {
bt->child[i] = 0;
- p += SIZEOF_OFFSET(f);
+ p += H5F_SIZEOF_OFFSET(f);
}
}
@@ -314,7 +314,7 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B_flush (hdf5_file_t *f, hbool_t destroy, off_t addr, H5B_t *bt)
+H5B_flush (hdf5_file_t *f, hbool_t destroy, haddr_t addr, H5B_t *bt)
{
intn i;
size_t size = H5B_nodesize (f, bt->type, NULL, bt->sizeof_rkey);
@@ -357,7 +357,7 @@ H5B_flush (hdf5_file_t *f, hbool_t destroy, off_t addr, H5B_t *bt)
if (i<bt->ndirty) {
H5F_encode_offset (f, p, bt->child[i]);
} else {
- p += SIZEOF_OFFSET(f);
+ p += H5F_SIZEOF_OFFSET(f);
}
}
@@ -409,7 +409,7 @@ H5B_flush (hdf5_file_t *f, hbool_t destroy, off_t addr, H5B_t *bt)
*-------------------------------------------------------------------------
*/
herr_t
-H5B_find (hdf5_file_t *f, const H5B_class_t *type, off_t addr, void *udata)
+H5B_find (hdf5_file_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
{
H5B_t *bt=NULL;
uint8 lt_key[256], rt_key[256];
@@ -474,7 +474,7 @@ H5B_find (hdf5_file_t *f, const H5B_class_t *type, off_t addr, void *udata)
*
* Return: Success: Address of the new node.
*
- * Failure: 0
+ * Failure: -1
*
* Programmer: Robb Matzke
* robb@maya.nuance.com
@@ -484,16 +484,16 @@ H5B_find (hdf5_file_t *f, const H5B_class_t *type, off_t addr, void *udata)
*
*-------------------------------------------------------------------------
*/
-static off_t
-H5B_split (hdf5_file_t *f, const H5B_class_t *type, off_t addr, intn anchor)
+static haddr_t
+H5B_split (hdf5_file_t *f, const H5B_class_t *type, haddr_t addr, intn anchor)
{
H5B_t *old = H5AC_find (f, H5AC_BT, addr, type);
H5B_t *bt = H5MM_xmalloc (sizeof(H5B_t));
size_t total_nkey_size, size;
intn i, offset;
intn delta = H5B_ANCHOR_LT==anchor ? type->k : 0;
- size_t recsize = old->sizeof_rkey + SIZEOF_OFFSET(f);
- off_t tmp_addr, new_addr;
+ size_t recsize = old->sizeof_rkey + H5F_SIZEOF_OFFSET(f);
+ haddr_t tmp_addr, new_addr;
H5B_t *tmp=NULL;
/*
@@ -507,7 +507,7 @@ H5B_split (hdf5_file_t *f, const H5B_class_t *type, off_t addr, intn anchor)
bt->nchildren = type->k;
bt->page = H5MM_xmalloc (size);
bt->native = H5MM_xmalloc (total_nkey_size);
- bt->child = H5MM_xmalloc (2*type->k * sizeof(off_t));
+ bt->child = H5MM_xmalloc (2*type->k * sizeof(haddr_t));
bt->key = H5MM_xmalloc ((2*type->k+1) * sizeof(H5B_key_t));
/*
@@ -663,7 +663,7 @@ H5B_decode_key (hdf5_file_t *f, H5B_t *bt, intn idx)
* B-tree root address may change if the old
* root is split.
*
- * Failure: 0
+ * Failure: -1
*
* Programmer: Robb Matzke
* robb@maya.nuance.com
@@ -673,12 +673,12 @@ H5B_decode_key (hdf5_file_t *f, H5B_t *bt, intn idx)
*
*-------------------------------------------------------------------------
*/
-off_t
-H5B_insert (hdf5_file_t *f, const H5B_class_t *type, off_t addr, void *udata)
+haddr_t
+H5B_insert (hdf5_file_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
{
uint8 lt_key[256], md_key[256], rt_key[256];
intn lt_key_changed=false, rt_key_changed=false;
- off_t child, new_root;
+ haddr_t child, new_root;
intn level;
H5B_t *bt;
@@ -687,7 +687,7 @@ H5B_insert (hdf5_file_t *f, const H5B_class_t *type, off_t addr, void *udata)
child = H5B_insert_helper (f, addr, type, lt_key, &lt_key_changed,
md_key, udata, rt_key, &rt_key_changed);
- if (child<0) return 0;
+ if (child<0) return -1;
if (0==child) return addr;
/* the current root */
@@ -714,7 +714,7 @@ H5B_insert (hdf5_file_t *f, const H5B_class_t *type, off_t addr, void *udata)
*/
size_t size = H5B_nodesize (f, type, NULL, bt->sizeof_rkey);
uint8 *buf = H5MM_xmalloc (size);
- off_t tmp_addr = H5MF_alloc (f, size);
+ haddr_t tmp_addr = H5MF_alloc (f, size);
H5AC_flush (f, H5AC_BT, addr, FALSE);
H5F_block_read (f, addr, size, buf);
@@ -787,8 +787,8 @@ H5B_insert (hdf5_file_t *f, const H5B_class_t *type, off_t addr, void *udata)
*-------------------------------------------------------------------------
*/
static void
-H5B_insert_child (hdf5_file_t *f, const H5B_class_t *type, off_t addr,
- intn idx, off_t child, intn anchor, void *md_key)
+H5B_insert_child (hdf5_file_t *f, const H5B_class_t *type, haddr_t addr,
+ intn idx, haddr_t child, intn anchor, void *md_key)
{
H5B_t *bt;
size_t recsize;
@@ -797,7 +797,7 @@ H5B_insert_child (hdf5_file_t *f, const H5B_class_t *type, off_t addr,
bt = H5AC_find (f, H5AC_BT, addr, type);
assert (bt);
bt->dirty += 1;
- recsize = bt->sizeof_rkey + SIZEOF_OFFSET(f);
+ recsize = bt->sizeof_rkey + H5F_SIZEOF_OFFSET(f);
if (H5B_ANCHOR_LT==anchor) {
/*
@@ -843,7 +843,7 @@ H5B_insert_child (hdf5_file_t *f, const H5B_class_t *type, off_t addr,
memmove (bt->child + idx + 1,
bt->child + idx,
- (bt->nchildren - idx) * sizeof(off_t));
+ (bt->nchildren - idx) * sizeof(haddr_t));
bt->child[idx] = child;
bt->nchildren += 1;
@@ -883,8 +883,8 @@ H5B_insert_child (hdf5_file_t *f, const H5B_class_t *type, off_t addr,
*
*-------------------------------------------------------------------------
*/
-static off_t
-H5B_insert_helper (hdf5_file_t *f, off_t addr, const H5B_class_t *type,
+static haddr_t
+H5B_insert_helper (hdf5_file_t *f, haddr_t addr, const H5B_class_t *type,
uint8 *lt_key, intn *lt_key_changed,
uint8 *md_key, void *udata,
uint8 *rt_key, intn *rt_key_changed)
@@ -892,7 +892,7 @@ H5B_insert_helper (hdf5_file_t *f, off_t addr, const H5B_class_t *type,
H5B_t *bt;
intn lt=0, idx=-1, rt, cmp=-1;
intn anchor;
- off_t child, twin=0;
+ haddr_t child, twin=0;
assert (type);
assert (type->decode);
@@ -1093,13 +1093,13 @@ error:
*-------------------------------------------------------------------------
*/
herr_t
-H5B_list (hdf5_file_t *f, const H5B_class_t *type, off_t addr, void *udata)
+H5B_list (hdf5_file_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
{
H5B_t *bt;
- off_t *child=NULL;
- off_t twin;
+ haddr_t *child=NULL;
+ haddr_t twin;
intn i, nchildren, status;
- herr_t (*list)(hdf5_file_t*,off_t,void*);
+ herr_t (*list)(hdf5_file_t*,haddr_t,void*);
assert (type);
assert (type->list);
@@ -1110,7 +1110,7 @@ H5B_list (hdf5_file_t *f, const H5B_class_t *type, off_t addr, void *udata)
if (bt->level>0) {
return H5B_list (f, type, bt->child[0], udata);
} else {
- child = H5MM_xmalloc (2 * type->k * sizeof(off_t));
+ child = H5MM_xmalloc (2 * type->k * sizeof(haddr_t));
list = type->list;
twin = addr;
@@ -1122,7 +1122,7 @@ H5B_list (hdf5_file_t *f, const H5B_class_t *type, off_t addr, void *udata)
}
nchildren = bt->nchildren;
twin = bt->right;
- HDmemcpy (child, bt->child, nchildren * sizeof(off_t));
+ HDmemcpy (child, bt->child, nchildren * sizeof(haddr_t));
bt = NULL; /*list callback may invalidate the cache*/
for (i=0; i<nchildren; i++) {
@@ -1171,7 +1171,7 @@ H5B_nodesize (hdf5_file_t *f, const H5B_class_t *type,
}
return (H5B_HDR_SIZE(f) + /*node header */
- 2 * type->k * SIZEOF_OFFSET(f) + /*child pointers*/
+ 2 * type->k * H5F_SIZEOF_OFFSET(f) + /*child pointers*/
(2*type->k+1) * sizeof_rkey); /*keys */
}
diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h
index d6ecc7c..b6e31a8 100644
--- a/src/H5Bprivate.h
+++ b/src/H5Bprivate.h
@@ -22,7 +22,7 @@
#define H5B_MAGIC "TREE" /* tree node magic number */
-#define H5B_HDR_SIZE(F) (8+2*SIZEOF_OFFSET(F))
+#define H5B_HDR_SIZE(F) (8+2*H5F_SIZEOF_OFFSET(F))
#define H5B_ANCHOR_LT 0 /* left node is anchored, right is new */
#define H5B_ANCHOR_RT 1 /* right node is anchored, left is new */
@@ -37,12 +37,12 @@ typedef struct H5B_class_t {
intn k; /* max children is 2k */
size_t sizeof_nkey; /*size of native (memory) key */
size_t (*get_sizeof_rkey)(hdf5_file_t*);
- off_t (*new)(hdf5_file_t*,void*,void*,void*);
+ haddr_t (*new)(hdf5_file_t*,void*,void*,void*);
intn (*cmp)(hdf5_file_t*,void*,void*,void*);
- herr_t (*found)(hdf5_file_t*,off_t,void*,void*,void*);
- off_t (*insert)(hdf5_file_t*,off_t,int*,void*,int*,void*,void*,
+ herr_t (*found)(hdf5_file_t*,haddr_t,void*,void*,void*);
+ haddr_t (*insert)(hdf5_file_t*,haddr_t,int*,void*,int*,void*,void*,
void*,int*);
- herr_t (*list)(hdf5_file_t*,off_t,void*);
+ herr_t (*list)(hdf5_file_t*,haddr_t,void*);
void (*decode)(hdf5_file_t*,uint8*,void*);
void (*encode)(hdf5_file_t*,uint8*,void*);
} H5B_class_t;
@@ -62,24 +62,27 @@ typedef struct H5B_t {
intn dirty; /*something in the tree is dirty */
intn ndirty; /*num child ptrs to emit */
intn level; /*node level */
- off_t left; /*address of left sibling */
- off_t right; /*address of right sibling */
+ haddr_t left; /*address of left sibling */
+ haddr_t right; /*address of right sibling */
intn nchildren; /*number of child pointers */
uint8 *page; /*disk page */
uint8 *native; /*array of keys in native format */
H5B_key_t *key; /*2k+1 key entries */
- off_t *child; /*2k child pointers */
+ haddr_t *child; /*2k child pointers */
} H5B_t;
/*
* Library prototypes.
*/
-herr_t H5B_debug (hdf5_file_t *f, off_t addr, const H5B_class_t *type);
-off_t H5B_new (hdf5_file_t *f, const H5B_class_t *type, size_t sizeof_rkey);
-herr_t H5B_find (hdf5_file_t *f, const H5B_class_t *type, off_t addr, void *udata);
-off_t H5B_insert (hdf5_file_t *f, const H5B_class_t *type, off_t addr, void *udata);
-herr_t H5B_list (hdf5_file_t *f, const H5B_class_t *type, off_t addr, void *udata);
+herr_t H5B_debug (hdf5_file_t *f, haddr_t addr, const H5B_class_t *type);
+haddr_t H5B_new (hdf5_file_t *f, const H5B_class_t *type, size_t sizeof_rkey);
+herr_t H5B_find (hdf5_file_t *f, const H5B_class_t *type, haddr_t addr,
+ void *udata);
+haddr_t H5B_insert (hdf5_file_t *f, const H5B_class_t *type, haddr_t addr,
+ void *udata);
+herr_t H5B_list (hdf5_file_t *f, const H5B_class_t *type, haddr_t addr,
+ void *udata);
#endif /* !_H5Bprivate_H */
diff --git a/src/H5F.c b/src/H5F.c
index d75e09f..8de7264 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -102,7 +102,7 @@ void H5F_encode_length_unusual(const hdf5_file_t *f, uint8 **p, uint8 *l)
#ifdef LATER
CONSTR(FUNC, "H5F_encode_length_unusual");
#endif /* LATER */
- intn i=f->file_create_parms.length_size;
+ intn i = H5F_SIZEOF_SIZE (f);
/* For non-little-endian platforms, encode each byte in memory backwards */
#if ((DF_MT&0xFFF0)!=0x4440)
@@ -143,7 +143,7 @@ void H5F_encode_offset_unusual(const hdf5_file_t *f, uint8 **p, uint8 *o)
#ifdef LATER
CONSTR(FUNC, "H5F_encode_offset_unusual");
#endif /* LATER */
- intn i=f->file_create_parms.offset_size;
+ intn i = H5F_SIZEOF_OFFSET(f);
/* For non-little-endian platforms, encode each byte in memory backwards */
#if ((DF_MT&0xFFF0)!=0x4440)
@@ -263,9 +263,9 @@ done:
hbool_t H5Fis_hdf5(const char *filename)
{
CONSTR(FUNC, "H5Fis_hdf5"); /* for HERROR */
- hdf_file_t f_handle=H5FI_INVALID_FILE; /* file handle */
+ hdf_file_t f_handle=H5F_INVALID_FILE; /* file handle */
uint8 temp_buf[HDF5_FILE_SIGNATURE_LEN]; /* temporary buffer for checking file signature */
- size_t curr_off=0; /* The current offset to check in the file */
+ haddr_t curr_off=0; /* The current offset to check in the file */
size_t file_len=0; /* The length of the file we are checking */
hbool_t ret_value = BFALSE;
@@ -277,21 +277,21 @@ hbool_t H5Fis_hdf5(const char *filename)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, BFAIL);
/* Open the file */
- f_handle=H5FI_OPEN(filename,0);
- if(H5FI_OPENERR(f_handle))
+ f_handle=H5F_OPEN(filename,0);
+ if(H5F_OPENERR(f_handle))
HGOTO_ERROR(H5E_FILE, H5E_BADFILE, BFAIL);
/* Get the length of the file */
- if(H5FI_SEEKEND(f_handle)==FAIL)
+ if(H5F_SEEKEND(f_handle)==FAIL)
HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, BFAIL);
- file_len=H5FI_TELL(f_handle);
+ file_len=H5F_TELL(f_handle);
/* Check the offsets where the file signature is possible */
while(curr_off<file_len)
{
- if(H5FI_SEEK(f_handle,curr_off)==FAIL)
+ if(H5F_SEEK(f_handle,curr_off)==FAIL)
HGOTO_ERROR(H5E_IO, H5E_READERROR, BFAIL);
- if(H5FI_READ(f_handle,temp_buf, HDF5_FILE_SIGNATURE_LEN)==FAIL)
+ if(H5F_READ(f_handle,temp_buf, HDF5_FILE_SIGNATURE_LEN)==FAIL)
HGOTO_ERROR(H5E_IO, H5E_READERROR, BFAIL);
if(HDmemcmp(temp_buf,HDF5_FILE_SIGNATURE,HDF5_FILE_SIGNATURE_LEN)==0)
{
@@ -303,15 +303,15 @@ hbool_t H5Fis_hdf5(const char *filename)
else
curr_off*=2;
} /* end while */
- H5FI_CLOSE(f_handle); /* close the file we opened */
+ H5F_CLOSE(f_handle); /* close the file we opened */
done:
if(ret_value == BFAIL)
{ /* Error condition cleanup */
/* Check if we left a dangling file handle */
- if(f_handle!=H5FI_INVALID_FILE)
- H5FI_CLOSE(f_handle); /* close the file we opened */
+ if(f_handle!=H5F_INVALID_FILE)
+ H5F_CLOSE(f_handle); /* close the file we opened */
} /* end if */
@@ -425,7 +425,7 @@ hatom_t H5Fcreate(const char *filename, uintn flags, hatom_t create_temp, hatom_
{
CONSTR(FUNC, "H5Fcreate"); /* for HERROR */
hdf5_file_t *new_file=NULL; /* file struct for new file */
- hdf_file_t f_handle=H5FI_INVALID_FILE; /* file handle */
+ hdf_file_t f_handle=H5F_INVALID_FILE; /* file handle */
const file_create_temp_t *f_create_parms; /* pointer to the parameters to use when creating the file */
uint8 temp_buf[2048], *p; /* temporary buffer for encoding header */
intn file_exists=0; /* flag to indicate that file exists already */
@@ -443,12 +443,12 @@ hatom_t H5Fcreate(const char *filename, uintn flags, hatom_t create_temp, hatom_
HGOTO_ERROR(H5E_FILE, H5E_FILEOPEN, FAIL);
/* Check if the file already exists */
- f_handle=H5FI_OPEN(filename,0);
- if(!H5FI_OPENERR(f_handle))
+ f_handle=H5F_OPEN(filename,0);
+ if(!H5F_OPENERR(f_handle))
{
file_exists=1; /* set the flag to indicate that the file already exists */
- H5FI_CLOSE(f_handle); /* close the file we opened */
- f_handle=H5FI_INVALID_FILE;
+ H5F_CLOSE(f_handle); /* close the file we opened */
+ f_handle=H5F_INVALID_FILE;
} /* end if */
/* throw an error if the file exists and we aren't allowed to overwrite it */
@@ -456,8 +456,8 @@ hatom_t H5Fcreate(const char *filename, uintn flags, hatom_t create_temp, hatom_
HGOTO_ERROR(H5E_FILE, H5E_FILEEXISTS, FAIL);
/* OK to create/overwrite the file */
- f_handle=H5FI_CREATE(filename);
- if(H5FI_OPENERR(f_handle))
+ f_handle=H5F_CREATE(filename);
+ if(H5F_OPENERR(f_handle))
HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL);
/* Create the file node */
@@ -493,11 +493,11 @@ hatom_t H5Fcreate(const char *filename, uintn flags, hatom_t create_temp, hatom_
/* Seek to the correct offset to write out the file signature & boot-block */
if(new_file->file_create_parms.userblock_size>0)
- if(H5FI_SEEK(new_file->file_handle,new_file->file_create_parms.userblock_size)==FAIL)
+ if(H5F_SEEK(new_file->file_handle,new_file->file_create_parms.userblock_size)==FAIL)
HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL);
/* Write out the file-signature */
- if(H5FI_WRITE(new_file->file_handle,HDF5_FILE_SIGNATURE,HDF5_FILE_SIGNATURE_LEN)==FAIL)
+ if(H5F_WRITE(new_file->file_handle,HDF5_FILE_SIGNATURE,HDF5_FILE_SIGNATURE_LEN)==FAIL)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL);
/* Encode the boot block */
@@ -523,7 +523,7 @@ hatom_t H5Fcreate(const char *filename, uintn flags, hatom_t create_temp, hatom_
}
/* Write out the boot block */
- if(H5FI_WRITE(new_file->file_handle,temp_buf,(size_t)(p-temp_buf))==FAIL)
+ if(H5F_WRITE(new_file->file_handle,temp_buf,(size_t)(p-temp_buf))==FAIL)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL);
new_file->logical_len = p - temp_buf;
@@ -537,8 +537,8 @@ done:
{ /* Error condition cleanup */
/* Check if we left a dangling file handle */
- if(f_handle!=H5FI_INVALID_FILE)
- H5FI_CLOSE(f_handle); /* close the file we opened */
+ if(f_handle!=H5F_INVALID_FILE)
+ H5F_CLOSE(f_handle); /* close the file we opened */
/* Check if we left a dangling file struct */
if (new_file) H5F_dest (new_file);
@@ -581,11 +581,11 @@ hatom_t H5Fopen(const char *filename, uintn flags, hatom_t access_temp)
{
CONSTR(FUNC, "H5Fopen"); /* for HERROR */
hdf5_file_t *new_file=NULL; /* file struct for new file */
- hdf_file_t f_handle=H5FI_INVALID_FILE; /* file handle */
+ hdf_file_t f_handle=H5F_INVALID_FILE; /* file handle */
hatom_t create_temp; /* file-creation template ID */
const file_create_temp_t *f_create_parms; /* pointer to the parameters to use when creating the file */
uint8 temp_buf[2048], *p; /* temporary buffer for encoding header */
- size_t curr_off=0; /* The current offset to check in the file */
+ haddr_t curr_off=0; /* The current offset to check in the file */
size_t file_len=0; /* The length of the file we are checking */
hatom_t ret_value = FAIL;
@@ -617,8 +617,8 @@ hatom_t H5Fopen(const char *filename, uintn flags, hatom_t access_temp)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL);
/* Check if the file already exists */
- f_handle=H5FI_OPEN(filename,flags);
- if(H5FI_OPENERR(f_handle))
+ f_handle=H5F_OPEN(filename,flags);
+ if(H5F_OPENERR(f_handle))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPEN, FAIL);
/* Create the file node */
@@ -648,16 +648,16 @@ hatom_t H5Fopen(const char *filename, uintn flags, hatom_t access_temp)
/* Seek to the correct offset to read in the file signature & boot-block */
/* Get the length of the file */
- if(H5FI_SEEKEND(new_file->file_handle)==FAIL)
+ if(H5F_SEEKEND(new_file->file_handle)==FAIL)
HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, BFAIL);
- file_len=H5FI_TELL(new_file->file_handle);
+ file_len=H5F_TELL(new_file->file_handle);
/* Check the offsets where the file signature is possible */
while(curr_off<file_len)
{
- if(H5FI_SEEK(new_file->file_handle,curr_off)==FAIL)
+ if(H5F_SEEK(new_file->file_handle,curr_off)==FAIL)
HGOTO_ERROR(H5E_IO, H5E_READERROR, BFAIL);
- if(H5FI_READ(new_file->file_handle,temp_buf, HDF5_FILE_SIGNATURE_LEN)==FAIL)
+ if(H5F_READ(new_file->file_handle,temp_buf, HDF5_FILE_SIGNATURE_LEN)==FAIL)
HGOTO_ERROR(H5E_IO, H5E_READERROR, BFAIL);
if(HDmemcmp(temp_buf,HDF5_FILE_SIGNATURE,HDF5_FILE_SIGNATURE_LEN)==0)
{
@@ -673,7 +673,7 @@ hatom_t H5Fopen(const char *filename, uintn flags, hatom_t access_temp)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL);
/* Read in the fixed-size part of the boot-block */
- if(H5FI_READ(new_file->file_handle,temp_buf,16)==FAIL)
+ if(H5F_READ(new_file->file_handle,temp_buf,16)==FAIL)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL);
/* Decode the boot block */
@@ -706,8 +706,8 @@ done:
{ /* Error condition cleanup */
/* Check if we left a dangling file handle */
- if(f_handle!=H5FI_INVALID_FILE)
- H5FI_CLOSE(f_handle); /* close the file we opened */
+ if(f_handle!=H5F_INVALID_FILE)
+ H5F_CLOSE(f_handle); /* close the file we opened */
/* Check if we left a dangling file struct */
if(new_file) HDfree(new_file);
@@ -758,8 +758,8 @@ herr_t H5Fclose(hatom_t fid)
if((--file->ref_count)==0)
{
H5AC_flush (file, NULL, 0, TRUE);
- if(file->file_handle!=H5FI_INVALID_FILE) {
- H5FI_CLOSE(file->file_handle);
+ if(file->file_handle!=H5F_INVALID_FILE) {
+ H5F_CLOSE(file->file_handle);
}
H5F_dest (file);
if(H5Aremove_atom(fid)==NULL) {
@@ -797,7 +797,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_block_read (hdf5_file_t *f, off_t addr, size_t size, void *buf)
+H5F_block_read (hdf5_file_t *f, haddr_t addr, size_t size, void *buf)
{
CONSTR(FUNC, "H5F_block_read"); /* for HERROR */
@@ -806,9 +806,9 @@ H5F_block_read (hdf5_file_t *f, off_t addr, size_t size, void *buf)
if (0==size) return 0;
addr += f->file_create_parms.userblock_size;
- if (H5FI_SEEK (f->file_handle, addr)<0)
+ if (H5F_SEEK (f->file_handle, addr)<0)
HRETURN_ERROR(H5E_IO, H5E_SEEKERROR, FAIL);
- if (H5FI_READ (f->file_handle, buf, size)<0)
+ if (H5F_READ (f->file_handle, buf, size)<0)
HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL);
PABLO_TRACE_OFF(H5F_mask, ID_H5F_block_read);
return SUCCEED;
@@ -834,7 +834,7 @@ 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)
+H5F_block_write (hdf5_file_t *f, haddr_t addr, size_t size, void *buf)
{
CONSTR(FUNC, "H5F_block_write"); /* for HERROR */
@@ -843,9 +843,9 @@ H5F_block_write (hdf5_file_t *f, off_t addr, size_t size, void *buf)
if (0==size) return 0;
addr += f->file_create_parms.userblock_size;
- if (H5FI_SEEK (f->file_handle, addr)<0)
+ if (H5F_SEEK (f->file_handle, addr)<0)
HRETURN_ERROR(H5E_IO, H5E_SEEKERROR, FAIL);
- if (H5FI_WRITE (f->file_handle, buf, size)<0)
+ if (H5F_WRITE (f->file_handle, buf, size)<0)
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL);
PABLO_TRACE_OFF(H5F_mask, ID_H5F_block_write);
return SUCCEED;
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 */
diff --git a/src/H5G.c b/src/H5G.c
index fafecac..1af38f3 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -104,7 +104,7 @@ H5G_decode (hdf5_file_t *f, uint8 **pp, H5G_entry_t *ent)
abort();
}
- *pp = p_ret + 2*SIZEOF_OFFSET(f) + 4 + 24;
+ *pp = p_ret + 2*H5F_SIZEOF_OFFSET(f) + 4 + 24;
return 0;
}
@@ -190,7 +190,7 @@ H5G_encode (hdf5_file_t *f, uint8 **pp, H5G_entry_t *ent)
abort();
}
- *pp = p_ret + 2*SIZEOF_OFFSET(f) + 4 + 24;
+ *pp = p_ret + 2*H5F_SIZEOF_OFFSET(f) + 4 + 24;
return 0;
}
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 733e637..53b28c6 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -35,27 +35,27 @@
static void H5G_node_decode_key (hdf5_file_t *f, uint8 *raw, void *_key);
static void H5G_node_encode_key (hdf5_file_t *f, uint8 *raw, void *_key);
static size_t H5G_node_size (hdf5_file_t *f);
-static off_t H5G_node_new (hdf5_file_t *f, void *_lt_key, void *_udata,
- void *_rt_key);
-static herr_t H5G_node_flush (hdf5_file_t *f, hbool_t destroy, off_t addr,
+static haddr_t H5G_node_new (hdf5_file_t *f, void *_lt_key, void *_udata,
+ void *_rt_key);
+static herr_t H5G_node_flush (hdf5_file_t *f, hbool_t destroy, haddr_t addr,
H5G_node_t *sym);
-static H5G_node_t *H5G_node_load (hdf5_file_t *f, off_t addr,
+static H5G_node_t *H5G_node_load (hdf5_file_t *f, haddr_t addr,
const void *_data);
static intn H5G_node_cmp (hdf5_file_t *f, void *_lt_key, void *_udata,
void *_rt_key);
-static herr_t H5G_node_found (hdf5_file_t *f, off_t addr, void *_lt_key,
+static herr_t H5G_node_found (hdf5_file_t *f, haddr_t addr, void *_lt_key,
void *_udata, void *_rt_key);
-static off_t H5G_node_insert (hdf5_file_t *f, off_t addr, intn *anchor,
- void *_lt_key, hbool_t *lt_key_changed,
- void *_md_key, void *_udata,
- void *_rt_key, hbool_t *rt_key_changed);
-static herr_t H5G_node_list (hdf5_file_t *f, off_t addr, void *_udata);
+static haddr_t H5G_node_insert (hdf5_file_t *f, haddr_t addr, intn *anchor,
+ void *_lt_key, hbool_t *lt_key_changed,
+ void *_md_key, void *_udata,
+ void *_rt_key, hbool_t *rt_key_changed);
+static herr_t H5G_node_list (hdf5_file_t *f, haddr_t addr, void *_udata);
static size_t H5G_node_sizeof_rkey (hdf5_file_t *f);
/* H5G inherits cache-like properties from H5AC */
static const H5AC_class_t H5AC_SNODE[1] = {{
- (void*(*)(hdf5_file_t*,off_t,const void*))H5G_node_load,
- (herr_t(*)(hdf5_file_t*,hbool_t,off_t,void*))H5G_node_flush,
+ (void*(*)(hdf5_file_t*,haddr_t,const void*))H5G_node_load,
+ (herr_t(*)(hdf5_file_t*,hbool_t,haddr_t,void*))H5G_node_flush,
}};
/* H5G inherits B-tree like properties from H5B */
@@ -95,7 +95,7 @@ static const H5B_class_t H5B_SNODE[1] = {{
static size_t
H5G_node_sizeof_rkey (hdf5_file_t *f)
{
- return SIZEOF_OFFSET(f);
+ return H5F_SIZEOF_OFFSET(f);
}
@@ -167,7 +167,7 @@ H5G_node_encode_key (hdf5_file_t *f, uint8 *raw, void *_key)
static size_t
H5G_node_size (hdf5_file_t *f)
{
- return H5G_HDR_SIZE(f) + (2*H5G_NODE_K) * (2*SIZEOF_OFFSET(f));
+ return H5G_HDR_SIZE(f) + (2*H5G_NODE_K) * (2*H5F_SIZEOF_OFFSET(f));
}
@@ -191,14 +191,14 @@ H5G_node_size (hdf5_file_t *f)
*
*-------------------------------------------------------------------------
*/
-static off_t
+static haddr_t
H5G_node_new (hdf5_file_t *f, void *_lt_key, void *_udata, void *_rt_key)
{
H5G_node_key_t *lt_key = (H5G_node_key_t*)_lt_key;
H5G_node_key_t *rt_key = (H5G_node_key_t*)_rt_key;
H5G_node_t *sym = H5MM_xcalloc (1, sizeof(H5G_node_t));
size_t size = H5G_node_size (f);
- off_t addr = H5MF_alloc (f, size);
+ haddr_t addr = H5MF_alloc (f, size);
sym->dirty = 1;
sym->entry = H5MM_xcalloc (2 * H5G_NODE_K, sizeof(H5G_entry_t));
@@ -234,7 +234,7 @@ H5G_node_new (hdf5_file_t *f, void *_lt_key, void *_udata, void *_rt_key)
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_node_flush (hdf5_file_t *f, hbool_t destroy, off_t addr, H5G_node_t *sym)
+H5G_node_flush (hdf5_file_t *f, hbool_t destroy, haddr_t addr, H5G_node_t *sym)
{
uint8 *buf=NULL, *p=NULL;
size_t size;
@@ -291,7 +291,7 @@ H5G_node_flush (hdf5_file_t *f, hbool_t destroy, off_t addr, H5G_node_t *sym)
*-------------------------------------------------------------------------
*/
static H5G_node_t *
-H5G_node_load (hdf5_file_t *f, off_t addr, const void *_udata)
+H5G_node_load (hdf5_file_t *f, haddr_t addr, const void *_udata)
{
H5G_node_t *sym = H5MM_xcalloc (1, sizeof(H5G_node_t));
size_t size = H5G_node_size (f);
@@ -399,7 +399,7 @@ H5G_node_cmp (hdf5_file_t *f, void *_lt_key, void *_udata, void *_rt_key)
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_node_found (hdf5_file_t *f, off_t addr, void *_lt_key, void *_udata,
+H5G_node_found (hdf5_file_t *f, haddr_t addr, void *_lt_key, void *_udata,
void *_rt_key)
{
H5G_node_ud1_t *udata = (H5G_node_ud1_t *)_udata;
@@ -469,8 +469,8 @@ H5G_node_found (hdf5_file_t *f, off_t addr, void *_lt_key, void *_udata,
*
*-------------------------------------------------------------------------
*/
-static off_t
-H5G_node_insert (hdf5_file_t *f, off_t addr, intn *anchor,
+static haddr_t
+H5G_node_insert (hdf5_file_t *f, haddr_t addr, intn *anchor,
void *_lt_key, hbool_t *lt_key_changed,
void *_md_key, void *_udata,
void *_rt_key, hbool_t *rt_key_changed)
@@ -481,7 +481,7 @@ H5G_node_insert (hdf5_file_t *f, off_t addr, intn *anchor,
H5G_node_t *sn;
H5G_entry_t ent[2*H5G_NODE_K];
- off_t new_node=0, offset;
+ haddr_t new_node=0, offset;
const char *s;
intn idx=-1, nsyms, cmp=1;
intn lt=0, rt; /*binary search cntrs */
@@ -613,7 +613,7 @@ H5G_node_insert (hdf5_file_t *f, off_t addr, intn *anchor,
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_node_list (hdf5_file_t *f, off_t addr, void *_udata)
+H5G_node_list (hdf5_file_t *f, haddr_t addr, void *_udata)
{
H5G_node_list_t *udata = (H5G_node_list_t *)_udata;
H5G_entry_t *ent;
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index 3316771..4b7930d 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -46,7 +46,7 @@ typedef enum H5G_type_t {
*/
typedef struct H5G_entry_t {
off_t name_off; /*offset of name within name heap */
- off_t header; /*file address of object header */
+ haddr_t header; /*file address of object header */
H5G_type_t type; /*type of information cached */
union {
@@ -57,8 +57,8 @@ typedef struct H5G_entry_t {
} sdata;
struct {
- off_t btree; /*file address of symbol table B-tree */
- off_t heap; /*file address of symtab name heap */
+ haddr_t btree; /*file address of symbol table B-tree */
+ haddr_t heap; /*file address of symtab name heap */
} symtab;
} cache; /*cached data from object header */
} H5G_entry_t;
@@ -92,7 +92,7 @@ typedef struct H5G_node_ud1_t {
/* downward */
char *name; /*points to temporary memory */
- off_t heap; /*symbol table heap address */
+ haddr_t heap; /*symbol table heap address */
/* upward */
H5G_entry_t entry; /*symbol table entry */
@@ -105,7 +105,7 @@ typedef struct H5G_node_list_t {
H5G_entry_t *entry; /*array of entries, alloc'd by caller */
char **name; /*array of string ptrs, allocd by caller*/
intn nentries; /*size of the ADDR and NAME arrays */
- off_t heap; /*heap address */
+ haddr_t heap; /*heap address */
/* upward */
intn nused; /*num. symbols processed */
diff --git a/src/H5H.c b/src/H5H.c
index 39ec56b..9805bbd 100644
--- a/src/H5H.c
+++ b/src/H5H.c
@@ -24,8 +24,8 @@
#define H5H_MAGIC "HEAP" /*heap magic number */
#define H5H_FREE_NULL 1 /*end of free list on disk */
-#define H5H_HDR_SIZE(F) (4+SIZEOF_SIZE(F)+2*SIZEOF_OFFSET(F))
-#define H5H_SIZEOF_FREE(F) (SIZEOF_SIZE(F)+SIZEOF_OFFSET(F))
+#define H5H_HDR_SIZE(F) (4+H5F_SIZEOF_SIZE(F)+2*H5F_SIZEOF_OFFSET(F))
+#define H5H_SIZEOF_FREE(F) (H5F_SIZEOF_SIZE(F)+H5F_SIZEOF_OFFSET(F))
typedef struct H5H_free_t {
off_t offset; /*offset of free block */
@@ -36,23 +36,23 @@ typedef struct H5H_free_t {
typedef struct H5H_t {
intn dirty;
- off_t addr; /*address of data */
+ haddr_t addr; /*address of data */
size_t disk_alloc; /*data bytes allocated on disk */
size_t mem_alloc; /*data bytes allocated in mem */
uint8 *chunk; /*the chunk, including header */
H5H_free_t *freelist; /*the free list */
} H5H_t;
-static H5H_t *H5H_load (hdf5_file_t *f, off_t addr, const void *udata);
-static herr_t H5H_flush (hdf5_file_t *f, hbool_t dest, off_t addr,
+static H5H_t *H5H_load (hdf5_file_t *f, haddr_t addr, const void *udata);
+static herr_t H5H_flush (hdf5_file_t *f, hbool_t dest, haddr_t addr,
H5H_t *heap);
/*
* H5H inherits cache-like properties from H5AC
*/
static const H5AC_class_t H5AC_HEAP[1] = {{
- (void*(*)(hdf5_file_t*,off_t,const void*))H5H_load,
- (herr_t(*)(hdf5_file_t*,hbool_t,off_t,void*))H5H_flush,
+ (void*(*)(hdf5_file_t*,haddr_t,const void*))H5H_load,
+ (herr_t(*)(hdf5_file_t*,hbool_t,haddr_t,void*))H5H_flush,
}};
@@ -78,12 +78,12 @@ static const H5AC_class_t H5AC_HEAP[1] = {{
*
*-------------------------------------------------------------------------
*/
-off_t
+haddr_t
H5H_new (hdf5_file_t *f, size_t size_hint)
{
H5H_t *heap = NULL;
size_t total_size; /*total heap size on disk */
- off_t addr; /*heap file address */
+ haddr_t addr; /*heap file address */
assert (f);
size_hint = MAX (0, size_hint);
@@ -138,12 +138,12 @@ H5H_new (hdf5_file_t *f, size_t size_hint)
*-------------------------------------------------------------------------
*/
static H5H_t *
-H5H_load (hdf5_file_t *f, off_t addr, const void *udata)
+H5H_load (hdf5_file_t *f, haddr_t addr, const void *udata)
{
uint8 hdr[20], *p;
H5H_t *heap = H5MM_xcalloc (1, sizeof(H5H_t));
H5H_free_t *fl=NULL, *tail=NULL;
- off_t free_block;
+ haddr_t free_block;
assert (addr>0);
assert (H5H_HDR_SIZE(f) <= sizeof hdr);
@@ -220,7 +220,7 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-H5H_flush (hdf5_file_t *f, hbool_t destroy, off_t addr, H5H_t *heap)
+H5H_flush (hdf5_file_t *f, hbool_t destroy, haddr_t addr, H5H_t *heap)
{
uint8 *p = heap->chunk;
H5H_free_t *fl = heap->freelist;
@@ -325,7 +325,7 @@ H5H_flush (hdf5_file_t *f, hbool_t destroy, off_t addr, H5H_t *heap)
*-------------------------------------------------------------------------
*/
void *
-H5H_read (hdf5_file_t *f, off_t addr, off_t offset, size_t size, void *buf)
+H5H_read (hdf5_file_t *f, haddr_t addr, off_t offset, size_t size, void *buf)
{
H5H_t *heap = H5AC_find (f, H5AC_HEAP, addr, NULL);
@@ -369,7 +369,7 @@ H5H_read (hdf5_file_t *f, off_t addr, off_t offset, size_t size, void *buf)
*-------------------------------------------------------------------------
*/
const void *
-H5H_peek (hdf5_file_t *f, off_t addr, off_t offset)
+H5H_peek (hdf5_file_t *f, haddr_t addr, off_t offset)
{
H5H_t *heap = H5AC_find (f, H5AC_HEAP, addr, NULL);
@@ -421,7 +421,7 @@ H5H_remove_free (H5H_t *heap, H5H_free_t *fl)
*-------------------------------------------------------------------------
*/
off_t
-H5H_insert (hdf5_file_t *f, off_t addr, size_t size, const void *buf)
+H5H_insert (hdf5_file_t *f, haddr_t addr, size_t size, const void *buf)
{
H5H_t *heap = H5AC_find (f, H5AC_HEAP, addr, NULL);
H5H_free_t *fl=NULL, *max_fl=NULL;
@@ -537,7 +537,7 @@ H5H_insert (hdf5_file_t *f, off_t addr, size_t size, const void *buf)
*-------------------------------------------------------------------------
*/
herr_t
-H5H_write (hdf5_file_t *f, off_t addr, off_t offset, size_t size,
+H5H_write (hdf5_file_t *f, haddr_t addr, off_t offset, size_t size,
const void *buf)
{
H5H_t *heap = H5AC_find (f, H5AC_HEAP, addr, NULL);
@@ -581,7 +581,7 @@ H5H_write (hdf5_file_t *f, off_t addr, off_t offset, size_t size,
*-------------------------------------------------------------------------
*/
herr_t
-H5H_remove (hdf5_file_t *f, off_t addr, off_t offset, size_t size)
+H5H_remove (hdf5_file_t *f, haddr_t addr, off_t offset, size_t size)
{
H5H_t *heap = H5AC_find (f, H5AC_HEAP, addr, NULL);
H5H_free_t *fl = heap->freelist, *fl2 = NULL;
diff --git a/src/H5Hprivate.h b/src/H5Hprivate.h
index b90d727..f896b4a 100644
--- a/src/H5Hprivate.h
+++ b/src/H5Hprivate.h
@@ -23,14 +23,14 @@
/*
* Library prototypes...
*/
-off_t H5H_new (hdf5_file_t *f, size_t size_hint);
-void *H5H_read (hdf5_file_t *f, off_t addr, off_t offset, size_t size,
+haddr_t H5H_new (hdf5_file_t *f, size_t size_hint);
+void *H5H_read (hdf5_file_t *f, haddr_t addr, off_t offset, size_t size,
void *buf);
-const void *H5H_peek (hdf5_file_t *f, off_t addr, off_t offset);
-off_t H5H_insert (hdf5_file_t *f, off_t addr, size_t size, const void *buf);
-herr_t H5H_write (hdf5_file_t *f, off_t addr, off_t offset, size_t size,
+const void *H5H_peek (hdf5_file_t *f, haddr_t addr, off_t offset);
+off_t H5H_insert (hdf5_file_t *f, haddr_t addr, size_t size, const void *buf);
+herr_t H5H_write (hdf5_file_t *f, haddr_t addr, off_t offset, size_t size,
const void *buf);
-herr_t H5H_remove (hdf5_file_t *f, off_t addr, off_t offset, size_t size);
+herr_t H5H_remove (hdf5_file_t *f, haddr_t addr, off_t offset, size_t size);
#endif
diff --git a/src/H5MF.c b/src/H5MF.c
index 0bd1f4f..16c2746 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -40,10 +40,10 @@
*
*-------------------------------------------------------------------------
*/
-off_t
+haddr_t
H5MF_alloc (hdf5_file_t *f, size_t size)
{
- off_t addr;
+ haddr_t addr;
assert (f);
assert (f->logical_len>0);
@@ -76,7 +76,7 @@ H5MF_alloc (hdf5_file_t *f, size_t size)
*-------------------------------------------------------------------------
*/
herr_t
-H5MF_free (hdf5_file_t *f, off_t addr, size_t size)
+H5MF_free (hdf5_file_t *f, haddr_t addr, size_t size)
{
if (addr<=0 || 0==size) return 0;
diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h
index a040eda..19265ac 100644
--- a/src/H5MFprivate.h
+++ b/src/H5MFprivate.h
@@ -22,7 +22,7 @@
/*
* Library prototypes...
*/
-off_t H5MF_alloc (hdf5_file_t *f, size_t size);
-herr_t H5MF_free (hdf5_file_t *f, off_t addr, size_t size);
+haddr_t H5MF_alloc (hdf5_file_t *f, size_t size);
+herr_t H5MF_free (hdf5_file_t *f, haddr_t addr, size_t size);
#endif
diff --git a/src/hdf5plat.h b/src/hdf5plat.h
index 5c5f649..25d89cb 100644
--- a/src/hdf5plat.h
+++ b/src/hdf5plat.h
@@ -78,6 +78,9 @@
#endif /* __STDC__ */
#endif /* SUN || sun */
+/*************************************************************************/
+/*************************************************************************/
+/*************************************************************************/
/*
* CPU: Sparc
* OS: Solaris 1.x, SunOS 4.1.x
@@ -143,6 +146,9 @@ typedef int intf; /* size of INTEGERs in Fortran compiler */
#endif /* ANSISUN */
+/*************************************************************************/
+/*************************************************************************/
+/*************************************************************************/
/*
* CPU: IBM RS/6000 chip/PowerPC
* OS: AIX
@@ -209,6 +215,9 @@ typedef int intf; /* size of INTEGERs in Fortran compiler */
#endif /* IBM6000 */
+/*************************************************************************/
+/*************************************************************************/
+/*************************************************************************/
/*
* CPU: HP PA-RISC
* OS: HP/UX (ConvexOS?)
@@ -275,6 +284,9 @@ typedef int intf; /* size of INTEGERs in Fortran compiler */
#endif /* HP9000 */
+/*************************************************************************/
+/*************************************************************************/
+/*************************************************************************/
/*
* CPU: MIPS
* OS: IRIX
@@ -342,6 +354,9 @@ typedef int intf; /* size of INTEGERs in Fortran compiler */
#endif /* IRIX */
+/*************************************************************************/
+/*************************************************************************/
+/*************************************************************************/
/*
* CPU: Cray Vector CPU (is there a name for these? :-)
* OS: UNICOS
@@ -412,6 +427,9 @@ typedef int intf; /* size of INTEGERs in Fortran compiler */
#endif /* UNICOS */
+/*************************************************************************/
+/*************************************************************************/
+/*************************************************************************/
/*
* CPU: Cray Vector CPU (is there a name for these? :-)
* OS: UNICOS (on massively parallel systems, like T3D & T3E)
@@ -483,6 +501,9 @@ typedef int intf; /* size of INTEGERs in Fortran compiler */
#endif /* CRAYMPP */
+/*************************************************************************/
+/*************************************************************************/
+/*************************************************************************/
/*
* CPU: Motorola 68K, PowerPC (both?)
* OS: MacOS
@@ -551,6 +572,9 @@ void exit(int status);
#endif /*MAC*/
+/*************************************************************************/
+/*************************************************************************/
+/*************************************************************************/
/*
* CPU: Intel x86
* OS: MS Windows '95, Windows NT (& Dos32?), also Linux & FreeBSD
@@ -670,6 +694,9 @@ typedef long intf; /* size of INTEGERs in Fortran compiler */
#endif /* !(defined(__MWERKS__) || defined(MAC)) */
+/*************************************************************************/
+/*************************************************************************/
+/*************************************************************************/
/*
* CPU: Alpha
* OS: Dec Unix (used to be called OSF/1)
diff --git a/src/hdf5port.h b/src/hdf5port.h
index bdec34f..5b7c848 100644
--- a/src/hdf5port.h
+++ b/src/hdf5port.h
@@ -51,92 +51,92 @@
typedef FILE *hdf_file_t;
#ifdef VMS
/* For VMS, use "mbc=64" to improve performance */
-# define H5FI_OPEN(p, a) (((a)&H5ACC_WRITE) ? fopen((p),"r+","mbc=64") : fopen((p), "r", "mbc=64"))
-# define H5FI_CREATE(p) (fopen((p), "w+", "mbc=64"))
+# define H5F_OPEN(p, a) (((a)&H5ACC_WRITE) ? fopen((p),"r+","mbc=64") : fopen((p), "r", "mbc=64"))
+# define H5F_CREATE(p) (fopen((p), "w+", "mbc=64"))
#else /* !VMS */
#if defined SUN && defined (__GNUC__)
-# define H5FI_OPEN(p, a) (((a)&H5ACC_WRITE) ? fopen((p), "r+") : fopen((p), "r"))
-# define H5FI_CREATE(p) (fopen((p), "w+"))
+# define H5F_OPEN(p, a) (((a)&H5ACC_WRITE) ? fopen((p), "r+") : fopen((p), "r"))
+# define H5F_CREATE(p) (fopen((p), "w+"))
#else /* !SUN w/ GNU CC */
-# define H5FI_OPEN(p, a) (((a)&H5ACC_WRITE) ? fopen((p), "rb+") : fopen((p), "rb"))
-# define H5FI_CREATE(p) (fopen((p), "wb+"))
+# define H5F_OPEN(p, a) (((a)&H5ACC_WRITE) ? fopen((p), "rb+") : fopen((p), "rb"))
+# define H5F_CREATE(p) (fopen((p), "wb+"))
#endif /* !SUN w/ GNU CC */
#endif /* VMS */
-# define H5FI_READ(f, b, n) (((size_t)(n) == (size_t)fread((b), 1, (size_t)(n), (f))) ? SUCCEED : FAIL)
-# define H5FI_WRITE(f, b, n) (((size_t)(n) == (size_t)fwrite((b), 1, (size_t)(n), (f))) ? SUCCEED : FAIL)
-# define H5FI_CLOSE(f) (fclose(f))
-# define H5FI_FLUSH(f) (fflush(f)==0 ? SUCCEED : FAIL)
-# define H5FI_SEEK(f,o) (fseek((f), (long)(o), SEEK_SET)==0 ? SUCCEED : FAIL)
-# define H5FI_SEEK_CUR(f,o) (fseek((f), (long)(o), SEEK_CUR)==0 ? SUCCEED : FAIL)
-# define H5FI_SEEKEND(f) (fseek((f), (long)0, SEEK_END)==0 ? SUCCEED : FAIL)
-# define H5FI_TELL(f) (ftell(f))
-# define H5FI_OPENERR(f) ((f) == (FILE *)NULL)
-# define H5FI_INVALID_FILE ((FILE *)NULL)
+# define H5F_READ(f, b, n) (((size_t)(n) == (size_t)fread((b), 1, (size_t)(n), (f))) ? SUCCEED : FAIL)
+# define H5F_WRITE(f, b, n) (((size_t)(n) == (size_t)fwrite((b), 1, (size_t)(n), (f))) ? SUCCEED : FAIL)
+# define H5F_CLOSE(f) (fclose(f))
+# define H5F_FLUSH(f) (fflush(f)==0 ? SUCCEED : FAIL)
+# define H5F_SEEK(f,o) (fseek((f), (long)(o), SEEK_SET)==0 ? SUCCEED : FAIL)
+# define H5F_SEEK_CUR(f,o) (fseek((f), (long)(o), SEEK_CUR)==0 ? SUCCEED : FAIL)
+# define H5F_SEEKEND(f) (fseek((f), (long)0, SEEK_END)==0 ? SUCCEED : FAIL)
+# define H5F_TELL(f) (ftell(f))
+# define H5F_OPENERR(f) ((f) == (FILE *)NULL)
+# define H5F_INVALID_FILE ((FILE *)NULL)
#endif /* FILELIB == POSIXBUFIO */
#if (FILELIB == POSIXUNBUFIO)
/* using POSIX unbuffered file I/O routines to access files */
typedef int hdf_file_t;
-# define H5FI_OPEN(p, a) (((a) & H5ACC_WRITE) ? open((p), O_RDWR) : open((p), O_RDONLY))
-# define H5FI_CREATE(p) (open((p), O_RDWR | O_CREAT | O_TRUNC))
-# define H5FI_CLOSE(f) (close(f))
-# define H5FI_FLUSH(f) (SUCCEED)
-# define H5FI_READ(f, b, n) (((n)==read((f), (char *)(b), (n))) ? SUCCEED : FAIL)
-# define H5FI_WRITE(f, b, n) (((n)==write((f), (char *)(b), (n))) ? SUCCEED : FAIL)
-# define H5FI_SEEK(f, o) (lseek((f), (off_t)(o), SEEK_SET)!=(-1) ? SUCCEED : FAIL)
-# define H5FI_SEEKEND(f) (lseek((f), (off_t)0, SEEK_END)!=(-1) ? SUCCEED : FAIL)
-# define H5FI_TELL(f) (lseek((f), (off_t)0, SEEK_CUR))
-# define H5FI_OPENERR(f) (f < 0)
-# define H5FI_INVALID_FILE ((int)-1)
+# define H5F_OPEN(p, a) (((a) & H5ACC_WRITE) ? open((p), O_RDWR) : open((p), O_RDONLY))
+# define H5F_CREATE(p) (open((p), O_RDWR | O_CREAT | O_TRUNC))
+# define H5F_CLOSE(f) (close(f))
+# define H5F_FLUSH(f) (SUCCEED)
+# define H5F_READ(f, b, n) (((n)==read((f), (char *)(b), (n))) ? SUCCEED : FAIL)
+# define H5F_WRITE(f, b, n) (((n)==write((f), (char *)(b), (n))) ? SUCCEED : FAIL)
+# define H5F_SEEK(f, o) (lseek((f), (off_t)(o), SEEK_SET)!=(-1) ? SUCCEED : FAIL)
+# define H5F_SEEKEND(f) (lseek((f), (off_t)0, SEEK_END)!=(-1) ? SUCCEED : FAIL)
+# define H5F_TELL(f) (lseek((f), (off_t)0, SEEK_CUR))
+# define H5F_OPENERR(f) (f < 0)
+# define H5F_INVALID_FILE ((int)-1)
#endif /* FILELIB == POSIXUNBUFIO */
#if (FILELIB == MACIO)
/* using special routines to redirect to Mac Toolkit I/O */
typedef short hdf_file_t;
-# define H5FI_OPEN(x,y) mopen(x,y)
-# define H5FI_CREATE(name) mopen(name, H5ACC_CREATE)
-# define H5FI_CLOSE(x) mclose(x)
-# define H5FI_FLUSH(a) (SUCCEED)
-# define H5FI_READ(a,b,c) mread(a, (char *) b, (int32) c)
-# define H5FI_WRITE(a,b,c) mwrite(a, (char *) b, (int32) c)
-# define H5FI_SEEK(x,y) mlseek(x, (int32 )y, 0)
-# define H5FI_SEEKEND(x) mlseek(x, 0L, 2)
-# define H5FI_TELL(x) mlseek(x,0L,1)
-# define H5FI_OPENERR(f) (f < 0)
-# define H5FI_INVALID_FILE ((short)-1)
+# define H5F_OPEN(x,y) mopen(x,y)
+# define H5F_CREATE(name) mopen(name, H5ACC_CREATE)
+# define H5F_CLOSE(x) mclose(x)
+# define H5F_FLUSH(a) (SUCCEED)
+# define H5F_READ(a,b,c) mread(a, (char *) b, (int32) c)
+# define H5F_WRITE(a,b,c) mwrite(a, (char *) b, (int32) c)
+# define H5F_SEEK(x,y) mlseek(x, (int32 )y, 0)
+# define H5F_SEEKEND(x) mlseek(x, 0L, 2)
+# define H5F_TELL(x) mlseek(x,0L,1)
+# define H5F_OPENERR(f) (f < 0)
+# define H5F_INVALID_FILE ((short)-1)
#endif /* FILELIB == MACIO */
#if (FILELIB == WINNTIO)
/* using special Windows NT functions to enable reading/writing large chunks */
typedef HFILE hdf_file_t;
-# define H5FI_OPEN(p, a) (((a) & H5ACC_WRITE) ? _lopen((p), OF_READWRITE) : _lopen((p), OF_READ))
-# define H5FI_CREATE(p) (_lcreat((p), 0))
-# define H5FI_READ(f, b, n) (((int32)(n) == _hread((f), (b), (n))) ? SUCCEED : FAIL)
-# define H5FI_WRITE(f, b, n) (((int32)(n) == _hwrite((f), (b), (n))) ? SUCCEED : FAIL)
-# define H5FI_CLOSE(f) (_lclose(f)==0 ? SUCCEED : FAIL)
-# define H5FI_FLUSH(f) (0)
-# define H5FI_SEEK(f, o) (_llseek((f), (long)(o), 0))
-# define H5FI_SEEKEND(f) (_llseek((f), (long)0, 2))
-# define H5FI_TELL(f) (_llseek((f),0l,1))
-# define H5FI_OPENERR(f) ((f) == (HFILE)HFILE_ERROR)
-# define H5FI_INVALID_FILE ((HFILE)HFILE_ERROR)
+# define H5F_OPEN(p, a) (((a) & H5ACC_WRITE) ? _lopen((p), OF_READWRITE) : _lopen((p), OF_READ))
+# define H5F_CREATE(p) (_lcreat((p), 0))
+# define H5F_READ(f, b, n) (((int32)(n) == _hread((f), (b), (n))) ? SUCCEED : FAIL)
+# define H5F_WRITE(f, b, n) (((int32)(n) == _hwrite((f), (b), (n))) ? SUCCEED : FAIL)
+# define H5F_CLOSE(f) (_lclose(f)==0 ? SUCCEED : FAIL)
+# define H5F_FLUSH(f) (0)
+# define H5F_SEEK(f, o) (_llseek((f), (long)(o), 0))
+# define H5F_SEEKEND(f) (_llseek((f), (long)0, 2))
+# define H5F_TELL(f) (_llseek((f),0l,1))
+# define H5F_OPENERR(f) ((f) == (HFILE)HFILE_ERROR)
+# define H5F_INVALID_FILE ((HFILE)HFILE_ERROR)
#endif /* FILELIB == WINNTIO */
#if (FILELIB == PAGEBUFIO)
#include "fmpio.h"
/* using page buffered file I/O routines to access files */
typedef MPFILE *hdf_file_t;
-# define H5FI_OPEN(p, a) (MPopen((p), (a)))
-# define H5FI_CREATE(p) (MPopen((p), H5ACC_CREATE))
-# define H5FI_CLOSE(f) (MPclose(f))
-# define H5FI_FLUSH(f) (MPflush(f))
-# define H5FI_READ(f, b, n) (MPread((f), (char *)(b), (n)))
-# define H5FI_WRITE(f, b, n) (MPwrite((f), (char *)(b), (n)))
-# define H5FI_SEEK(f, o) (MPseek((f), (off_t)(o), SEEK_SET))
-# define H5FI_SEEKEND(f) (MPseek((f), (off_t)0, SEEK_END))
-# define H5FI_TELL(f) (MPseek((f), (off_t)0, SEEK_CUR))
-# define H5FI_OPENERR(f) ((f) == (MPFILE *)NULL)
-# define H5FI_INVALID_FILE ((MPFILE *)NULL)
+# define H5F_OPEN(p, a) (MPopen((p), (a)))
+# define H5F_CREATE(p) (MPopen((p), H5ACC_CREATE))
+# define H5F_CLOSE(f) (MPclose(f))
+# define H5F_FLUSH(f) (MPflush(f))
+# define H5F_READ(f, b, n) (MPread((f), (char *)(b), (n)))
+# define H5F_WRITE(f, b, n) (MPwrite((f), (char *)(b), (n)))
+# define H5F_SEEK(f, o) (MPseek((f), (off_t)(o), SEEK_SET))
+# define H5F_SEEKEND(f) (MPseek((f), (off_t)0, SEEK_END))
+# define H5F_TELL(f) (MPseek((f), (off_t)0, SEEK_CUR))
+# define H5F_OPENERR(f) ((f) == (MPFILE *)NULL)
+# define H5F_INVALID_FILE ((MPFILE *)NULL)
#endif /* FILELIB == PAGEBUFIO */
/**************************************************************************