From 9c7b96b42fa8f2a0f02c7ba72173c09424d740c3 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 27 Oct 2018 02:21:48 -0500 Subject: Move (final?) file operation from directly calling into library code to using the file_optional VOL callback. --- src/H5Cquery.c | 8 ++++---- src/H5F.c | 12 +++++------- src/H5VLnative.c | 8 +++++++- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/H5Cquery.c b/src/H5Cquery.c index 6c927b0..e4f3133 100644 --- a/src/H5Cquery.c +++ b/src/H5Cquery.c @@ -472,11 +472,11 @@ H5C_get_mdc_image_info(H5C_t * cache_ptr, haddr_t *image_addr, hsize_t *image_le if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry") - if(image_addr == NULL || image_len == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad image_addr or image_len on entry") - *image_addr = cache_ptr->image_addr; - *image_len = cache_ptr->image_len; + if(image_addr) + *image_addr = cache_ptr->image_addr; + if(image_len) + *image_len = cache_ptr->image_len; done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5F.c b/src/H5F.c index 6fb323e..3cfd3eb 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -1765,21 +1765,19 @@ done: herr_t H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_len) { - H5F_t *file; /* File object for file ID */ + H5VL_object_t *vol_obj; /* File info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*a*h", file_id, image_addr, image_len); /* Check args */ - if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - if(NULL == image_addr || NULL == image_len) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL image addr or image len") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Go get the address and size of the cache image */ - if(H5AC_get_mdc_image_info(file->shared->cache, image_addr, image_len) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't retrieve cache image info") + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_IMAGE_INFO, image_addr, image_len) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 4d4311f..c6954bc 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -2088,7 +2088,13 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR case H5VL_FILE_GET_MDC_IMAGE_INFO: { - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") + haddr_t *image_addr = va_arg(arguments, haddr_t *); + hsize_t *image_len = va_arg(arguments, hsize_t *); + + /* Go get the address and size of the cache image */ + if(H5AC_get_mdc_image_info(f->shared->cache, image_addr, image_len) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info") + break; } -- cgit v0.12