Refactor, standardize, and revise the async request callbacks.

This commit is contained in:
Quincey Koziol
2018-11-04 00:05:08 -05:00
parent 4806d29d9f
commit df7cf2a9d3
7 changed files with 517 additions and 149 deletions

View File

@@ -116,10 +116,12 @@ static const H5VL_class_t H5VL_log_g = {
H5VL_log_object_specific, /* specific */
NULL, //H5VL_log_object_optional, /* optional */
},
{
NULL,
NULL,
NULL
{ /* request_cls */
NULL, /* wait */
NULL, /* cancel */
NULL, /* specific */
NULL, /* optional */
NULL /* free */
},
NULL
};

View File

@@ -29,7 +29,7 @@ typedef enum H5ES_status_t {
H5ES_STATUS_IN_PROGRESS, /* Operation has not yet completed */
H5ES_STATUS_SUCCEED, /* Operation has completed, successfully */
H5ES_STATUS_FAIL, /* Operation has completed, but failed */
H5ES_STATUS_CANCEL /* Operation has not completed and has been cancelled */
H5ES_STATUS_CANCELLED /* Operation has not completed and was cancelled */
} H5ES_status_t;

View File

@@ -163,6 +163,14 @@ static herr_t H5VL__datatype_optional(void *obj, const H5VL_class_t *cls,
hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
void **req);
static herr_t H5VL__request_wait(void *req, const H5VL_class_t *cls,
uint64_t timeout, H5ES_status_t *status);
static herr_t H5VL__request_cancel(void *req, const H5VL_class_t *cls);
static herr_t H5VL__request_specific(void *req, const H5VL_class_t *cls,
H5VL_request_specific_t specific_type, va_list arguments);
static herr_t H5VL__request_optional(void *req, const H5VL_class_t *cls,
va_list arguments);
static herr_t H5VL__request_free(void *req, const H5VL_class_t *cls);
/*********************/
@@ -5594,88 +5602,22 @@ done:
/*-------------------------------------------------------------------------
* Function: H5VL_request_cancel
* Function: H5VL__request_wait
*
* Purpose: Cancels an asynchronous request through the VOL
* Purpose: Waits on an asychronous request through the VOL
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
herr_t
H5VL_request_cancel(void **req, const H5VL_class_t *cls, H5ES_status_t *status)
static herr_t
H5VL__request_wait(void *req, const H5VL_class_t *cls, uint64_t timeout,
H5ES_status_t *status)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(req);
HDassert(cls);
HDassert(status);
/* Check if the corresponding VOL callback exists */
if(NULL == cls->async_cls.cancel)
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async cancel' method")
/* Call the corresponding VOL callback */
if((cls->async_cls.cancel)(req, status) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_cancel() */
/*-------------------------------------------------------------------------
* Function: H5VLrequest_cancel
*
* Purpose: Cancels a request
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
herr_t
H5VLrequest_cancel(void **req, hid_t plugin_id, H5ES_status_t *status)
{
H5VL_class_t *cls; /* VOL plugin's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
H5TRACE3("e", "**xi*Es", req, plugin_id, status);
/* Get class pointer */
if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID")
/* Call the corresponding internal VOL routine */
if(H5VL_request_cancel(req, cls, status) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to cancel request")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
} /* end H5VLrequest_cancel() */
/*-------------------------------------------------------------------------
* Function: H5VL_request_test
*
* Purpose: Tests an asynchronous request through the VOL
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
herr_t
H5VL_request_test(void **req, const H5VL_class_t *cls, H5ES_status_t *status)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(req);
@@ -5683,48 +5625,16 @@ H5VL_request_test(void **req, const H5VL_class_t *cls, H5ES_status_t *status)
HDassert(status);
/* Check if the corresponding VOL callback exists */
if(NULL == cls->async_cls.test)
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async test' method")
if(NULL == cls->request_cls.wait)
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async wait' method")
/* Call the corresponding VOL callback */
if((cls->async_cls.test)(req, status) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "request test failed")
if((cls->request_cls.wait)(req, timeout, status) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_test() */
/*-------------------------------------------------------------------------
* Function: H5VLrequest_test
*
* Purpose: Tests a request
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
herr_t
H5VLrequest_test(void **req, hid_t plugin_id, H5ES_status_t *status)
{
H5VL_class_t *cls; /* VOL plugin's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
H5TRACE3("e", "**xi*Es", req, plugin_id, status);
/* Get class pointer */
if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID")
/* Call the corresponding internal VOL routine */
if(H5VL_request_test(req, cls, status) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to test request")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
} /* end H5VLrequest_test() */
} /* end H5VL__request_wait() */
/*-------------------------------------------------------------------------
@@ -5738,26 +5648,31 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5VL_request_wait(void **req, const H5VL_class_t *cls, H5ES_status_t *status)
H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout,
H5ES_status_t *status)
{
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
HDassert(req);
HDassert(cls);
HDassert(status);
HDassert(vol_obj);
/* Check if the corresponding VOL callback exists */
if(NULL == cls->async_cls.wait)
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async wait' method")
/* Set wrapper info in API context */
if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding VOL callback */
if((cls->async_cls.wait)(req, status) < 0)
/* Call the corresponding internal VOL routine */
if(H5VL__request_wait(vol_obj->data, vol_obj->plugin->cls, timeout, status) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed")
done:
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_wait() */
@@ -5773,23 +5688,459 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5VLrequest_wait(void **req, hid_t plugin_id, H5ES_status_t *status)
H5VLrequest_wait(void *req, hid_t plugin_id, uint64_t timeout, H5ES_status_t *status)
{
H5VL_class_t *cls; /* VOL plugin's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
H5TRACE3("e", "**xi*Es", req, plugin_id, status);
/* Get class pointer */
if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID")
/* Call the corresponding internal VOL routine */
if(H5VL_request_wait(req, cls, status) < 0)
if(H5VL__request_wait(req, cls, timeout, status) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to wait on request")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
} /* end H5VLrequest_wait() */
/*-------------------------------------------------------------------------
* Function: H5VL__request_cancel
*
* Purpose: Cancels an asynchronous request through the VOL
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
static herr_t
H5VL__request_cancel(void *req, const H5VL_class_t *cls)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
HDassert(req);
HDassert(cls);
/* Check if the corresponding VOL callback exists */
if(NULL == cls->request_cls.cancel)
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async cancel' method")
/* Call the corresponding VOL callback */
if((cls->request_cls.cancel)(req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL__request_cancel() */
/*-------------------------------------------------------------------------
* Function: H5VL_request_cancel
*
* Purpose: Cancels an asynchronous request through the VOL
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
herr_t
H5VL_request_cancel(const H5VL_object_t *vol_obj)
{
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_obj);
/* Set wrapper info in API context */
if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
if(H5VL__request_cancel(vol_obj->data, vol_obj->plugin->cls) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed")
done:
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_cancel() */
/*-------------------------------------------------------------------------
* Function: H5VLrequest_cancel
*
* Purpose: Cancels a request
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
herr_t
H5VLrequest_cancel(void *req, hid_t plugin_id)
{
H5VL_class_t *cls; /* VOL plugin's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
H5TRACE2("e", "*xi", req, plugin_id);
/* Get class pointer */
if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID")
/* Call the corresponding internal VOL routine */
if(H5VL__request_cancel(req, cls) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to cancel request")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
} /* end H5VLrequest_cancel() */
/*-------------------------------------------------------------------------
* Function: H5VL__request_specific
*
* Purpose: Specific operation on asynchronous request through the VOL
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
static herr_t
H5VL__request_specific(void *req, const H5VL_class_t *cls,
H5VL_request_specific_t specific_type, va_list arguments)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
HDassert(req);
HDassert(cls);
/* Check if the corresponding VOL callback exists */
if(NULL == cls->request_cls.specific)
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async specific' method")
/* Call the corresponding VOL callback */
if((ret_value = (cls->request_cls.specific)(req, specific_type, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL__request_specific() */
/*-------------------------------------------------------------------------
* Function: H5VL_request_specific
*
* Purpose: Specific operation on asynchronous request through the VOL
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
herr_t
H5VL_request_specific(const H5VL_object_t *vol_obj,
H5VL_request_specific_t specific_type, ...)
{
va_list arguments; /* Argument list passed from the API call */
hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_obj);
/* Set wrapper info in API context */
if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
va_start(arguments, specific_type);
arg_started = TRUE;
if((ret_value = H5VL__request_specific(vol_obj->data, vol_obj->plugin->cls, specific_type, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback")
done:
/* End access to the va_list, if we started it */
if(arg_started)
va_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_specific() */
/*-------------------------------------------------------------------------
* Function: H5VLrequest_specific
*
* Purpose: Performs a plugin-specific operation on an asynchronous request
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
herr_t
H5VLrequest_specific(void *req, hid_t plugin_id, H5VL_request_specific_t specific_type,
va_list arguments)
{
H5VL_class_t *cls; /* VOL plugin's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
/* Get class pointer */
if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID")
/* Call the corresponding internal VOL routine */
if((ret_value = H5VL__request_specific(req, cls, specific_type, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
} /* end H5VLrequest_specific() */
/*-------------------------------------------------------------------------
* Function: H5VL__request_optional
*
* Purpose: Optional operation specific to plugins.
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
static herr_t
H5VL__request_optional(void *req, const H5VL_class_t *cls, va_list arguments)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
HDassert(req);
HDassert(cls);
/* Check if the corresponding VOL callback exists */
if(NULL == cls->request_cls.optional)
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async optional' method")
/* Call the corresponding VOL callback */
if((ret_value = (cls->request_cls.optional)(req, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL__request_optional() */
/*-------------------------------------------------------------------------
* Function: H5VL_request_optional
*
* Purpose: Optional operation specific to plugins.
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
herr_t
H5VL_request_optional(const H5VL_object_t *vol_obj, ...)
{
va_list arguments; /* Argument list passed from the API call */
hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_obj);
/* Set wrapper info in API context */
if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
va_start(arguments, vol_obj);
arg_started = TRUE;
if((ret_value = H5VL__request_optional(vol_obj->data, vol_obj->plugin->cls, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback")
done:
/* End access to the va_list, if we started it */
if(arg_started)
va_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_optional() */
/*-------------------------------------------------------------------------
* Function: H5VLrequest_optional
*
* Purpose: Performs an optional plugin-specific operation on an asynchronous request
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
herr_t
H5VLrequest_optional(void *req, hid_t plugin_id, va_list arguments)
{
H5VL_class_t *cls; /* VOL plugin's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
/* Get class pointer */
if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID")
/* Call the corresponding internal VOL routine */
if((ret_value = H5VL__request_optional(req, cls, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
} /* end H5VLrequest_optional() */
/*-------------------------------------------------------------------------
* Function: H5VL__request_free
*
* Purpose: Frees an asynchronous request through the VOL
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
static herr_t
H5VL__request_free(void *req, const H5VL_class_t *cls)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
HDassert(req);
HDassert(cls);
/* Check if the corresponding VOL callback exists */
if(NULL == cls->request_cls.free)
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async free' method")
/* Call the corresponding VOL callback */
if((cls->request_cls.free)(req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request free failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL__request_free() */
/*-------------------------------------------------------------------------
* Function: H5VL_request_free
*
* Purpose: Frees an asynchronous request through the VOL
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
herr_t
H5VL_request_free(const H5VL_object_t *vol_obj)
{
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_obj);
/* Set wrapper info in API context */
if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding VOL callback */
if(H5VL__request_free(vol_obj->data, vol_obj->plugin->cls) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request free failed")
done:
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_free() */
/*-------------------------------------------------------------------------
* Function: H5VLrequest_free
*
* Purpose: Frees a request
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
herr_t
H5VLrequest_free(void *req, hid_t plugin_id)
{
H5VL_class_t *cls; /* VOL plugin's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
H5TRACE2("e", "*xi", req, plugin_id);
/* Get class pointer */
if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID")
/* Call the corresponding internal VOL routine */
if(H5VL__request_free(req, cls) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to free request")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
} /* end H5VLrequest_free() */

View File

@@ -192,10 +192,12 @@ static H5VL_class_t H5VL_native_cls_g = {
H5VL__native_object_specific, /* specific */
H5VL__native_object_optional /* optional */
},
{ /* async_cls */
{ /* request_cls */
NULL, /* wait */
NULL, /* cancel */
NULL, /* test */
NULL /* wait */
NULL, /* specific */
NULL, /* optional */
NULL /* free */
},
NULL /* optional */
};

View File

@@ -162,9 +162,11 @@ H5_DLL herr_t H5VL_datatype_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id
H5_DLL herr_t H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* Asynchronous functions */
H5_DLL herr_t H5VL_request_cancel(void **req, const H5VL_class_t *cls, H5ES_status_t *status);
H5_DLL herr_t H5VL_request_test(void **req, const H5VL_class_t *cls, H5ES_status_t *status);
H5_DLL herr_t H5VL_request_wait(void **req, const H5VL_class_t *cls, H5ES_status_t *status);
H5_DLL herr_t H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout, H5ES_status_t *status);
H5_DLL herr_t H5VL_request_cancel(const H5VL_object_t *vol_obj);
H5_DLL herr_t H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_specific_t specific_type, ...);
H5_DLL herr_t H5VL_request_optional(const H5VL_object_t *vol_obj, ...);
H5_DLL herr_t H5VL_request_free(const H5VL_object_t *vol_obj);
#endif /* _H5VLprivate_H */

View File

@@ -169,14 +169,21 @@ typedef enum H5VL_object_get_t {
/* types for object SPECIFIC callback */
typedef enum H5VL_object_specific_t {
H5VL_OBJECT_CHANGE_REF_COUNT, /* H5Oincr/decr_refcount */
H5VL_OBJECT_EXISTS, /* H5Oexists_by_name */
H5VL_OBJECT_VISIT, /* H5Ovisit(_by_name) */
H5VL_REF_CREATE, /* H5Rcreate */
H5VL_OBJECT_FLUSH,
H5VL_OBJECT_REFRESH
H5VL_OBJECT_CHANGE_REF_COUNT, /* H5Oincr/decr_refcount */
H5VL_OBJECT_EXISTS, /* H5Oexists_by_name */
H5VL_OBJECT_VISIT, /* H5Ovisit(_by_name) */
H5VL_REF_CREATE, /* H5Rcreate */
H5VL_OBJECT_FLUSH, /* H5{D|G|O|T}flush */
H5VL_OBJECT_REFRESH /* H5{D|G|O|T}refresh */
} H5VL_object_specific_t;
/* types for async request SPECIFIC callback */
typedef enum H5VL_request_specific_t {
H5VL_REQUEST_WAITANY, /* Wait until any request completes */
H5VL_REQUEST_WAITSOME, /* Wait until at least one requesst completes */
H5VL_REQUEST_WAITALL /* Wait until all requests complete */
} H5VL_request_specific_t;
/* types for different ways that objects are located in an HDF5 container */
typedef enum H5VL_loc_type_t {
H5VL_OBJECT_BY_SELF,
@@ -329,11 +336,13 @@ typedef struct H5VL_object_class_t {
} H5VL_object_class_t;
/* Async operation routines */
typedef struct H5VL_async_class_t {
herr_t (*cancel)(void **, H5ES_status_t *);
herr_t (*test) (void **, H5ES_status_t *);
herr_t (*wait) (void **, H5ES_status_t *);
} H5VL_async_class_t;
typedef struct H5VL_request_class_t {
herr_t (*wait)(void *req, uint64_t timeout, H5ES_status_t *status);
herr_t (*cancel)(void *req);
herr_t (*specific)(void *req, H5VL_request_specific_t specific_type, va_list arguments);
herr_t (*optional)(void *req, va_list arguments);
herr_t (*free)(void *req);
} H5VL_request_class_t;
/* enum value to identify the class of a VOL plugin (mostly for comparison purposes) */
@@ -389,7 +398,7 @@ typedef struct H5VL_class_t {
H5VL_object_class_t object_cls; /* object class callbacks */
/* Services */
H5VL_async_class_t async_cls; /* asynchronous class callbacks */
H5VL_request_class_t request_cls; /* asynchronous request class callbacks */
/* Catch-all */
herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); /* Optional callback */
@@ -506,9 +515,11 @@ H5_DLL herr_t H5VLdatatype_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, v
H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t plugin_id, hid_t dxpl_id, void **req);
/* Public wrappers for asynchronous request callbacks */
H5_DLL herr_t H5VLrequest_cancel(void **req, hid_t plugin_id, H5ES_status_t *status);
H5_DLL herr_t H5VLrequest_test(void **req, hid_t plugin_id, H5ES_status_t *status);
H5_DLL herr_t H5VLrequest_wait(void **req, hid_t plugin_id, H5ES_status_t *status);
H5_DLL herr_t H5VLrequest_wait(void *req, hid_t plugin_id, uint64_t timeout, H5ES_status_t *status);
H5_DLL herr_t H5VLrequest_cancel(void *req, hid_t plugin_id);
H5_DLL herr_t H5VLrequest_specific(void *req, hid_t plugin_id, H5VL_request_specific_t specific_type, va_list arguments);
H5_DLL herr_t H5VLrequest_optional(void *req, hid_t plugin_id, va_list arguments);
H5_DLL herr_t H5VLrequest_free(void *req, hid_t plugin_id);
#ifdef __cplusplus
}

View File

@@ -834,8 +834,8 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case H5ES_STATUS_FAIL:
HDfprintf(out, "H5ES_STATUS_FAIL");
break;
case H5ES_STATUS_CANCEL:
HDfprintf(out, "H5ES_STATUS_CANCEL");
case H5ES_STATUS_CANCELLED:
HDfprintf(out, "H5ES_STATUS_CANCELLED");
break;
default: