diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5FDint.c | 21 | ||||
-rw-r--r-- | src/H5Fsuper.c | 3 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/H5FDint.c b/src/H5FDint.c index aa375e2..74b3bf6 100644 --- a/src/H5FDint.c +++ b/src/H5FDint.c @@ -194,6 +194,11 @@ done: * * Purpose: Private version of H5FDset_eoa() * + * This function expects the EOA is a RELATIVE address, i.e. + * relative to the base address. This is NOT the same as the + * EOA stored in the superblock, which is an absolute + * address. Object addresses are relative. + * * Return: Success: Non-negative * Failure: Negative, no side effect * @@ -212,7 +217,7 @@ H5FD_set_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t addr) HDassert(file && file->cls); HDassert(H5F_addr_defined(addr) && addr <= file->maxaddr); - /* Dispatch to driver */ + /* Dispatch to driver, convert to absolute address */ if((file->cls->set_eoa)(file, type, addr + file->base_addr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver set_eoa request failed") @@ -226,6 +231,11 @@ done: * * Purpose: Private version of H5FDget_eoa() * + * This function returns the EOA as a RELATIVE address, i.e. + * relative to the base address. This is NOT the same as the + * EOA stored in the superblock, which is an absolute + * address. Object addresses are relative. + * * Return: Success: First byte after allocated memory. * Failure: HADDR_UNDEF * @@ -247,7 +257,7 @@ H5FD_get_eoa(const H5FD_t *file, H5FD_mem_t type) if(HADDR_UNDEF == (ret_value = (file->cls->get_eoa)(file, type))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") - /* Adjust for base address in file */ + /* Adjust for base address in file (convert to relative address) */ ret_value -= file->base_addr; done: @@ -260,6 +270,11 @@ done: * * Purpose: Private version of H5FDget_eof() * + * This function returns the EOF as a RELATIVE address, i.e. + * relative to the base address. This will be different + * from the end of the physical file if there is a user + * block. + * * Return: Success: The EOF address. * * Failure: HADDR_UNDEF @@ -288,7 +303,7 @@ H5FD_get_eof(const H5FD_t *file) else ret_value = file->maxaddr; - /* Adjust for base address in file */ + /* Adjust for base address in file (convert to relative address) */ ret_value -= file->base_addr; done: diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 04abfb2..8040554 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -560,7 +560,8 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc) * Tell the file driver how much address space has already been * allocated so that it knows how to allocate additional memory. */ - if(H5FD_set_eoa(lf, H5FD_MEM_SUPER, stored_eoa) < 0) + /* (Account for the stored EOA being absolute offset -NAF) */ + if(H5FD_set_eoa(lf, H5FD_MEM_SUPER, stored_eoa - H5F_BASE_ADDR(f)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to set end-of-address marker for file") /* Read the file's superblock extension, if there is one. */ |