summaryrefslogtreecommitdiffstats
path: root/src/H5FD.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5FD.c')
-rw-r--r--src/H5FD.c362
1 files changed, 95 insertions, 267 deletions
diff --git a/src/H5FD.c b/src/H5FD.c
index 96d1230..9f62065 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -5,23 +5,18 @@
* *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
- * Monday, July 26, 1999
- *
- * Purpose: The Virtual File Layer as described in documentation.
- * This is the greatest common denominator for all types of
- * storage access whether a file, memory, network, etc. This
- * layer usually just dispatches the request to an actual
- * file driver layer.
+ * Purpose: The Virtual File Layer as described in documentation.
+ * This is the greatest common denominator for all types of
+ * storage access whether a file, memory, network, etc. This
+ * layer usually just dispatches the request to an actual
+ * file driver layer.
*/
/****************/
@@ -64,7 +59,6 @@
/********************/
static herr_t H5FD_free_cls(H5FD_class_t *cls);
static int H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/);
-static int H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*out*/);
/*********************/
/* Package Variables */
@@ -115,9 +109,6 @@ static const H5I_class_t H5I_VFL_CLS[1] = {{
* Return: Success: Non-negative
* Failure: Negative
*
- * Programmer: Robb Matzke
- * Monday, July 26, 1999
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -150,9 +141,6 @@ done:
* otherwise.
* Failure: Never fails.
*
- * Programmer: Robb Matzke
- * Friday, February 19, 1999
- *
*-------------------------------------------------------------------------
*/
int
@@ -192,11 +180,6 @@ H5FD_term_package(void)
*
* Failure: Negative
*
- * Programmer: Robb Matzke
- * Monday, July 26, 1999
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -224,26 +207,18 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FDregister
+ * Function: H5FDregister
*
- * Purpose: Registers a new file driver as a member of the virtual file
- * driver class. Certain fields of the class struct are
- * required and that is checked here so it doesn't have to be
- * checked every time the field is accessed.
+ * Purpose: Registers a new file driver as a member of the virtual file
+ * driver class. Certain fields of the class struct are
+ * required and that is checked here so it doesn't have to be
+ * checked every time the field is accessed.
*
- * Return: Success: A file driver ID which is good until the
- * library is closed or the driver is
- * unregistered.
+ * Return: Success: A file driver ID which is good until the
+ * library is closed or the driver is
+ * unregistered.
*
- * Failure: A negative value.
- *
- * Programmer: Robb Matzke
- * Monday, July 26, 1999
- *
- * Modifications:
- * Copied guts of function into H5FD_register
- * Quincey Koziol
- * Friday, January 30, 2004
+ * Failure: A negative value.
*
*-------------------------------------------------------------------------
*/
@@ -258,18 +233,18 @@ H5FDregister(const H5FD_class_t *cls)
/* Check arguments */
if(!cls)
- HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "null class pointer is disallowed")
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "null class pointer is disallowed")
if(!cls->open || !cls->close)
- HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`open' and/or `close' methods are not defined")
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`open' and/or `close' methods are not defined")
if(!cls->get_eoa || !cls->set_eoa)
- HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`get_eoa' and/or `set_eoa' methods are not defined")
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`get_eoa' and/or `set_eoa' methods are not defined")
if(!cls->get_eof)
- HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`get_eof' method is not defined")
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`get_eof' method is not defined")
if(!cls->read || !cls->write)
- HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`read' and/or `write' method is not defined")
- for (type=H5FD_MEM_DEFAULT; type<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,type))
- if(cls->fl_map[type]<H5FD_MEM_NOLIST || cls->fl_map[type]>=H5FD_MEM_NTYPES)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid free-list mapping")
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`read' and/or `write' method is not defined")
+ for (type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,type))
+ if(cls->fl_map[type] < H5FD_MEM_NOLIST || cls->fl_map[type] >= H5FD_MEM_NTYPES)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid free-list mapping")
/* Create the new class ID */
if((ret_value=H5FD_register(cls, sizeof(H5FD_class_t), TRUE)) < 0)
@@ -281,29 +256,18 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_register
- *
- * Purpose: Registers a new file driver as a member of the virtual file
- * driver class. Certain fields of the class struct are
- * required and that is checked here so it doesn't have to be
- * checked every time the field is accessed.
+ * Function: H5FD_register
*
- * Return: Success: A file driver ID which is good until the
- * library is closed or the driver is
- * unregistered.
+ * Purpose: Registers a new file driver as a member of the virtual file
+ * driver class. Certain fields of the class struct are
+ * required and that is checked here so it doesn't have to be
+ * checked every time the field is accessed.
*
- * Failure: A negative value.
- *
- * Programmer: Robb Matzke
- * Monday, July 26, 1999
+ * Return: Success: A file driver ID which is good until the
+ * library is closed or the driver is
+ * unregistered.
*
- * Modifications:
- * Broke into public and internal routines & added 'size'
- * parameter to internal routine, which allows us to create
- * sub-classes of H5FD_class_t for internal support (see the
- * MPI drivers, etc.)
- * Quincey Koziol
- * January 30, 2004
+ * Failure: A negative value.
*
*-------------------------------------------------------------------------
*/
@@ -328,7 +292,7 @@ H5FD_register(const void *_cls, size_t size, hbool_t app_ref)
/* Copy the class structure so the caller can reuse or free it */
if(NULL == (saved = (H5FD_class_t *)H5MM_malloc(size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for file driver class struct")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for file driver class struct")
HDmemcpy(saved, cls, size);
/* Create the new class ID */
@@ -345,19 +309,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FDunregister
+ * Function: H5FDunregister
*
- * Purpose: Removes a driver ID from the library. This in no way affects
- * file access property lists which have been defined to use
- * this driver or files which are already opened under this
- * driver.
+ * Purpose: Removes a driver ID from the library. This in no way affects
+ * file access property lists which have been defined to use
+ * this driver or files which are already opened under this
+ * driver.
*
- * Return: Success: Non-negative
- *
- * Failure: Negative
+ * Return: Success: Non-negative
*
- * Programmer: Robb Matzke
- * Monday, July 26, 1999
+ * Failure: Negative
*
*-------------------------------------------------------------------------
*/
@@ -397,9 +358,6 @@ done:
*
* Failure: NULL
*
- * Programmer: Robb Matzke
- * Friday, August 20, 1999
- *
*-------------------------------------------------------------------------
*/
H5FD_class_t *
@@ -445,11 +403,6 @@ done:
* Failure: 0 if an error occurs or if the driver has no
* data to store in the superblock.
*
- * Programmer: Robb Matzke
- * Monday, August 16, 1999
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hsize_t
@@ -483,11 +436,6 @@ done:
*
* Failure: Negative
*
- * Programmer: Robb Matzke
- * Monday, August 16, 1999
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -514,9 +462,6 @@ done:
* Return: Success: Non-negative
* Failure: Negative
*
- * Programmer: Robb Matzke
- * Monday, August 16, 1999
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -545,9 +490,6 @@ done:
* Return: Success: Non-negative
* Failure: Negative
*
- * Programmer: Quincey Koziol
- * Friday, July 19, 2013
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -595,9 +537,6 @@ done:
* Failure: NULL, including when the file has no
* properties.
*
- * Programmer: Robb Matzke
- * Friday, August 13, 1999
- *
*-------------------------------------------------------------------------
*/
void *
@@ -625,9 +564,6 @@ done:
* Return: Success: non-negative
* Failure: negative
*
- * Programmer: Robb Matzke
- * Tuesday, August 3, 1999
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -709,11 +645,6 @@ done:
*
* Failure: NULL
*
- * Programmer: Robb Matzke
- * Tuesday, July 27, 1999
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5FD_t *
@@ -748,16 +679,6 @@ done:
*
* Failure: NULL
*
- * Programmer: Robb Matzke
- * Wednesday, August 4, 1999
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list to the new generic property
- * list.
- *
*-------------------------------------------------------------------------
*/
H5FD_t *
@@ -792,7 +713,8 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method")
/* Query driver flag */
- H5FD_driver_query(driver, &driver_flags);
+ if(H5FD_driver_query(driver, &driver_flags) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't query VFD flags")
/* Get initial file image info */
if(H5P_peek(plist, H5F_ACS_FILE_IMAGE_INFO_NAME, &file_image_info) < 0)
@@ -863,9 +785,6 @@ done:
* Return: Success: Non-negative
* Failure: Negative
*
- * Programmer: Robb Matzke
- * Tuesday, July 27, 1999
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -895,9 +814,6 @@ done:
* Return: Success: Non-negative
* Failure: Negative
*
- * Programmer: Robb Matzke
- * Wednesday, August 4, 1999
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -946,11 +862,6 @@ done:
* comparison callback then the file pointers
* themselves are compared.
*
- * Programmer: Robb Matzke
- * Tuesday, July 27, 1999
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -977,11 +888,6 @@ done:
*
* Failure: Must never fail.
*
- * Programmer: Robb Matzke
- * Wednesday, August 4, 1999
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -1027,11 +933,6 @@ done:
*
* Failure: negative
*
- * Programmer: Quincey Koziol
- * Friday, August 25, 2000
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -1061,9 +962,6 @@ done:
*
* Failure: negative
*
- * Programmer: Quincey Koziol
- * Friday, August 25, 2000
- *
*-------------------------------------------------------------------------
*/
static int
@@ -1087,42 +985,6 @@ H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/)
/*-------------------------------------------------------------------------
-* 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: Success: non-negative
-* Failure: negative
-*
-* Programmer: Jacob Gruber
-* Wednesday, August 17, 2011
-*
-*-------------------------------------------------------------------------
-*/
-static int
-H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*out*/)
-{
- int ret_value = 0; /* 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() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5FDalloc
*
* Purpose: Allocates SIZE bytes of memory from the FILE. The memory will
@@ -1156,9 +1018,6 @@ H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*out*/)
*
* Failure: The undefined address HADDR_UNDEF
*
- * Programmer: Robb Matzke
- * Tuesday, July 27, 1999
- *
*-------------------------------------------------------------------------
*/
haddr_t
@@ -1208,11 +1067,6 @@ done:
*
* Failure: Negative
*
- * Programmer: Robb Matzke
- * Wednesday, July 28, 1999
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1245,16 +1099,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FDget_eoa
- *
- * Purpose: Returns the address of the first byte after the last
- * allocated memory in the file.
+ * Function: H5FDget_eoa
*
- * Return: Success: First byte after allocated memory.
- * Failure: HADDR_UNDEF
+ * Purpose: Returns the address of the first byte after the last
+ * allocated memory in the file.
*
- * Programmer: Robb Matzke
- * Friday, July 30, 1999
+ * Return: Success: First byte after allocated memory.
+ * Failure: HADDR_UNDEF
*
*-------------------------------------------------------------------------
*/
@@ -1268,13 +1119,13 @@ H5FDget_eoa(H5FD_t *file, H5FD_mem_t type)
/* Check args */
if(!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer")
if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file type")
/* The real work */
if(HADDR_UNDEF == (ret_value = H5FD_get_eoa(file, type)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eoa request failed")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eoa request failed")
/* (Note compensating for base address subtraction in internal routine) */
ret_value += file->base_addr;
@@ -1303,9 +1154,6 @@ done:
* Return: Success: Non-negative
* Failure: Negative, no side effect
*
- * Programmer: Robb Matzke
- * Friday, July 30, 1999
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1318,16 +1166,16 @@ H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t addr)
/* Check args */
if(!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file type")
if(!H5F_addr_defined(addr) || addr > file->maxaddr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid end-of-address value")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid end-of-address value")
/* The real work */
/* (Note compensating for base address addition in internal routine) */
if(H5FD_set_eoa(file, type, addr - file->base_addr) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file set eoa request failed")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file set eoa request failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -1353,11 +1201,6 @@ done:
*
* Failure: HADDR_UNDEF
*
- * Programmer: Robb Matzke
- * Thursday, July 29, 1999
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
haddr_t
@@ -1370,11 +1213,11 @@ H5FDget_eof(H5FD_t *file, H5FD_mem_t type)
/* Check arguments */
if(!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer")
/* The real work */
if(HADDR_UNDEF == (ret_value = H5FD_get_eof(file, type)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eof request failed")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eof request failed")
/* (Note compensating for base address subtraction in internal routine) */
ret_value += file->base_addr;
@@ -1392,9 +1235,6 @@ done:
* Return: Success: The maximum address allowed in the file.
* Failure: HADDR_UNDEF
*
- * Programmer: Quincey Koziol
- * Thursday, January 3, 2008
- *
*-------------------------------------------------------------------------
*/
haddr_t
@@ -1422,9 +1262,6 @@ done:
* Return: Success: Non-negative
* Failure: Negative
*
- * Programmer: Quincey Koziol
- * Tuesday, January 8, 2008
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1450,8 +1287,6 @@ H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags)
* Return: Success: Non-negative
* Failure: Negative
*
- * Programmer: Vailin Choi; Oct 2013
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1476,9 +1311,6 @@ H5FD_set_feature_flags(H5FD_t *file, unsigned long feature_flags)
* Return: Success: Non-negative
* Failure: Negative
*
- * Programmer: Quincey Koziol
- * Thursday, January 17, 2008
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1521,9 +1353,6 @@ done:
*
* Failure: Negative. The contents of BUF is undefined.
*
- * Programmer: Robb Matzke
- * Thursday, July 29, 1999
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1586,9 +1415,6 @@ done:
*
* Failure: Negative
*
- * Programmer: Robb Matzke
- * Thursday, July 29, 1999
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1651,10 +1477,6 @@ done:
* Programmer: Robb Matzke
* Thursday, July 29, 1999
*
- * Modifications:
- * Quincey Koziol, May 20, 2002
- * Added 'closing' parameter
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1691,9 +1513,6 @@ done:
* Return: Success: Non-negative
* Failure: Negative
*
- * Programmer: Robb Matzke
- * Wednesday, August 4, 1999
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1721,9 +1540,6 @@ done:
* Return: Success: Non-negative
* Failure: Negative
*
- * Programmer: Quincey Koziol
- * Thursday, January 31, 2008
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1760,9 +1576,6 @@ done:
* Return: Success: Non-negative
* Failure: Negative
*
- * Programmer: Quincey Koziol
- * Thursday, January 31, 2008
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1790,8 +1603,6 @@ done:
* Return: Success: Non-negative
* Failure: Negative
*
- * Programmer: Vailin Choi; March 2015
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1824,8 +1635,6 @@ done:
* Return: Success: Non-negative
* Failure: Negative
*
- * Programmer: Vailin Choi; May 2013
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1853,8 +1662,6 @@ done:
* Return: Success: Non-negative
* Failure: Negative
*
- * Programmer: Vailin Choi; March 2015
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1886,8 +1693,6 @@ done:
* Return: Success: Non-negative
* Failure: Negative
*
- * Programmer: Vailin Choi; May 2013
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1916,9 +1721,6 @@ done:
*
* Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
- * March 27, 2002
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1947,8 +1749,6 @@ H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum)
* Programmer: Raymond Lu
* Sep. 16, 2002
*
- * Modifications:
- *
*--------------------------------------------------------------------------
*/
herr_t
@@ -2010,9 +1810,6 @@ done:
*
* Return: Non-negative if succeed; negative if fails.
*
- * Programmer: Quincey Koziol
- * Jan. 17, 2008
- *
*--------------------------------------------------------------------------
*/
herr_t
@@ -2038,9 +1835,6 @@ H5FD_set_base_addr(H5FD_t *file, haddr_t base_addr)
* Return: Success: The absolute base address of the file
* Failure: The undefined address (HADDR_UNDEF)
*
- * Programmer: Quincey Koziol
- * Sept. 10, 2009
- *
*--------------------------------------------------------------------------
*/
haddr_t
@@ -2062,8 +1856,6 @@ H5FD_get_base_addr(const H5FD_t *file)
*
* Return: Non-negative if succeed; negative if fails.
*
- * Programmer: Vailin Choi; April 2013
- *
*--------------------------------------------------------------------------
*/
herr_t
@@ -2078,3 +1870,39 @@ H5FD_set_paged_aggr(H5FD_t *file, hbool_t paged)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FD_set_paged_aggr() */
+
+
+/*-------------------------------------------------------------------------
+* Function: H5FDdriver_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 ID is passed
+* in as a parameter.
+*
+* Return: SUCCEED/FAIL
+*
+*-------------------------------------------------------------------------
+*/
+herr_t
+H5FDdriver_query(hid_t driver_id, unsigned long *flags/*out*/)
+{
+ H5FD_class_t *driver = NULL; /* Pointer to VFD class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "ix", driver_id, flags);
+
+ if(NULL == flags)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "flags parameter cannot be NULL")
+
+ /* Check for the driver to query and then query it */
+ if (NULL == (driver = (H5FD_class_t *)H5I_object_verify(driver_id, H5I_VFL)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a VFL ID")
+ if (H5FD_driver_query(driver, flags) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "driver flag query failed")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5FDdriver_query() */
+