diff options
author | Quincey Koziol <koziol@koziol.gov> | 2019-08-21 18:14:06 (GMT) |
---|---|---|
committer | Jerome Soumagne <jsoumagne@hdfgroup.org> | 2019-10-08 19:30:23 (GMT) |
commit | eaa65c862b09b399fc4727e664b56b648cfb37d2 (patch) | |
tree | cdf8678ee9adce377505dddac2df564b0e20b269 /src/H5VLcallback.c | |
parent | f32e70895ef278a48c498477b9c29f131819e2f4 (diff) | |
download | hdf5-eaa65c862b09b399fc4727e664b56b648cfb37d2.zip hdf5-eaa65c862b09b399fc4727e664b56b648cfb37d2.tar.gz hdf5-eaa65c862b09b399fc4727e664b56b648cfb37d2.tar.bz2 |
Add 'blob' callbacks to VOL, along with a native implementation to store them
in the global heap, and changed the VL datatype conversion code to use blobs.
Move encode/decode of sequence lengths into VL datatype callbacks, from native
VOL blob routines.
Diffstat (limited to 'src/H5VLcallback.c')
-rw-r--r-- | src/H5VLcallback.c | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 0131f0e..43739a6 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -6564,6 +6564,125 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL_blob_put + * + * Purpose: Put a blob through the VOL + * + * Return: SUCCEED / FAIL + * + * Programmer: Quincey Koziol + * Wednesday, August 21, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_blob_put(const H5VL_class_t *cls, void *blob, size_t size, void *ctx, void *id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(cls); + HDassert(size == 0 || blob); + HDassert(id); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->blob_cls.put) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob put' method") + + /* Call the corresponding VOL callback */ + if((cls->blob_cls.put)(blob, size, ctx, id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "blob put callback failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_blob_put() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_blob_get + * + * Purpose: Get a blob through the VOL + * + * Return: SUCCEED / FAIL + * + * Programmer: Quincey Koziol + * Friday, August 16, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_blob_get(const H5VL_class_t *cls, const void *id, void *ctx, void *buf) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(cls); + HDassert(id); + HDassert(buf); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->blob_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob get' method") + + /* Call the corresponding VOL callback */ + if((cls->blob_cls.get)(id, ctx, buf) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "blob get callback failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_blob_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_blob_specific + * + * Purpose: Specific operation on blobs through the VOL + * + * Return: SUCCEED / FAIL + * + * Programmer: Quincey Koziol + * Saturday, August 17, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_blob_specific(const H5VL_class_t *cls, void *id, + H5VL_blob_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 */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(cls); + HDassert(id); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->blob_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob specific' method") + + /* Call the corresponding VOL callback */ + HDva_start(arguments, specific_type); + arg_started = TRUE; + if((cls->blob_cls.specific)(id, specific_type, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob specific callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + HDva_end(arguments); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_blob_get() */ + + +/*------------------------------------------------------------------------- * Function: H5VL__optional * * Purpose: Optional operation specific to connectors. |