diff options
author | Quincey Koziol <koziol@lbl.gov> | 2019-12-21 04:54:04 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@lbl.gov> | 2019-12-21 04:54:04 (GMT) |
commit | 9016f66248aa2e857a6fcb5926d1af7bbf2cbdc4 (patch) | |
tree | 84e64ae56bea967eab98788366fa8b3d0ed6b55b /src/H5VLnative.c | |
parent | 7e0e9f83dc45a4ec1212bc96f6584d221073af39 (diff) | |
parent | c2ca33dcfa340af603399036dfddad0ebbd72f6f (diff) | |
download | hdf5-9016f66248aa2e857a6fcb5926d1af7bbf2cbdc4.zip hdf5-9016f66248aa2e857a6fcb5926d1af7bbf2cbdc4.tar.gz hdf5-9016f66248aa2e857a6fcb5926d1af7bbf2cbdc4.tar.bz2 |
Merge pull request #2167 in HDFFV/hdf5 from refactor_optional_vol_callback_02 to develop
* commit 'c2ca33dcfa340af603399036dfddad0ebbd72f6f':
Remove unnecessary H5CX call
Refactor H5Dvlen_get_buf_size to use optional dataset operation, with generic fallback for VOL connectors that don't implement operation
Cleanups from PR reviews
Refactor all the 'H5VL_*_optional' callbacks to move the type of operation out of the va_list, so it's at least possible for another connector to know what the operation is and decide whether to implement it or not.
Diffstat (limited to 'src/H5VLnative.c')
-rw-r--r-- | src/H5VLnative.c | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 78eaee4..0a3dacb 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -31,7 +31,7 @@ static hid_t H5VL_NATIVE_ID_g = H5I_INVALID_HID; static herr_t H5VL__native_term(void); /* Native VOL connector class struct */ -static H5VL_class_t H5VL_native_cls_g = { +static const H5VL_class_t H5VL_native_cls_g = { H5VL_NATIVE_VERSION, /* version */ H5VL_NATIVE_VALUE, /* value */ H5VL_NATIVE_NAME, /* name */ @@ -112,6 +112,10 @@ static H5VL_class_t H5VL_native_cls_g = { H5VL__native_object_specific, /* specific */ H5VL__native_object_optional /* optional */ }, + { /* introspect_cls */ + H5VL__native_introspect_get_conn_cls, /* get_conn_cls */ + H5VL__native_introspect_opt_query, /* opt_query */ + }, { /* request_cls */ NULL, /* wait */ NULL, /* notify */ @@ -148,8 +152,8 @@ H5VL_native_register(void) FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Register the native VOL connector, if it isn't already */ - if(NULL == H5I_object_verify(H5VL_NATIVE_ID_g, H5I_VOL)) - if((H5VL_NATIVE_ID_g = H5VL_register_connector((const H5VL_class_t *)&H5VL_native_cls_g, TRUE, H5P_DEFAULT)) < 0) + if(H5I_INVALID_HID == H5VL_NATIVE_ID_g) + if((H5VL_NATIVE_ID_g = H5VL_register_connector(&H5VL_native_cls_g, TRUE, H5P_DEFAULT)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL connector") /* Set return value */ @@ -180,3 +184,31 @@ H5VL__native_term(void) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5VL__native_term() */ + +/*--------------------------------------------------------------------------- + * Function: H5VL__native_introspect_get_conn_cls + * + * Purpose: Query the connector class. + * + * Note: This routine is in this file so that it can return the address + * of the staticly declared class struct. + * + * Returns: SUCCEED (Can't fail) + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VL__native_introspect_get_conn_cls(void H5_ATTR_UNUSED *obj, + H5VL_get_conn_lvl_t H5_ATTR_UNUSED lvl, const H5VL_class_t **conn_cls) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity check */ + HDassert(conn_cls); + + /* Retrieve the native VOL connector class */ + *conn_cls = &H5VL_native_cls_g; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5VL__native_introspect_get_conn_cls() */ + |