diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2020-04-09 15:30:09 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2020-04-09 15:30:09 (GMT) |
commit | 0fdbbcfc0b7fe08421efe476e7cbe03411774fe0 (patch) | |
tree | c0def524d72df58889daa331a1d0b742fd90f2a9 | |
parent | 88ff2b6cb80c66faf5805e1ec0bdcbfda2942a8d (diff) | |
parent | 35c0d5cdfcfaa84f59e1c596ba1ccaeb28e3d83d (diff) | |
download | hdf5-0fdbbcfc0b7fe08421efe476e7cbe03411774fe0.zip hdf5-0fdbbcfc0b7fe08421efe476e7cbe03411774fe0.tar.gz hdf5-0fdbbcfc0b7fe08421efe476e7cbe03411774fe0.tar.bz2 |
Merge pull request #2502 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:develop_minor to develop
* commit '35c0d5cdfcfaa84f59e1c596ba1ccaeb28e3d83d':
Fix for passthrough VOL not passing tools tests due to incorrect optional callback queries.
-rw-r--r-- | src/H5VL.c | 37 | ||||
-rw-r--r-- | src/H5VLconnector.h | 18 | ||||
-rw-r--r-- | src/H5VLpublic.h | 20 | ||||
-rw-r--r-- | tools/lib/h5tools_dump.c | 15 | ||||
-rw-r--r-- | tools/src/h5dump/h5dump_ddl.c | 8 | ||||
-rw-r--r-- | tools/src/h5ls/h5ls.c | 7 |
6 files changed, 61 insertions, 44 deletions
@@ -903,7 +903,7 @@ H5VLfree_lib_state(void *state) /* Check args */ if(NULL == state) - HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "invalid state pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid state pointer") /* Free the library state */ if(H5VL_free_lib_state(state) < 0) @@ -913,3 +913,38 @@ done: FUNC_LEAVE_API(ret_value) } /* H5VLfree_lib_state() */ + +/*--------------------------------------------------------------------------- + * Function: H5VLquery_optional + * + * Purpose: Determine if a VOL connector supports a particular optional + * callback operation. + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_type, hbool_t *supported) +{ + 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); + + /* Check args */ + if(NULL == supported) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid supported 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") + +done: + FUNC_LEAVE_API(ret_value) +} /* H5VLquery_optional() */ + diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h index 7951a32..4a35f22 100644 --- a/src/H5VLconnector.h +++ b/src/H5VLconnector.h @@ -48,24 +48,6 @@ /* Public Typedefs */ /*******************/ -/* Enum type for each VOL subclass */ -/* (Used for various queries, etc) */ -typedef enum H5VL_subclass_t { - H5VL_SUBCLS_NONE, /* Operations outside of a subclass */ - H5VL_SUBCLS_INFO, /* 'Info' subclass */ - H5VL_SUBCLS_WRAP, /* 'Wrap' subclass */ - H5VL_SUBCLS_ATTR, /* 'Attribute' subclass */ - H5VL_SUBCLS_DATASET, /* 'Dataset' subclass */ - H5VL_SUBCLS_DATATYPE, /* 'Named datatype' subclass */ - H5VL_SUBCLS_FILE, /* 'File' subclass */ - H5VL_SUBCLS_GROUP, /* 'Group' subclass */ - H5VL_SUBCLS_LINK, /* 'Link' subclass */ - H5VL_SUBCLS_OBJECT, /* 'Object' subclass */ - H5VL_SUBCLS_REQUEST, /* 'Request' subclass */ - H5VL_SUBCLS_BLOB, /* 'Blob' subclass */ - H5VL_SUBCLS_TOKEN /* 'Token' subclass */ -} H5VL_subclass_t; - /* types for attribute GET callback */ typedef enum H5VL_attr_get_t { H5VL_ATTR_GET_ACPL, /* creation property list */ diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 006c3ea..8f79adc 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -48,6 +48,24 @@ typedef int H5VL_class_value_t; +/* Enum type for each VOL subclass */ +/* (Used for various queries, etc) */ +typedef enum H5VL_subclass_t { + H5VL_SUBCLS_NONE, /* Operations outside of a subclass */ + H5VL_SUBCLS_INFO, /* 'Info' subclass */ + H5VL_SUBCLS_WRAP, /* 'Wrap' subclass */ + H5VL_SUBCLS_ATTR, /* 'Attribute' subclass */ + H5VL_SUBCLS_DATASET, /* 'Dataset' subclass */ + H5VL_SUBCLS_DATATYPE, /* 'Named datatype' subclass */ + H5VL_SUBCLS_FILE, /* 'File' subclass */ + H5VL_SUBCLS_GROUP, /* 'Group' subclass */ + H5VL_SUBCLS_LINK, /* 'Link' subclass */ + H5VL_SUBCLS_OBJECT, /* 'Object' subclass */ + H5VL_SUBCLS_REQUEST, /* 'Request' subclass */ + H5VL_SUBCLS_BLOB, /* 'Blob' subclass */ + H5VL_SUBCLS_TOKEN /* 'Token' subclass */ +} H5VL_subclass_t; + /********************/ /* Public Variables */ /********************/ @@ -70,7 +88,7 @@ H5_DLL hid_t H5VLget_connector_id_by_value(H5VL_class_value_t connector_value); H5_DLL ssize_t H5VLget_connector_name(hid_t id, char *name/*out*/, size_t size); H5_DLL herr_t H5VLclose(hid_t connector_id); H5_DLL herr_t H5VLunregister_connector(hid_t connector_id); - +H5_DLL herr_t H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_type, hbool_t *supported); #ifdef __cplusplus } diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index cd7c3d2..b59ae93 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -3283,8 +3283,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, } else { haddr_t ioffset; - void *obj = NULL; - hid_t connector_id = H5I_INVALID_HID; hbool_t supported = FALSE; /* NORMAL FILE */ @@ -3304,10 +3302,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, /* Only dump the offset if the VOL connector implements * the functionality. */ - obj = H5VLobject(dset_id); - connector_id = H5VLget_connector_id(dset_id); - H5VLintrospect_opt_query(obj, connector_id, H5VL_SUBCLS_DATASET, H5VL_NATIVE_DATASET_GET_OFFSET, &supported); - H5VLclose(connector_id); + H5VLquery_optional(dset_id, H5VL_SUBCLS_DATASET, H5VL_NATIVE_DATASET_GET_OFFSET, &supported); if (supported) { @@ -3732,15 +3727,11 @@ h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, h5tools_context_ * instead of the current stripmine position i; this is necessary * to print the array indices */ - void *obj = NULL; - hid_t connector_id = H5I_INVALID_HID; hbool_t supported = FALSE; /* Check if comments are supported and return if not */ - obj = H5VLobject(obj_id); - connector_id = H5VLget_connector_id(obj_id); - H5VLintrospect_opt_query(obj, connector_id, H5VL_SUBCLS_OBJECT, H5VL_NATIVE_OBJECT_GET_COMMENT, &supported); - H5VLclose(connector_id); + H5VLquery_optional(obj_id, H5VL_SUBCLS_OBJECT, H5VL_NATIVE_OBJECT_GET_COMMENT, &supported); + if (!supported) return; diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c index e97ab7e..1df205c 100644 --- a/tools/src/h5dump/h5dump_ddl.c +++ b/tools/src/h5dump/h5dump_ddl.c @@ -1136,8 +1136,6 @@ dump_fcpl(hid_t fid) unsigned sym_ik; /* symbol table B-tree internal 'K' value */ unsigned istore_ik; /* indexed storage B-tree internal 'K' value */ - void *obj = NULL; - hid_t connector_id = H5I_INVALID_HID; hbool_t supported = FALSE; /* Dumping the information here only makes sense for the native @@ -1145,10 +1143,8 @@ dump_fcpl(hid_t fid) * use that as a proxy for "native-ness". If that isn't supported, we'll * just return. */ - obj = H5VLobject(fid); - connector_id = H5VLget_connector_id(fid); - H5VLintrospect_opt_query(obj, connector_id, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_GET_INFO, &supported); - H5VLclose(connector_id); + H5VLquery_optional(fid, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_GET_INFO, &supported); + if (!supported) return; diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index f82827c..49f3bbf 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -2364,8 +2364,6 @@ list_obj(const char *name, const H5O_info2_t *oinfo, const char *first_seen, voi char* comment = NULL; char* obj_tok_str = NULL; ssize_t cmt_bufsize = -1; - void *obj = NULL; - hid_t connector_id = H5I_INVALID_HID; hbool_t supported = FALSE; /* Display attributes */ @@ -2401,10 +2399,7 @@ list_obj(const char *name, const H5O_info2_t *oinfo, const char *first_seen, voi } /* end if */ /* Only emit comments if the VOL connector supports that */ - obj = H5VLobject(obj_id); - connector_id = H5VLget_connector_id(obj_id); - H5VLintrospect_opt_query(obj, connector_id, H5VL_SUBCLS_OBJECT, H5VL_NATIVE_OBJECT_GET_COMMENT, &supported); - H5VLclose(connector_id); + H5VLquery_optional(obj_id, H5VL_SUBCLS_OBJECT, H5VL_NATIVE_OBJECT_GET_COMMENT, &supported); if (supported) { |