diff options
author | Jacob Smith <jake.smith@hdfgroup.org> | 2019-09-23 22:23:02 (GMT) |
---|---|---|
committer | Jacob Smith <jake.smith@hdfgroup.org> | 2019-09-23 22:23:02 (GMT) |
commit | 35a9e9c50fbbab20ed920daa3daf903d82cd79d7 (patch) | |
tree | 90299be3be2ffe9eb0e53b530eca309d789ac6c0 /src/H5Fio.c | |
parent | 1070468dac5d0fd5e02b69514d7a0dfacfd28606 (diff) | |
parent | 7997eb8c84dd07dacbcc427049f838d883e263b8 (diff) | |
download | hdf5-35a9e9c50fbbab20ed920daa3daf903d82cd79d7.zip hdf5-35a9e9c50fbbab20ed920daa3daf903d82cd79d7.tar.gz hdf5-35a9e9c50fbbab20ed920daa3daf903d82cd79d7.tar.bz2 |
Merge branch 'develop' of https://bitbucket.hdfgroup.org/scm/~jake.smith/hdf5 into bugfix/repack_external_storage
Diffstat (limited to 'src/H5Fio.c')
-rw-r--r-- | src/H5Fio.c | 97 |
1 files changed, 93 insertions, 4 deletions
diff --git a/src/H5Fio.c b/src/H5Fio.c index 69e6bb2..34dd0d6 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -77,6 +77,50 @@ /*------------------------------------------------------------------------- + * Function: H5F_shared_block_read + * + * Purpose: Reads some data from a file/server/etc into a buffer. + * The data is contiguous. The address is relative to the base + * address for the file. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * matzke@llnl.gov + * Jul 10 1997 + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_shared_block_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) +{ + H5FD_mem_t map_type; /* Mapped memory type */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(f_sh); + HDassert(buf); + HDassert(H5F_addr_defined(addr)); + + /* Check for attempting I/O on 'temporary' file address */ + if(H5F_addr_le(f_sh->tmp_addr, (addr + size))) + HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space") + + /* Treat global heap as raw data */ + map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; + + /* Pass through page buffer layer */ + if(H5PB_read(f_sh, map_type, addr, size, buf) < 0) + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "read through page buffer failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_shared_block_read() */ + + +/*------------------------------------------------------------------------- * Function: H5F_block_read * * Purpose: Reads some data from a file/server/etc into a buffer. @@ -113,7 +157,7 @@ H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/* map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; /* Pass through page buffer layer */ - if(H5PB_read(f, map_type, addr, size, buf) < 0) + if(H5PB_read(f->shared, map_type, addr, size, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "read through page buffer failed") done: @@ -122,6 +166,51 @@ done: /*------------------------------------------------------------------------- + * Function: H5F_shared_block_write + * + * Purpose: Writes some data from memory to a file/server/etc. The + * data is contiguous. The address is relative to the base + * address. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * matzke@llnl.gov + * Jul 10 1997 + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_shared_block_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf) +{ + H5FD_mem_t map_type; /* Mapped memory type */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(f_sh); + HDassert(H5F_SHARED_INTENT(f_sh) & H5F_ACC_RDWR); + HDassert(buf); + HDassert(H5F_addr_defined(addr)); + + /* Check for attempting I/O on 'temporary' file address */ + if(H5F_addr_le(f_sh->tmp_addr, (addr + size))) + HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space") + + /* Treat global heap as raw data */ + map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; + + /* Pass through page buffer layer */ + if(H5PB_write(f_sh, map_type, addr, size, buf) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write through page buffer failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_shared_block_write() */ + + +/*------------------------------------------------------------------------- * Function: H5F_block_write * * Purpose: Writes some data from memory to a file/server/etc. The @@ -159,7 +248,7 @@ H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; /* Pass through page buffer layer */ - if(H5PB_write(f, map_type, addr, size, buf) < 0) + if(H5PB_write(f->shared, map_type, addr, size, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write through page buffer failed") done: @@ -170,7 +259,7 @@ done: /*------------------------------------------------------------------------- * Function: H5F_flush_tagged_metadata * - * Purpose: Flushes metadata with specified tag in the metadata cache + * Purpose: Flushes metadata with specified tag in the metadata cache * to disk. * * Return: Non-negative on success/Negative on failure @@ -192,7 +281,7 @@ H5F_flush_tagged_metadata(H5F_t *f, haddr_t tag) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") /* Flush and reset the accumulator */ - if(H5F__accum_reset(f, TRUE) < 0) + if(H5F__accum_reset(f->shared, TRUE) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator") /* Flush file buffers to disk. */ |