summaryrefslogtreecommitdiffstats
path: root/src/H5FDint.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2018-04-29 08:04:21 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2018-04-29 08:04:21 (GMT)
commit01f196b31a03f072b685f998b0805c1f90322c2b (patch)
tree6e1cae004705ade1c870e4c6612a76b55be3c331 /src/H5FDint.c
parentda4b69097756158fdbfcbf52b5b552e2034d263d (diff)
parentb3c5284692093953132c6c8227e0980b670bf4ad (diff)
downloadhdf5-01f196b31a03f072b685f998b0805c1f90322c2b.zip
hdf5-01f196b31a03f072b685f998b0805c1f90322c2b.tar.gz
hdf5-01f196b31a03f072b685f998b0805c1f90322c2b.tar.bz2
Merge branch 'develop' of https://bitbucket.hdfgroup.org/scm/hdffv/hdf5 into merge_hyperslab_updates
Diffstat (limited to 'src/H5FDint.c')
-rw-r--r--src/H5FDint.c155
1 files changed, 69 insertions, 86 deletions
diff --git a/src/H5FDint.c b/src/H5FDint.c
index 0809ac8..023ff57 100644
--- a/src/H5FDint.c
+++ b/src/H5FDint.c
@@ -5,12 +5,10 @@
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
- * the files COPYING and Copyright.html. COPYING can be found at the root *
- * of the source code distribution tree; Copyright.html can be found at the *
- * root level of an installed copy of the electronic HDF5 document set and *
- * is linked from the top-level documents page. It can also be found at *
- * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
- * access to either file, you may request a copy from help@hdfgroup.org. *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
@@ -35,6 +33,7 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* File access */
#include "H5FDpkg.h" /* File Drivers */
@@ -93,9 +92,8 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5FD_locate_signature(H5FD_io_info_t *fdio_info, haddr_t *sig_addr)
+H5FD_locate_signature(H5FD_t *file, haddr_t *sig_addr)
{
- H5FD_t *file;
haddr_t addr, eoa, eof;
uint8_t buf[H5F_SIGNATURE_LEN];
unsigned n, maxpow;
@@ -103,8 +101,7 @@ H5FD_locate_signature(H5FD_io_info_t *fdio_info, haddr_t *sig_addr)
FUNC_ENTER_NOAPI_NOINIT
- HDassert(fdio_info);
- file = fdio_info->file;
+ /* Sanity checks */
HDassert(file);
/* Find the least N such that 2^N is larger than the file size */
@@ -125,7 +122,7 @@ H5FD_locate_signature(H5FD_io_info_t *fdio_info, haddr_t *sig_addr)
addr = (8 == n) ? 0 : (haddr_t)1 << n;
if(H5FD_set_eoa(file, H5FD_MEM_SUPER, addr + H5F_SIGNATURE_LEN) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to set EOA value for file signature")
- if(H5FD_read(fdio_info, H5FD_MEM_SUPER, addr, (size_t)H5F_SIGNATURE_LEN, buf) < 0)
+ if(H5FD_read(file, H5FD_MEM_SUPER, addr, (size_t)H5F_SIGNATURE_LEN, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to read file signature")
if(!HDmemcmp(buf, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN))
break;
@@ -163,47 +160,20 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5FD_read(H5FD_io_info_t *fdio_info, H5FD_mem_t type, haddr_t addr,
- size_t size, void *buf/*out*/)
+H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size,
+ void *buf/*out*/)
{
- H5FD_t *file;
- H5P_genplist_t *io_dxpl;
- haddr_t eoa = HADDR_UNDEF;
- herr_t ret_value = SUCCEED; /* Return value */
+ hid_t dxpl_id; /* DXPL for operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- HDassert(fdio_info);
- file = fdio_info->file;
+ /* Sanity checks */
HDassert(file && file->cls);
- HDassert(TRUE == H5P_class_isa(H5P_CLASS(fdio_info->meta_dxpl), H5P_CLS_DATASET_XFER_g));
- HDassert(TRUE == H5P_class_isa(H5P_CLASS(fdio_info->raw_dxpl), H5P_CLS_DATASET_XFER_g));
HDassert(buf);
- /* Set up proper DXPL for I/O */
- if(H5FD_MEM_DRAW == type)
- io_dxpl = fdio_info->raw_dxpl;
- else
- io_dxpl = fdio_info->meta_dxpl;
-
- /* Sanity check the dxpl type against the mem type */
-#ifdef H5_DEBUG_BUILD
- {
- H5FD_dxpl_type_t dxpl_type; /* Property indicating the type of the internal dxpl */
-
- /* get the dxpl type */
- if(H5P_get(io_dxpl, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't retrieve dxpl type")
-
- /* we shouldn't be here if the dxpl is labeled with NO I/O */
- HDassert(H5FD_NOIO_DXPL != dxpl_type);
-
- if(H5FD_MEM_DRAW == type)
- HDassert(H5FD_RAWDATA_DXPL == dxpl_type);
- else
- HDassert(H5FD_METADATA_DXPL == dxpl_type);
- }
-#endif /* H5_DEBUG_BUILD */
+ /* Get proper DXPL for I/O */
+ dxpl_id = H5CX_get_dxpl();
#ifndef H5_HAVE_PARALLEL
/* Do not return early for Parallel mode since the I/O could be a */
@@ -213,9 +183,6 @@ H5FD_read(H5FD_io_info_t *fdio_info, H5FD_mem_t type, haddr_t addr,
HGOTO_DONE(SUCCEED)
#endif /* H5_HAVE_PARALLEL */
- if(HADDR_UNDEF == (eoa = (file->cls->get_eoa)(file, type)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed")
-
/*
* If the file is open for SWMR read access, allow access to data past
* the end of the allocated space (the 'eoa'). This is done because the
@@ -223,11 +190,18 @@ H5FD_read(H5FD_io_info_t *fdio_info, H5FD_mem_t type, haddr_t addr,
* objects being written within the file by the application performing
* SWMR write operations.
*/
- if(!(file->access_flags & H5F_ACC_SWMR_READ) && ((addr + file->base_addr + size) > eoa))
- HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size = %llu, eoa = %llu", (unsigned long long)(addr + file->base_addr), (unsigned long long)size, (unsigned long long)eoa)
+ if(!(file->access_flags & H5F_ACC_SWMR_READ)) {
+ haddr_t eoa;
+
+ if(HADDR_UNDEF == (eoa = (file->cls->get_eoa)(file, type)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed")
+
+ if((addr + file->base_addr + size) > eoa)
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size = %llu, eoa = %llu", (unsigned long long)(addr + file->base_addr), (unsigned long long)size, (unsigned long long)eoa)
+ } /* end if */
/* Dispatch to driver */
- if((file->cls->read)(file, type, H5P_PLIST_ID(io_dxpl), addr + file->base_addr, size, buf) < 0)
+ if((file->cls->read)(file, type, dxpl_id, addr + file->base_addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed")
done:
@@ -249,47 +223,21 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5FD_write(const H5FD_io_info_t *fdio_info, H5FD_mem_t type, haddr_t addr,
- size_t size, const void *buf)
+H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size,
+ const void *buf)
{
- H5FD_t *file;
- H5P_genplist_t *io_dxpl;
- haddr_t eoa = HADDR_UNDEF;
- herr_t ret_value = SUCCEED; /* Return value */
+ hid_t dxpl_id; /* DXPL for operation */
+ haddr_t eoa = HADDR_UNDEF; /* EOA for file */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- HDassert(fdio_info);
- file = fdio_info->file;
+ /* Sanity checks */
HDassert(file && file->cls);
- HDassert(TRUE == H5P_class_isa(H5P_CLASS(fdio_info->meta_dxpl), H5P_CLS_DATASET_XFER_g));
- HDassert(TRUE == H5P_class_isa(H5P_CLASS(fdio_info->raw_dxpl), H5P_CLS_DATASET_XFER_g));
HDassert(buf);
- /* Set up proper DXPL for I/O */
- if(H5FD_MEM_DRAW == type)
- io_dxpl = fdio_info->raw_dxpl;
- else
- io_dxpl = fdio_info->meta_dxpl;
-
- /* Sanity check the dxpl type against the mem type */
-#ifdef H5_DEBUG_BUILD
- {
- H5FD_dxpl_type_t dxpl_type; /* Property indicating the type of the internal dxpl */
-
- /* get the dxpl type */
- if(H5P_get(io_dxpl, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't retrieve dxpl type")
-
- /* we shouldn't be here if the dxpl is labeled with NO I/O */
- HDassert(H5FD_NOIO_DXPL != dxpl_type);
-
- if(H5FD_MEM_DRAW == type)
- HDassert(H5FD_RAWDATA_DXPL == dxpl_type);
- else
- HDassert(H5FD_METADATA_DXPL == dxpl_type);
- }
-#endif /* H5_DEBUG_BUILD */
+ /* Get proper DXPL for I/O */
+ dxpl_id = H5CX_get_dxpl();
#ifndef H5_HAVE_PARALLEL
/* Do not return early for Parallel mode since the I/O could be a */
@@ -306,7 +254,7 @@ H5FD_write(const H5FD_io_info_t *fdio_info, H5FD_mem_t type, haddr_t addr,
(unsigned long long)(addr+ file->base_addr), (unsigned long long)size, (unsigned long long)eoa)
/* Dispatch to driver */
- if((file->cls->write)(file, type, H5P_PLIST_ID(io_dxpl), addr + file->base_addr, size, buf) < 0)
+ if((file->cls->write)(file, type, dxpl_id, addr + file->base_addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write request failed")
done:
@@ -435,3 +383,38 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_get_eof() */
+
+/*-------------------------------------------------------------------------
+* Function: H5FD_driver_query
+*
+* Purpose: Similar to H5FD_query(), but intended for cases when we don't
+* have a file available (e.g. before one is opened). Since we
+* can't use the file to get the driver, the driver is passed in
+* as a parameter.
+*
+* Return: SUCCEED/FAIL
+*
+* Programmer: Jacob Gruber
+* Wednesday, August 17, 2011
+*
+*-------------------------------------------------------------------------
+*/
+herr_t
+H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*out*/)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(driver);
+ HDassert(flags);
+
+ /* Check for the driver to query and then query it */
+ if(driver->query)
+ ret_value = (driver->query)(NULL, flags);
+ else
+ *flags = 0;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_driver_query() */
+