summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2002-12-02 19:47:57 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2002-12-02 19:47:57 (GMT)
commit437dd9be23c86f8228bcb8b7090189a911cc00ef (patch)
tree759809852985607289214f74b7f827fccad4e746 /src
parent4c546d9e6ee7bae685476df6cd4e627eaab5de12 (diff)
downloadhdf5-437dd9be23c86f8228bcb8b7090189a911cc00ef.zip
hdf5-437dd9be23c86f8228bcb8b7090189a911cc00ef.tar.gz
hdf5-437dd9be23c86f8228bcb8b7090189a911cc00ef.tar.bz2
[svn-r6145]
Purpose: New feature to H5Dget_offset Description: If user block is set, H5Dget_offset should be able to return the absolute offset from the beginning of file. Platforms tested: eirene, arabica
Diffstat (limited to 'src')
-rw-r--r--src/H5D.c12
-rw-r--r--src/H5F.c18
-rw-r--r--src/H5Fprivate.h1
3 files changed, 30 insertions, 1 deletions
diff --git a/src/H5D.c b/src/H5D.c
index fcc3013..7485d7e 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -3736,6 +3736,8 @@ haddr_t
H5D_get_offset(H5D_t *dset)
{
haddr_t ret_value;
+ haddr_t base_addr;
+ H5F_t *f;
FUNC_ENTER_NOAPI(H5D_get_offset, HADDR_UNDEF);
@@ -3750,7 +3752,15 @@ H5D_get_offset(H5D_t *dset)
case H5D_CONTIGUOUS:
/* If dataspace hasn't been allocated or dataset is stored in
* an external file, the value will be HADDR_UNDEF. */
- ret_value = dset->layout.addr;
+ f = H5D_get_file(dset);
+ base_addr = H5F_get_base_addr(f);
+
+ /* If there's user block in file, returns the absolute dataset offset
+ * from the beginning of file. */
+ if(base_addr!=HADDR_UNDEF)
+ ret_value = dset->layout.addr + base_addr;
+ else
+ ret_value = dset->layout.addr;
break;
default:
diff --git a/src/H5F.c b/src/H5F.c
index 1455709..26ac386 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -3509,6 +3509,24 @@ done:
FUNC_LEAVE(ret_value);
} /* end H5F_get_fileno() */
+
+haddr_t
+H5F_get_base_addr(const H5F_t *f)
+{
+ haddr_t ret_value;
+
+ FUNC_ENTER_NOAPI(H5F_get_base_addr, FAIL);
+
+ assert(f);
+ assert(f->shared);
+
+ /* Retrieve the file's base address */
+ ret_value = f->shared->base_addr;
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
/*-------------------------------------------------------------------------
* Function: H5F_block_read
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index ed96763..42f174c 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -354,6 +354,7 @@ H5_DLL herr_t H5F_get_obj_count(H5F_t *f, unsigned types,
unsigned *obj_id_count);
H5_DLL herr_t H5F_get_obj_ids(H5F_t *f, unsigned types, hid_t *obj_id_list);
H5_DLL herr_t H5F_get_vfd_handle(H5F_t *file, hid_t fapl, void** file_handle);
+H5_DLL haddr_t H5F_get_base_addr(const H5F_t *f);
/* Functions that operate on array storage */
H5_DLL herr_t H5F_arr_read (H5F_t *f, hid_t dxpl_id,