diff options
author | Quincey Koziol <koziol@lbl.gov> | 2020-11-30 21:59:22 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-30 21:59:22 (GMT) |
commit | 123c5a653dbe3867e06eb8c31da952b7ef042f95 (patch) | |
tree | 077e9e2951b85e5c38ed0c9ea11c6baa396879e9 /src | |
parent | cadd6db431e2664e6dd3f2460639a27d21c6c8a9 (diff) | |
download | hdf5-123c5a653dbe3867e06eb8c31da952b7ef042f95.zip hdf5-123c5a653dbe3867e06eb8c31da952b7ef042f95.tar.gz hdf5-123c5a653dbe3867e06eb8c31da952b7ef042f95.tar.bz2 |
Expand 'opt_query' VOL callback to return a bitfield instead of a flag (#136)
* Expand 'opt_query' VOL callback to return a bitfield instead of a flag
* Correct pastos
Diffstat (limited to 'src')
-rw-r--r-- | src/H5D.c | 9 | ||||
-rw-r--r-- | src/H5F.c | 18 | ||||
-rw-r--r-- | src/H5Rint.c | 6 | ||||
-rw-r--r-- | src/H5VL.c | 15 | ||||
-rw-r--r-- | src/H5VLcallback.c | 17 | ||||
-rw-r--r-- | src/H5VLconnector.h | 2 | ||||
-rw-r--r-- | src/H5VLconnector_passthru.h | 2 | ||||
-rw-r--r-- | src/H5VLnative.h | 15 | ||||
-rw-r--r-- | src/H5VLnative_introspect.c | 188 | ||||
-rw-r--r-- | src/H5VLnative_private.h | 2 | ||||
-rw-r--r-- | src/H5VLpassthru.c | 6 | ||||
-rw-r--r-- | src/H5VLprivate.h | 2 | ||||
-rw-r--r-- | src/H5VLpublic.h | 23 |
13 files changed, 258 insertions, 47 deletions
@@ -1187,7 +1187,7 @@ herr_t H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size /*out*/) { H5VL_object_t *vol_obj; /* Dataset for this operation */ - hbool_t supported; /* Whether 'get vlen buf size' operation is supported by VOL connector */ + uint64_t supported; /* Whether 'get vlen buf size' operation is supported by VOL connector */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1204,11 +1204,12 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *s HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid 'size' pointer") /* Check if the 'get_vlen_buf_size' callback is supported */ - supported = FALSE; + supported = 0; if (H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_DATASET, H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE, &supported) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'get vlen buf size' operation") - if (supported) { + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, + "can't check for 'get vlen buf size' operation") + if (supported & H5VL_OPT_QUERY_SUPPORTED) { /* Make the 'get_vlen_buf_size' callback */ if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id, space_id, size) < 0) @@ -476,7 +476,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) H5P_genplist_t * plist; /* Property list pointer */ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ H5VL_object_t * vol_obj = NULL; /* VOL object for file */ - hbool_t supported; /* Whether 'post open' operation is supported by VOL connector */ + uint64_t supported; /* Whether 'post open' operation is supported by VOL connector */ hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -540,10 +540,10 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") /* Make the 'post open' callback */ - supported = FALSE; + supported = 0; if (H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation") - if (supported) + if (supported & H5VL_OPT_QUERY_SUPPORTED) if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file 'post open' callback") @@ -576,7 +576,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) H5P_genplist_t * plist; /* Property list pointer */ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ H5VL_object_t * vol_obj = NULL; /* VOL object for file */ - hbool_t supported; /* Whether 'post open' operation is supported by VOL connector */ + uint64_t supported; /* Whether 'post open' operation is supported by VOL connector */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -628,10 +628,10 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "invalid object identifier") /* Make the 'post open' callback */ - supported = FALSE; + supported = 0; if (H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation") - if (supported) + if (supported & H5VL_OPT_QUERY_SUPPORTED) if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file 'post open' callback") @@ -905,7 +905,7 @@ H5Freopen(hid_t file_id) { void * file = NULL; /* File struct for new file */ H5VL_object_t *vol_obj = NULL; /* VOL object for file */ - hbool_t supported; /* Whether 'post open' operation is supported by VOL connector */ + uint64_t supported; /* Whether 'post open' operation is supported by VOL connector */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -932,10 +932,10 @@ H5Freopen(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") /* Make the 'post open' callback */ - supported = FALSE; + supported = 0; if (H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation") - if (supported) + if (supported & H5VL_OPT_QUERY_SUPPORTED) if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file 'post open' callback") diff --git a/src/H5Rint.c b/src/H5Rint.c index e0d9ffc..40f48a1 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -546,7 +546,7 @@ H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id) void * new_file = NULL; /* File object opened */ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ H5VL_object_t * vol_obj = NULL; /* VOL object for file */ - hbool_t supported; /* Whether 'post open' operation is supported by VOL connector */ + uint64_t supported; /* Whether 'post open' operation is supported by VOL connector */ hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_PACKAGE @@ -585,10 +585,10 @@ H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "invalid object identifier") /* Make the 'post open' callback */ - supported = FALSE; + supported = 0; if (H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation") - if (supported) + if (supported & H5VL_OPT_QUERY_SUPPORTED) if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5I_INVALID_HID, @@ -895,7 +895,8 @@ done: * Function: H5VLquery_optional * * Purpose: Determine if a VOL connector supports a particular optional - * callback operation. + * callback operation, and a general sense of the operation's + * behavior. * * Return: Success: Non-negative * Failure: Negative @@ -903,23 +904,23 @@ done: *--------------------------------------------------------------------------- */ herr_t -H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_type, hbool_t *supported) +H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_type, uint64_t *flags /*out*/) { H5VL_object_t *vol_obj = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "iVSIs*b", obj_id, subcls, opt_type, supported); + H5TRACE4("e", "iVSIsx", obj_id, subcls, opt_type, flags); /* Check args */ - if (NULL == supported) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid supported pointer") + if (NULL == flags) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid 'flags' pointer") if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Query the connector */ - if (H5VL_introspect_opt_query(vol_obj, subcls, opt_type, supported) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to query VOL connector support") + if (H5VL_introspect_opt_query(vol_obj, subcls, opt_type, flags) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to query VOL connector operation") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 460a170..427e447 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -152,7 +152,7 @@ static herr_t H5VL__object_optional(void *obj, const H5VL_class_t *cls, H5VL_obj static herr_t H5VL__introspect_get_conn_cls(void *obj, const H5VL_class_t *cls, H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls); static herr_t H5VL__introspect_opt_query(void *obj, const H5VL_class_t *cls, H5VL_subclass_t subcls, - int opt_type, hbool_t *supported); + int opt_type, uint64_t *flags); 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_notify(void *req, const H5VL_class_t *cls, H5VL_request_notify_t cb, void *ctx); static herr_t H5VL__request_cancel(void *req, const H5VL_class_t *cls); @@ -5849,7 +5849,7 @@ done: */ static herr_t H5VL__introspect_opt_query(void *obj, const H5VL_class_t *cls, H5VL_subclass_t subcls, int opt_type, - hbool_t *supported) + uint64_t *flags) { herr_t ret_value = SUCCEED; /* Return value */ @@ -5860,7 +5860,7 @@ H5VL__introspect_opt_query(void *obj, const H5VL_class_t *cls, H5VL_subclass_t s HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'opt_query' method") /* Call the corresponding VOL callback */ - if ((cls->introspect_cls.opt_query)(obj, subcls, opt_type, supported) < 0) + if ((cls->introspect_cls.opt_query)(obj, subcls, opt_type, flags) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support") done: @@ -5879,8 +5879,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_introspect_opt_query(const H5VL_object_t *vol_obj, H5VL_subclass_t subcls, int opt_type, - hbool_t *supported) +H5VL_introspect_opt_query(const H5VL_object_t *vol_obj, H5VL_subclass_t subcls, int opt_type, uint64_t *flags) { hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -5893,7 +5892,7 @@ H5VL_introspect_opt_query(const H5VL_object_t *vol_obj, H5VL_subclass_t subcls, vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if (H5VL__introspect_opt_query(vol_obj->data, vol_obj->connector->cls, subcls, opt_type, supported) < 0) + if (H5VL__introspect_opt_query(vol_obj->data, vol_obj->connector->cls, subcls, opt_type, flags) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support") done: @@ -5917,20 +5916,20 @@ done: */ herr_t H5VLintrospect_opt_query(void *obj, hid_t connector_id, H5VL_subclass_t subcls, int opt_type, - hbool_t *supported /*out*/) + uint64_t *flags /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xiVSIsx", obj, connector_id, subcls, opt_type, supported); + H5TRACE5("e", "*xiVSIsx", obj, connector_id, subcls, opt_type, flags); /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if (H5VL__introspect_opt_query(obj, cls, subcls, opt_type, supported) < 0) + if (H5VL__introspect_opt_query(obj, cls, subcls, opt_type, flags) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support") done: diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h index 2abdca3..48f4a28 100644 --- a/src/H5VLconnector.h +++ b/src/H5VLconnector.h @@ -410,7 +410,7 @@ struct H5VL_class_t; /* Container/connector introspection routines */ typedef struct H5VL_introspect_class_t { herr_t (*get_conn_cls)(void *obj, H5VL_get_conn_lvl_t lvl, const struct H5VL_class_t **conn_cls); - herr_t (*opt_query)(void *obj, H5VL_subclass_t cls, int opt_type, hbool_t *supported); + herr_t (*opt_query)(void *obj, H5VL_subclass_t cls, int opt_type, uint64_t *flags); } H5VL_introspect_class_t; /* Async request operation routines */ diff --git a/src/H5VLconnector_passthru.h b/src/H5VLconnector_passthru.h index 07297e1..053d912 100644 --- a/src/H5VLconnector_passthru.h +++ b/src/H5VLconnector_passthru.h @@ -195,7 +195,7 @@ H5_DLL herr_t H5VLobject_optional(void *obj, hid_t connector_id, H5VL_object_opt H5_DLL herr_t H5VLintrospect_get_conn_cls(void *obj, hid_t connector_id, H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls); H5_DLL herr_t H5VLintrospect_opt_query(void *obj, hid_t connector_id, H5VL_subclass_t subcls, int opt_type, - hbool_t *supported); + uint64_t *flags); /* Public wrappers for asynchronous request callbacks */ H5_DLL herr_t H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5ES_status_t *status); diff --git a/src/H5VLnative.h b/src/H5VLnative.h index b81f9c1..ae52084 100644 --- a/src/H5VLnative.h +++ b/src/H5VLnative.h @@ -33,11 +33,17 @@ #define H5VL_NATIVE_VERSION 0 /* Values for VOL connector attribute optional VOL operations */ +/* NOTE: If new values are added here, the H5VL__native_introspect_opt_query + * routine must be updated. + */ #ifndef H5_NO_DEPRECATED_SYMBOLS #define H5VL_NATIVE_ATTR_ITERATE_OLD 0 /* H5Aiterate (deprecated routine) */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Values for native VOL connector dataset optional VOL operations */ +/* NOTE: If new values are added here, the H5VL__native_introspect_opt_query + * routine must be updated. + */ #define H5VL_NATIVE_DATASET_FORMAT_CONVERT 0 /* H5Dformat_convert (internal) */ #define H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE 1 /* H5Dget_chunk_index_type */ #define H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE 2 /* H5Dget_chunk_storage_size */ @@ -50,6 +56,9 @@ #define H5VL_NATIVE_DATASET_GET_OFFSET 9 /* H5Dget_offset */ /* Values for native VOL connector file optional VOL operations */ +/* NOTE: If new values are added here, the H5VL__native_introspect_opt_query + * routine must be updated. + */ #define H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE 0 /* H5Fclear_elink_file_cache */ #define H5VL_NATIVE_FILE_GET_FILE_IMAGE 1 /* H5Fget_file_image */ #define H5VL_NATIVE_FILE_GET_FREE_SECTIONS 2 /* H5Fget_free_sections */ @@ -81,12 +90,18 @@ #define H5VL_NATIVE_FILE_POST_OPEN 28 /* Adjust file after open, with wrapping context */ /* Values for native VOL connector group optional VOL operations */ +/* NOTE: If new values are added here, the H5VL__native_introspect_opt_query + * routine must be updated. + */ #ifndef H5_NO_DEPRECATED_SYMBOLS #define H5VL_NATIVE_GROUP_ITERATE_OLD 0 /* HG5Giterate (deprecated routine) */ #define H5VL_NATIVE_GROUP_GET_OBJINFO 1 /* HG5Gget_objinfo (deprecated routine) */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Values for native VOL connector object optional VOL operations */ +/* NOTE: If new values are added here, the H5VL__native_introspect_opt_query + * routine must be updated. + */ #define H5VL_NATIVE_OBJECT_GET_COMMENT 0 /* H5G|H5Oget_comment, H5Oget_comment_by_name */ #define H5VL_NATIVE_OBJECT_SET_COMMENT 1 /* H5G|H5Oset_comment, H5Oset_comment_by_name */ #define H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES 2 /* H5Odisable_mdc_flushes */ diff --git a/src/H5VLnative_introspect.c b/src/H5VLnative_introspect.c index e59f7fd..68b02e6 100644 --- a/src/H5VLnative_introspect.c +++ b/src/H5VLnative_introspect.c @@ -35,16 +35,192 @@ *--------------------------------------------------------------------------- */ herr_t -H5VL__native_introspect_opt_query(void H5_ATTR_UNUSED *obj, H5VL_subclass_t H5_ATTR_UNUSED cls, - int H5_ATTR_UNUSED opt_type, hbool_t *supported) +H5VL__native_introspect_opt_query(void H5_ATTR_UNUSED *obj, H5VL_subclass_t subcls, int opt_type, + uint64_t *flags) { - FUNC_ENTER_PACKAGE_NOERR + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(supported); + HDassert(flags); /* The native VOL connector supports all optional operations */ - *supported = TRUE; + *flags = H5VL_OPT_QUERY_SUPPORTED; + + /* Set appropriate flags for each operation in each subclass */ + switch (subcls) { + case H5VL_SUBCLS_NONE: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional 'none' operation") + + case H5VL_SUBCLS_INFO: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional info operation") + + case H5VL_SUBCLS_WRAP: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional wrapper operation") + + case H5VL_SUBCLS_ATTR: + switch (opt_type) { +#ifndef H5_NO_DEPRECATED_SYMBOLS + case H5VL_NATIVE_ATTR_ITERATE_OLD: + /* Don't allow asynchronous execution, due to iterator callbacks */ + *flags |= H5VL_OPT_QUERY_NO_ASYNC; + break; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional attribute operation") + break; + } /* end switch */ + break; + + case H5VL_SUBCLS_DATASET: + switch (opt_type) { + case H5VL_NATIVE_DATASET_FORMAT_CONVERT: + *flags |= H5VL_OPT_QUERY_MODIFY_METADATA; + break; + + case H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE: + case H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE: + case H5VL_NATIVE_DATASET_GET_NUM_CHUNKS: + case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX: + case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD: + case H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE: + case H5VL_NATIVE_DATASET_GET_OFFSET: + *flags |= H5VL_OPT_QUERY_QUERY_METADATA; + break; + + case H5VL_NATIVE_DATASET_CHUNK_READ: + *flags |= H5VL_OPT_QUERY_READ_DATA; + break; + + case H5VL_NATIVE_DATASET_CHUNK_WRITE: + *flags |= H5VL_OPT_QUERY_WRITE_DATA; + break; + + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional dataset operation") + break; + } /* end switch */ + break; + + case H5VL_SUBCLS_DATATYPE: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional datatype operation") + + case H5VL_SUBCLS_FILE: + switch (opt_type) { + case H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE: + case H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE: + case H5VL_NATIVE_FILE_SET_MDC_CONFIG: + *flags |= H5VL_OPT_QUERY_MODIFY_METADATA; + break; + + case H5VL_NATIVE_FILE_GET_FILE_IMAGE: + *flags |= H5VL_OPT_QUERY_QUERY_METADATA; + *flags |= H5VL_OPT_QUERY_READ_DATA; + break; + + case H5VL_NATIVE_FILE_GET_FREE_SECTIONS: + case H5VL_NATIVE_FILE_GET_FREE_SPACE: + case H5VL_NATIVE_FILE_GET_INFO: + case H5VL_NATIVE_FILE_GET_MDC_CONF: + case H5VL_NATIVE_FILE_GET_MDC_HR: + case H5VL_NATIVE_FILE_GET_MDC_SIZE: + case H5VL_NATIVE_FILE_GET_SIZE: + case H5VL_NATIVE_FILE_GET_VFD_HANDLE: + case H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO: + *flags |= H5VL_OPT_QUERY_QUERY_METADATA; + break; + + case H5VL_NATIVE_FILE_START_SWMR_WRITE: + *flags |= H5VL_OPT_QUERY_MODIFY_METADATA; + *flags |= H5VL_OPT_QUERY_WRITE_DATA; + *flags |= H5VL_OPT_QUERY_NO_ASYNC; + break; + + case H5VL_NATIVE_FILE_START_MDC_LOGGING: + case H5VL_NATIVE_FILE_STOP_MDC_LOGGING: + case H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS: + case H5VL_NATIVE_FILE_FORMAT_CONVERT: + case H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS: + case H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS: + case H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO: + case H5VL_NATIVE_FILE_GET_EOA: + case H5VL_NATIVE_FILE_INCR_FILESIZE: + case H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS: + case H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG: + case H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG: + case H5VL_NATIVE_FILE_GET_MPI_ATOMICITY: + case H5VL_NATIVE_FILE_SET_MPI_ATOMICITY: + case H5VL_NATIVE_FILE_POST_OPEN: + break; + + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional file operation") + break; + } /* end switch */ + break; + + case H5VL_SUBCLS_GROUP: + switch (opt_type) { +#ifndef H5_NO_DEPRECATED_SYMBOLS + case H5VL_NATIVE_GROUP_ITERATE_OLD: + /* Don't allow asynchronous execution, due to iterator callbacks */ + *flags |= H5VL_OPT_QUERY_NO_ASYNC; + break; + + case H5VL_NATIVE_GROUP_GET_OBJINFO: + *flags |= H5VL_OPT_QUERY_QUERY_METADATA; + break; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional group operation") + break; + } /* end switch */ + break; + + case H5VL_SUBCLS_LINK: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional link operation") + + case H5VL_SUBCLS_OBJECT: + switch (opt_type) { + case H5VL_NATIVE_OBJECT_GET_COMMENT: + *flags |= H5VL_OPT_QUERY_QUERY_METADATA; + break; + + case H5VL_NATIVE_OBJECT_SET_COMMENT: + *flags |= H5VL_OPT_QUERY_MODIFY_METADATA; + break; + + case H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES: + case H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES: + case H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED: + break; + + case H5VL_NATIVE_OBJECT_GET_NATIVE_INFO: + *flags |= H5VL_OPT_QUERY_QUERY_METADATA; + break; + + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional object operation") + break; + } /* end switch */ + break; + + case H5VL_SUBCLS_REQUEST: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional request operation") + + case H5VL_SUBCLS_BLOB: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional blob operation") + + case H5VL_SUBCLS_TOKEN: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional token operation") + + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown H5VL subclass") + } /* end switch */ - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__native_introspect_opt_query() */ diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h index 0c2584c..40ab45f 100644 --- a/src/H5VLnative_private.h +++ b/src/H5VLnative_private.h @@ -151,7 +151,7 @@ H5_DLL herr_t H5VL__native_object_optional(void *obj, H5VL_object_optional_t opt H5_DLL herr_t H5VL__native_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls); H5_DLL herr_t H5VL__native_introspect_opt_query(void *obj, H5VL_subclass_t cls, int opt_type, - hbool_t *supported); + uint64_t *flags); /* Blob callbacks */ H5_DLL herr_t H5VL__native_blob_put(void *obj, const void *buf, size_t size, void *blob_id, void *ctx); diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c index 4e967d9..0725900 100644 --- a/src/H5VLpassthru.c +++ b/src/H5VLpassthru.c @@ -225,7 +225,7 @@ static herr_t H5VL_pass_through_object_optional(void *obj, H5VL_object_optional_ static herr_t H5VL_pass_through_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls); static herr_t H5VL_pass_through_introspect_opt_query(void *obj, H5VL_subclass_t cls, int opt_type, - hbool_t *supported); + uint64_t *flags); /* Async request callbacks */ static herr_t H5VL_pass_through_request_wait(void *req, uint64_t timeout, H5ES_status_t *status); @@ -2635,7 +2635,7 @@ H5VL_pass_through_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl, co *------------------------------------------------------------------------- */ herr_t -H5VL_pass_through_introspect_opt_query(void *obj, H5VL_subclass_t cls, int opt_type, hbool_t *supported) +H5VL_pass_through_introspect_opt_query(void *obj, H5VL_subclass_t cls, int opt_type, uint64_t *flags) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; @@ -2644,7 +2644,7 @@ H5VL_pass_through_introspect_opt_query(void *obj, H5VL_subclass_t cls, int opt_t printf("------- PASS THROUGH VOL INTROSPECT OptQuery\n"); #endif - ret_value = H5VLintrospect_opt_query(o->under_object, o->under_vol_id, cls, opt_type, supported); + ret_value = H5VLintrospect_opt_query(o->under_object, o->under_vol_id, cls, opt_type, flags); return ret_value; } /* end H5VL_pass_through_introspect_opt_query() */ diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index bb4e60f..a020923 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -236,7 +236,7 @@ H5_DLL herr_t H5VL_object_optional(const H5VL_object_t *vol_obj, H5VL_object_opt H5_DLL herr_t H5VL_introspect_get_conn_cls(const H5VL_object_t *vol_obj, H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls); H5_DLL herr_t H5VL_introspect_opt_query(const H5VL_object_t *vol_obj, H5VL_subclass_t subcls, int opt_type, - hbool_t *supported); + uint64_t *flags); /* Asynchronous functions */ H5_DLL herr_t H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout, H5ES_status_t *status); diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 9c9d60a..7494586 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -49,6 +49,25 @@ */ #define H5_VOL_MAX 65535 +/* Flags to return from H5VLquery_optional API and 'opt_query' callbacks */ +/* Note: Operations which access multiple objects' data or metadata in a + * container should be registered as file-level optional operations. + * (e.g. "H5Dwrite_multi" takes a list of datasets to write data to, so + * a VOL connector that implemented it should register it as an optional + * file operation, and pass-through VOL connectors that are stacked above + * the connector that registered it should assume that dataset elements + * for _any_ dataset in the file could be written to) + */ +#define H5VL_OPT_QUERY_SUPPORTED 0x0001 /* VOL connector supports this operation */ +#define H5VL_OPT_QUERY_READ_DATA 0x0002 /* Operation reads data for object */ +#define H5VL_OPT_QUERY_WRITE_DATA 0x0004 /* Operation writes data for object */ +#define H5VL_OPT_QUERY_QUERY_METADATA 0x0008 /* Operation reads metadata for object */ +#define H5VL_OPT_QUERY_MODIFY_METADATA 0x0010 /* Operation modifies metadata for object */ +#define H5VL_OPT_QUERY_COLLECTIVE \ + 0x0020 /* Operation is collective (operations without this flag are assumed to be independent) */ +#define H5VL_OPT_QUERY_NO_ASYNC 0x0040 /* Operation may NOT be executed asynchronously */ +#define H5VL_OPT_QUERY_MULTI_OBJ 0x0080 /* Operation involves multiple objects */ + /*******************/ /* Public Typedefs */ /*******************/ @@ -319,12 +338,12 @@ H5_DLL herr_t H5VLunregister_connector(hid_t connector_id); * \obj_id * \param[in] subcls VOL subclass * \param[in] opt_type Option type - * \param[out] supported Flag + * \param[out] flags Operation flags * \return \herr_t * * \since 1.12.0 */ -H5_DLL herr_t H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_type, hbool_t *supported); +H5_DLL herr_t H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_type, uint64_t *flags); #ifdef __cplusplus } |