diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2002-12-02 19:47:57 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2002-12-02 19:47:57 (GMT) |
commit | 437dd9be23c86f8228bcb8b7090189a911cc00ef (patch) | |
tree | 759809852985607289214f74b7f827fccad4e746 /src | |
parent | 4c546d9e6ee7bae685476df6cd4e627eaab5de12 (diff) | |
download | hdf5-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.c | 12 | ||||
-rw-r--r-- | src/H5F.c | 18 | ||||
-rw-r--r-- | src/H5Fprivate.h | 1 |
3 files changed, 30 insertions, 1 deletions
@@ -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: @@ -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, |