summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2019-01-06 05:06:45 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2019-01-06 05:06:45 (GMT)
commit92300f954fec70b3018182defab6933bf6f4bc88 (patch)
treee06729c237cfe05c5ef6dcaaf4091d395b076012 /src
parent0e34f0feaaeb6d2286f87f695f25fae45c070a42 (diff)
downloadhdf5-92300f954fec70b3018182defab6933bf6f4bc88.zip
hdf5-92300f954fec70b3018182defab6933bf6f4bc88.tar.gz
hdf5-92300f954fec70b3018182defab6933bf6f4bc88.tar.bz2
Corrected comment in src/H5VLint.c, fixed pass-through info size in
src/H5VLpassthru.c, switched to stashing VOL connector ID & info in API context (in src/H5CX.c, src/H5CXprivate.h, src/H5F.c, src/H5Fint.c, and src/H5Fefc.c), patched up all sorts of issues in the tests, to make them work with 'check-vfd' (and 'check-vol' again).
Diffstat (limited to 'src')
-rw-r--r--src/H5CX.c78
-rw-r--r--src/H5CXprivate.h2
-rw-r--r--src/H5F.c18
-rw-r--r--src/H5Fefc.c16
-rw-r--r--src/H5Fint.c44
-rw-r--r--src/H5VLint.c8
-rw-r--r--src/H5VLpassthru.c3
7 files changed, 138 insertions, 31 deletions
diff --git a/src/H5CX.c b/src/H5CX.c
index 1d9cf3d..1f91ee2 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -268,9 +268,11 @@ typedef struct H5CX_t {
size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */
hbool_t nlinks_valid; /* Whether number of soft / UD links to traverse is valid */
- /* Cached VOL properties */
- void *vol_wrap_ctx; /* VOL plugin's "wrap context" for creating IDs */
- hbool_t vol_wrap_ctx_valid; /* Whether VOL plugin's "wrap context" for creating IDs is valid */
+ /* Cached VOL settings */
+ H5VL_connector_prop_t vol_connector_prop; /* Property for VOL connector ID & info */
+ hbool_t vol_connector_prop_valid; /* Whether property for VOL connector ID & info is valid */
+ void *vol_wrap_ctx; /* VOL connector's "wrap context" for creating IDs */
+ hbool_t vol_wrap_ctx_valid; /* Whether VOL connector's "wrap context" for creating IDs is valid */
} H5CX_t;
/* Typedef for nodes on the API context stack */
@@ -956,6 +958,40 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5CX_set_vol_connector_prop
+ *
+ * Purpose: Sets the VOL connector ID & info for an operation.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * January 3, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_set_vol_connector_prop(const H5VL_connector_prop_t *vol_connector_prop)
+{
+ H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(head && *head);
+
+ /* Set the API context value */
+ HDmemcpy(&(*head)->ctx.vol_connector_prop, vol_connector_prop, sizeof(H5VL_connector_prop_t));
+
+ /* Mark the value as valid */
+ (*head)->ctx.vol_connector_prop_valid = TRUE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_set_vol_connector_prop() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX_get_dxpl
*
* Purpose: Retrieves the DXPL ID for the current API call context.
@@ -1044,6 +1080,42 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5CX_get_vol_connector_prop
+ *
+ * Purpose: Retrieves the VOL connector ID & info for an operation.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * January 3, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_get_vol_connector_prop(H5VL_connector_prop_t *vol_connector_prop)
+{
+ H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_connector_prop);
+ HDassert(head && *head);
+
+ /* Check for value that was set */
+ if((*head)->ctx.vol_connector_prop_valid)
+ /* Get the value */
+ HDmemcpy(vol_connector_prop, &(*head)->ctx.vol_connector_prop, sizeof(H5VL_connector_prop_t));
+ else
+ HDmemset(vol_connector_prop, 0, sizeof(H5VL_connector_prop_t));
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_get_vol_connector_prop() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX_get_tag
*
* Purpose: Retrieves the object tag for the current API call context.
diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h
index 57ca5cd..46289c4 100644
--- a/src/H5CXprivate.h
+++ b/src/H5CXprivate.h
@@ -64,11 +64,13 @@ H5_DLL herr_t H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass,
hid_t loc_id, hbool_t is_collective);
H5_DLL herr_t H5CX_set_loc(hid_t loc_id);
H5_DLL herr_t H5CX_set_vol_wrap_ctx(void *wrap_ctx);
+H5_DLL herr_t H5CX_set_vol_connector_prop(const H5VL_connector_prop_t *vol_connector_prop);
/* "Getter" routines for API context info */
H5_DLL hid_t H5CX_get_dxpl(void);
H5_DLL hid_t H5CX_get_lapl(void);
H5_DLL herr_t H5CX_get_vol_wrap_ctx(void **wrap_ctx);
+H5_DLL herr_t H5CX_get_vol_connector_prop(H5VL_connector_prop_t *vol_connector_prop);
H5_DLL haddr_t H5CX_get_tag(void);
H5_DLL H5AC_ring_t H5CX_get_ring(void);
#ifdef H5_HAVE_PARALLEL
diff --git a/src/H5F.c b/src/H5F.c
index 0ff3f1f..9df8140 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -653,11 +653,17 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- /* get the VOL info from the fapl */
+ /* Get the VOL info from the fapl */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list")
if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info")
+
+ /* Stash a copy of the "top-level" connector property, before any pass-through
+ * connectors modify or unwrap it.
+ */
+ if(H5CX_set_vol_connector_prop(&connector_prop) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context")
/* Adjust bit flags by turning on the creation bit and making sure that
* the EXCL or TRUNC bit is set. All newly-created files are opened for
@@ -733,7 +739,13 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list")
if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info")
+
+ /* Stash a copy of the "top-level" connector property, before any pass-through
+ * connectors modify or unwrap it.
+ */
+ if(H5CX_set_vol_connector_prop(&connector_prop) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context")
/* Open the file through the VOL layer */
if(NULL == (new_file = (H5F_t *)H5VL_file_open(&connector_prop, filename, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
diff --git a/src/H5Fefc.c b/src/H5Fefc.c
index a394071..f3881d4 100644
--- a/src/H5Fefc.c
+++ b/src/H5Fefc.c
@@ -29,8 +29,10 @@
/* Packages needed by this file... */
#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
+#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
@@ -144,6 +146,8 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi
H5F_efc_t *efc = NULL; /* External file cache for parent file */
H5F_efc_ent_t *ent = NULL; /* Entry for target file in efc */
hbool_t open_file = FALSE; /* Whether ent->file needs to be closed in case of error */
+ H5P_genplist_t *plist; /* Property list pointer for FAPL */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
H5F_t *ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -153,6 +157,18 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi
HDassert(parent->shared);
HDassert(name);
+ /* Get the VOL info from the fapl */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
+ HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, NULL, "not a file access property list")
+ if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get VOL connector info")
+
+ /* Stash a copy of the "top-level" connector property, before any pass-through
+ * connectors modify or unwrap it.
+ */
+ if(H5CX_set_vol_connector_prop(&connector_prop) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't set VOL connector info in API context")
+
/* Get external file cache */
efc = parent->shared->efc;
diff --git a/src/H5Fint.c b/src/H5Fint.c
index cca46d0..8a7019d 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -76,7 +76,7 @@ typedef struct H5F_olist_t {
/* Local Prototypes */
/********************/
-static herr_t H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info);
+static herr_t H5F__set_vol_conn(H5F_t *file);
static herr_t H5F__get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr);
static int H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key);
static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/);
@@ -119,8 +119,9 @@ H5FL_DEFINE(H5F_file_t);
*-------------------------------------------------------------------------
*/
static herr_t
-H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info)
+H5F__set_vol_conn(H5F_t *file)
{
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
void *new_connector_info = NULL; /* Copy of connector info */
herr_t ret_value = SUCCEED; /* Return value */
@@ -129,21 +130,30 @@ H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info)
/* Sanity check */
HDassert(file);
+ /* Retrieve a copy of the "top-level" connector property, before any pass-through
+ * connectors modified or unwrapped it.
+ */
+ if(H5CX_get_vol_connector_prop(&connector_prop) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get VOL connector info from API context")
+
+ /* Sanity check */
+ HDassert(0 != connector_prop.connector_id);
+
/* Copy connector info, if it exists */
- if(vol_info) {
+ if(connector_prop.connector_info) {
H5VL_class_t *connector; /* Pointer to connector */
/* Retrieve the connector for the ID */
- if(NULL == (connector = (H5VL_class_t *)H5I_object(vol_id)))
+ if(NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop.connector_id)))
HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Allocate and copy connector info */
- if(H5VL_copy_connector_info(connector, &new_connector_info, vol_info) < 0)
+ if(H5VL_copy_connector_info(connector, &new_connector_info, connector_prop.connector_info) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "connector info copy failed")
} /* end if */
/* Cache the connector ID & info for the container */
- file->shared->vol_id = vol_id;
+ file->shared->vol_id = connector_prop.connector_id;
file->shared->vol_info = new_connector_info;
if(H5I_inc_ref(file->shared->vol_id, FALSE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "incrementing VOL connector ID failed")
@@ -792,14 +802,12 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type,
/* get last component of file_name */
H5_GET_LAST_DELIMITER(actual_file_name, ptr)
- if(!ptr)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file, file name = '%s', temp_file_name = '%s'", file_name, temp_file_name)
-
- /* Truncate filename portion from actual file name path */
- *ptr = '\0';
+ if(ptr)
+ /* Truncate filename portion from actual file name path */
+ *ptr = '\0';
/* Build new file name for the external file */
- if(H5F__build_name(actual_file_name, temp_file_name, &full_name/*out*/) < 0)
+ if(H5F__build_name((ptr ? actual_file_name : ""), temp_file_name, &full_name/*out*/) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename")
actual_file_name = (char *)H5MM_xfree(actual_file_name);
@@ -815,7 +823,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type,
H5E_clear_stack(NULL);
} /* end if */
- /* Success */
+ /* Set return value (possibly NULL or valid H5F_t *) */
ret_value = src_file;
done:
@@ -1090,14 +1098,8 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get object flush cb info")
/* Get the VOL connector info */
- {
- H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
-
- if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get VOL connector info")
- if(H5F__set_vol_conn(f, connector_prop.connector_id, connector_prop.connector_info) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't cache VOL connector info")
- } /* end block */
+ if(H5F__set_vol_conn(f) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't cache VOL connector info")
/* Create a metadata cache with the specified number of elements.
* The cache might be created with a different number of elements and
diff --git a/src/H5VLint.c b/src/H5VLint.c
index 8695a80..bdb2908 100644
--- a/src/H5VLint.c
+++ b/src/H5VLint.c
@@ -879,9 +879,11 @@ done:
*
* Purpose: Compare VOL class for a connector
*
- * Return: Positive if VALUE1 is greater than VALUE2, negative if
- * VALUE2 is greater than VALUE1 and zero if VALUE1 and
- * VALUE2 are equal (like strcmp).
+ * Note: Sets *cmp_value positive if VALUE1 is greater than VALUE2,
+ * negative if VALUE2 is greater than VALUE1, and zero if VALUE1
+ * and VALUE2 are equal (like strcmp).
+ *
+ * Return: SUCCEED / FAIL
*
*-------------------------------------------------------------------------
*/
diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c
index 8b83e2e..13d8d8e 100644
--- a/src/H5VLpassthru.c
+++ b/src/H5VLpassthru.c
@@ -26,6 +26,7 @@
/* Header files needed */
/* (Public HDF5 and standard C / POSIX only) */
#include <assert.h>
+#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -171,7 +172,7 @@ static const H5VL_class_t H5VL_pass_through_g = {
0, /* capability flags */
H5VL_pass_through_init, /* initialize */
H5VL_pass_through_term, /* terminate */
- sizeof(H5VL_pass_through_t), /* info size */
+ sizeof(H5VL_pass_through_info_t), /* info size */
H5VL_pass_through_info_copy, /* info copy */
H5VL_pass_through_info_cmp, /* info compare */
H5VL_pass_through_info_free, /* info free */