summaryrefslogtreecommitdiffstats
path: root/src/H5VLcallback.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5VLcallback.c')
-rw-r--r--src/H5VLcallback.c106
1 files changed, 87 insertions, 19 deletions
diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c
index 02e2399..77df207 100644
--- a/src/H5VLcallback.c
+++ b/src/H5VLcallback.c
@@ -82,10 +82,10 @@ static void *H5VL__dataset_open(void *obj, const H5VL_loc_params_t *loc_params,
const H5VL_class_t *cls, const char *name, hid_t dapl_id, hid_t dxpl_id,
void **req);
static herr_t H5VL__dataset_read(void *dset, const H5VL_class_t *cls,
- hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id,
+ hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id,
void *buf, void **req);
static herr_t H5VL__dataset_write(void *obj, const H5VL_class_t *cls,
- hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id,
+ hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id,
const void *buf, void **req);
static herr_t H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type,
hid_t dxpl_id, void **req, va_list arguments);
@@ -101,6 +101,8 @@ static void * H5VL__file_open(const H5VL_class_t *cls, const char *name,
unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
static herr_t H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type,
hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__file_specific_wrap_va_list(void *obj, const H5VL_class_t *cls,
+ H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...);
static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type,
hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
@@ -2013,7 +2015,7 @@ done:
*/
static herr_t
H5VL__dataset_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id,
- hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf,
+ hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, void *buf,
void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2025,7 +2027,7 @@ H5VL__dataset_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id,
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset read' method")
/* Call the corresponding VOL callback */
- if((cls->dataset_cls.read)(obj, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ if((cls->dataset_cls.read)(obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read failed")
done:
@@ -2045,7 +2047,7 @@ done:
*/
herr_t
H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id,
- hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf,
+ hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, void *buf,
void **req)
{
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
@@ -2059,7 +2061,7 @@ H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id,
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- if(H5VL__dataset_read(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ if(H5VL__dataset_read(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read failed")
done:
@@ -2083,14 +2085,14 @@ done:
*/
herr_t
H5VLdataset_read(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id,
- hid_t file_space_id, hid_t plist_id, void *buf, void **req)
+ hid_t file_space_id, hid_t dxpl_id, void *buf, void **req)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
H5TRACE8("e", "*xiiiii*x**x", obj, connector_id, mem_type_id, mem_space_id,
- file_space_id, plist_id, buf, req);
+ file_space_id, dxpl_id, buf, req);
/* Check args and get class pointer */
if(NULL == obj)
@@ -2099,7 +2101,7 @@ H5VLdataset_read(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_spa
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if(H5VL__dataset_read(obj, cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ if(H5VL__dataset_read(obj, cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset")
done:
@@ -2119,7 +2121,7 @@ done:
*/
static herr_t
H5VL__dataset_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id,
- hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf,
+ hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf,
void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2131,7 +2133,7 @@ H5VL__dataset_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id,
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset write' method")
/* Call the corresponding VOL callback */
- if((cls->dataset_cls.write)(obj, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ if((cls->dataset_cls.write)(obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write failed")
done:
@@ -2151,7 +2153,7 @@ done:
*/
herr_t
H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id,
- hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf,
+ hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf,
void **req)
{
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
@@ -2165,7 +2167,7 @@ H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id,
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- if(H5VL__dataset_write(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ if(H5VL__dataset_write(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write failed")
done:
@@ -2189,14 +2191,14 @@ done:
*/
herr_t
H5VLdataset_write(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id,
- hid_t file_space_id, hid_t plist_id, const void *buf, void **req)
+ hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
H5TRACE8("e", "*xiiiii*x**x", obj, connector_id, mem_type_id, mem_space_id,
- file_space_id, plist_id, buf, req);
+ file_space_id, dxpl_id, buf, req);
/* Check args and get class pointer */
if(NULL == obj)
@@ -2205,7 +2207,7 @@ H5VLdataset_write(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_sp
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if(H5VL__dataset_write(obj, cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ if(H5VL__dataset_write(obj, cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset")
done:
@@ -2989,6 +2991,43 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5VL__file_specific_wrap_va_list
+ *
+ * Purpose: Perform File specific operations through the VOL. Just
+ * starts a va_list and passes it to the connector's
+ * callback. Needed when the VOL layer needs to replace one
+ * of the variable arguments.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__file_specific_wrap_va_list(void *obj, const H5VL_class_t *cls,
+ H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...)
+{
+ va_list arguments; /* Argument list passed from the API call */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Start access to the varargs, so they are available in all situations below */
+ HDva_start(arguments, req);
+
+ /* Call the corresponding VOL callback */
+ if((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed")
+
+done:
+ /* End access to the va_list */
+ HDva_end(arguments);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__file_specific_wrap_va_list() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL__file_specific
*
* Purpose: Perform File specific operations through the VOL
@@ -3010,9 +3049,38 @@ H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t spe
if(NULL == cls->file_cls.specific)
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file specific' method")
- /* Call the corresponding VOL callback */
- if((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed")
+ /* Special handling for file is equal */
+ if(specific_type == H5VL_FILE_IS_EQUAL) {
+ va_list tmp_args; /* Argument list passed from the API call */
+ H5VL_object_t *vol_obj2; /* Second VOL object */
+ hbool_t *is_equal; /* Output variable */
+ int cmp_value; /* Comparison result */
+
+ /* Get parameters */
+ HDva_copy(tmp_args, arguments);
+ vol_obj2 = HDva_arg(tmp_args, H5VL_object_t *);
+ is_equal = HDva_arg(tmp_args, hbool_t *);
+ HDva_end(tmp_args);
+
+ HDassert(vol_obj2);
+
+ /* Compare connector classes */
+ if(H5VL_cmp_connector_cls(&cmp_value, cls, vol_obj2->connector->cls) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes")
+
+ /* If the classes are different the files are different */
+ if(cmp_value)
+ *is_equal = FALSE;
+ else
+ /* Make callback (need to extract data from vol_obj2 and redo the
+ * va_list) */
+ if(H5VL__file_specific_wrap_va_list(obj, cls, specific_type, dxpl_id, req, vol_obj2->data, is_equal) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed")
+ } /* end if */
+ else
+ /* Call the corresponding VOL callback */
+ if((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed")
done:
FUNC_LEAVE_NOAPI(ret_value)