diff options
-rw-r--r-- | src/H5Dio.c | 4 | ||||
-rw-r--r-- | src/H5F.c | 74 | ||||
-rw-r--r-- | src/H5Fdeprec.c | 6 | ||||
-rw-r--r-- | src/H5Fint.c | 13 | ||||
-rw-r--r-- | src/H5Fmount.c | 26 | ||||
-rw-r--r-- | src/H5VLcallback.c | 393 | ||||
-rw-r--r-- | src/H5VLprivate.h | 8 | ||||
-rw-r--r-- | test/tfile.c | 36 |
8 files changed, 338 insertions, 222 deletions
diff --git a/src/H5Dio.c b/src/H5Dio.c index ed43f8f..f977b0e 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -242,7 +242,7 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil H5CX_set_dxpl(dxpl_id); /* Read the raw chunk */ - if (H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_DATASET_CHUNK_READ, offset, filters, buf) < 0) + if(H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_DATASET_CHUNK_READ, offset, filters, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data") done: @@ -370,7 +370,7 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of H5CX_set_dxpl(dxpl_id); /* Write chunk */ - if (H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_DATASET_CHUNK_WRITE, filters, offset, data_size_32, buf) < 0) + if(H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_DATASET_CHUNK_WRITE, filters, offset, data_size_32, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data") done: @@ -199,7 +199,7 @@ H5F__close_cb(H5VL_object_t *file_vol_obj) HDassert(file_vol_obj); /* Close the file */ - if(H5VL_file_close(file_vol_obj->data, file_vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_file_close(file_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file"); /* Free the VOL object */ @@ -239,8 +239,7 @@ H5Fget_create_plist(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Retrieve the file creation property list */ - if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_FCPL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_FCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "unable to retrieve file creation properties") done: @@ -280,8 +279,7 @@ H5Fget_access_plist(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Retrieve the file's access property list */ - if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_FAPL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_FAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get file access property list") done: @@ -350,8 +348,7 @@ H5Fget_obj_count(hid_t file_id, unsigned types) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file id") /* Get the count */ - if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_OBJ_COUNT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, &ret_value) < 0) + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_OBJ_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object count in file(s)") } /* If we passed in the 'special' ID, get the count for everything open in the @@ -462,8 +459,7 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the IDs */ - if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_OBJ_IDS, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, max_objs, oid_list, &ret_value) < 0) + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_OBJ_IDS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, max_objs, oid_list, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object ids in file(s)") } /* end if */ /* If we passed in the 'special' ID, get the count for everything open in the @@ -536,7 +532,7 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Retrieve the VFD handle for the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl_id) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle") done: @@ -573,7 +569,7 @@ H5Fis_accessible(const char *name, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") /* Check if file is accessible */ - if(H5VL_file_specific(NULL, NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id, name, &ret_value) < 0) + if(H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id, name, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5") done: @@ -776,7 +772,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Flush the object */ - if(H5VL_file_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, scope) < 0) + if(H5VL_file_specific(vol_obj, H5VL_FILE_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, scope) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file") done: @@ -851,7 +847,7 @@ H5Freopen(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Reopen the file */ - if(H5VL_file_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_REOPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &file) < 0) + if(H5VL_file_specific(vol_obj, H5VL_FILE_REOPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &file) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL plugin") /* Make sure that worked */ @@ -895,7 +891,7 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Get the flags */ - if((ret_value = H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_INTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, intent_flags)) < 0) + if((ret_value = H5VL_file_get(vol_obj, H5VL_FILE_GET_INTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, intent_flags)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's intent flags") } /* end if */ @@ -929,7 +925,7 @@ H5Fget_freespace(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the amount of free space in the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SPACE, &ret_value) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SPACE, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space") done: @@ -964,7 +960,7 @@ H5Fget_filesize(hid_t file_id, hsize_t *size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the file size */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_SIZE, size) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_SIZE, size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") done: @@ -1025,7 +1021,7 @@ H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file ID") /* Get the file image */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image") done: @@ -1065,7 +1061,7 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Get the metadata cache configuration */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_CONF, config_ptr) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_CONF, config_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration") done: @@ -1098,8 +1094,7 @@ H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Set the metadata cache configuration */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_SET_MDC_CONFIG, config_ptr) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_MDC_CONFIG, config_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set metadata cache configuration") done: @@ -1135,7 +1130,7 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the current hit rate */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_HR, hit_rate_ptr) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_HR, hit_rate_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate") done: @@ -1172,7 +1167,7 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the size data */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_SIZE, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_SIZE, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size") done: @@ -1210,7 +1205,7 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Reset the hit rate statistic */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_RESET_MDC_HIT_RATE) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_RESET_MDC_HIT_RATE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate") done: @@ -1259,7 +1254,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the filename via the VOL */ - if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, size, name, &ret_value) < 0) + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, size, name, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file name") done: @@ -1304,7 +1299,7 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the file information */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_INFO, type, finfo) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_INFO, type, finfo) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") done: @@ -1340,7 +1335,7 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the retry info */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_METADATA_READ_RETRY_INFO, info) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_METADATA_READ_RETRY_INFO, info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't get metadata read retry info") done: @@ -1379,7 +1374,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0") /* Get the free-space section information in the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, type, nsects) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, type, nsects) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections") done: @@ -1412,7 +1407,7 @@ H5Fclear_elink_file_cache(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Release the EFC */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_CLEAR_ELINK_CACHE) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_CLEAR_ELINK_CACHE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") done: @@ -1472,7 +1467,7 @@ H5Fstart_swmr_write(hid_t file_id) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Start SWMR writing */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_START_SWMR_WRITE) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_START_SWMR_WRITE) < 0) HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing") done: @@ -1504,8 +1499,7 @@ H5Fstart_mdc_logging(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_START_MDC_LOGGING) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_START_MDC_LOGGING) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to start mdc logging") done: @@ -1538,7 +1532,7 @@ H5Fstop_mdc_logging(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_STOP_MDC_LOGGING) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_STOP_MDC_LOGGING) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging") done: @@ -1572,7 +1566,7 @@ H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_LOGGING_STATUS, is_enabled, is_currently_logging) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_LOGGING_STATUS, is_enabled, is_currently_logging) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to get logging status") done: @@ -1610,7 +1604,7 @@ H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Set the library's version bounds */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds") done: @@ -1647,7 +1641,7 @@ H5Fformat_convert(hid_t file_id) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Convert the format */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_FORMAT_CONVERT) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_FORMAT_CONVERT) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format") done: @@ -1678,7 +1672,7 @@ H5Freset_page_buffering_stats(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Reset the statistics */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_RESET_PAGE_BUFFERING_STATS) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_RESET_PAGE_BUFFERING_STATS) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset stats for page buffering") done: @@ -1713,7 +1707,7 @@ H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2 HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL input parameters for stats") /* Get the statistics */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_PAGE_BUFFERING_STATS, accesses, hits, misses, evictions, bypasses) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_PAGE_BUFFERING_STATS, accesses, hits, misses, evictions, bypasses) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering") done: @@ -1748,7 +1742,7 @@ H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_len) 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(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) + if(H5VL_file_optional(vol_obj, 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: @@ -1782,7 +1776,7 @@ H5Fget_eoa(hid_t file_id, haddr_t *eoa) /* Only do work if valid pointer to fill in */ if(eoa) { /* Retrieve the EOA for the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_EOA, eoa) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_EOA, eoa) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get EOA") } /* end if */ @@ -1813,7 +1807,7 @@ H5Fincrement_filesize(hid_t file_id, hsize_t increment) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Increment the file size */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_INCR_FILESIZE, increment) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_INCR_FILESIZE, increment) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to increment file size") done: diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index da47e45..dfc1441 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -118,7 +118,7 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the file information */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_INFO, type, &finfo2) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_INFO, type, &finfo2) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") /* Copy the compatible fields into the older struct */ @@ -157,7 +157,7 @@ H5Fis_hdf5(const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "no file name specified") /* Check if file is accessible */ - if(H5VL_file_specific(NULL, NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5P_FILE_ACCESS_DEFAULT, name, &ret_value) < 0) + if(H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5P_FILE_ACCESS_DEFAULT, name, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, (-1), "unable to determine if file is accessible as HDF5") done: @@ -225,7 +225,7 @@ H5Fset_latest_format(hid_t file_id, hbool_t latest_format) low = H5F_LIBVER_EARLIEST; /* Set the library's version bounds */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds") done: diff --git a/src/H5Fint.c b/src/H5Fint.c index 0e35bea..fe387a5 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -3529,14 +3529,8 @@ H5F_get_file_id(hid_t obj_id, H5I_type_t type) if(NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Get the file through the VOL */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_GET_FILE, type, &file) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FILE, type, &file) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file") if(NULL == file) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file through the VOL") @@ -3547,6 +3541,11 @@ H5F_get_file_id(hid_t obj_id, H5I_type_t type) /* If the ID does not exist, register it with the VOL plugin */ if(H5I_INVALID_HID == ret_value) { + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + { void *vol_wrap_ctx = NULL; /* Object wrapping context */ diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 0e3c06d..4a67cc2 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -443,7 +443,6 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) H5VL_object_t *child_vol_obj = NULL; /* Child object */ H5I_type_t loc_type; /* ID type of location */ H5I_type_t child_type; /* ID type of child */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -482,21 +481,11 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) if(loc_vol_obj->plugin->cls->value != child_vol_obj->plugin->cls->value) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL plugin") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(loc_vol_obj->data, loc_vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Perform the mount operation */ - if(H5VL_file_specific(loc_vol_obj->data, loc_vol_obj->plugin->cls, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, loc_type, name, child_vol_obj->data, plist_id) < 0) + if(H5VL_file_specific(loc_vol_obj, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_type, name, child_vol_obj->data, plist_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Fmount() */ @@ -522,7 +511,6 @@ H5Funmount(hid_t loc_id, const char *name) { H5VL_object_t *vol_obj = NULL; /* Parent object */ H5I_type_t loc_type; /* ID type of location */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -545,21 +533,11 @@ H5Funmount(hid_t loc_id, const char *name) if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Perform the unmount operation */ - if(H5VL_file_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_UNMOUNT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_type, name) < 0) + if(H5VL_file_specific(vol_obj, H5VL_FILE_UNMOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_type, name) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Funmount() */ diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index a543379..6d28f83 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -95,6 +95,14 @@ static herr_t H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +static herr_t H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req); /*********************/ @@ -1195,7 +1203,7 @@ H5VLattr_get(void *obj, hid_t plugin_id, H5VL_attr_get_t get_type, hid_t dxpl_id /* Call the corresponding internal VOL routine */ if(H5VL__attr_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to get attribute information") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to get attribute information") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -1227,7 +1235,7 @@ H5VL__attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t /* Call the corresponding VOL callback */ if((ret_value = (cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1264,7 +1272,7 @@ H5VL_attr_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, va_start(arguments, req); arg_started = TRUE; if((ret_value = H5VL__attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback") done: /* End access to the va_list, if we started it */ @@ -1308,7 +1316,7 @@ H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, /* Call the corresponding internal VOL routine */ if((ret_value = H5VL__attr_specific(obj, loc_params, cls, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -1339,7 +1347,7 @@ H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, /* Call the corresponding VOL callback */ if((cls->attr_cls.optional)(obj, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1375,7 +1383,7 @@ H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) va_start(arguments, req); arg_started = TRUE; if(H5VL__attr_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") done: /* End access to the va_list, if we started it */ @@ -1417,7 +1425,7 @@ H5VLattr_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list /* Call the corresponding internal VOL routine */ if(H5VL__attr_optional(obj, cls, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -2041,7 +2049,7 @@ H5VLdataset_get(void *obj, hid_t plugin_id, H5VL_dataset_get_t get_type, /* Call the corresponding internal VOL routine */ if(H5VL__dataset_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute dataset get callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute dataset get callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -2214,7 +2222,7 @@ H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, /* Call the corresponding VOL callback */ /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 1) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -2387,6 +2395,9 @@ done: * * Purpose: Creates a file through the VOL * + * Note: Does not have a 'static' version of the routine, since there's + * no objects in the container before this operation completes. + * * Return: Success: Pointer to new file * Failure: NULL * @@ -2459,6 +2470,9 @@ done: * * Purpose: Opens a file through the VOL. * + * Note: Does not have a 'static' version of the routine, since there's + * no objects in the container before this operation completes. + * * Return: Success: Pointer to file. * Failure: NULL * @@ -2527,6 +2541,37 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__file_get + * + * Purpose: Get specific information about the file through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file get' method") + + /* Call the corresponding VOL callback */ + if((cls->file_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_get() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_file_get * * Purpose: Get specific information about the file through the VOL @@ -2537,30 +2582,36 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_get(void *file, const H5VL_class_t *cls, H5VL_file_get_t get_type, +H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->file_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file get' method") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((cls->file_cls.get)(file, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + if(H5VL__file_get(vol_obj->data, vol_obj->plugin->cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed") done: /* End access to the va_list, if we started it */ if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_get() */ @@ -2576,28 +2627,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_get(void *file, hid_t plugin_id, H5VL_file_get_t get_type, +H5VLfile_get(void *obj, hid_t plugin_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVgi**xx", file, plugin_id, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVgi**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); /* Check args and get class pointer */ - if(NULL == file) + if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->file_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `file get' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->file_cls.get)(file, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute file get callback") + /* Call the corresponding internal VOL routine */ + if(H5VL__file_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute file get callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -2605,9 +2652,40 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__file_specific + * + * Purpose: Perform File specific operations through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file specific' method") + + /* Call the corresponding VOL callback */ + if((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_specific() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_file_specific * - * Purpose: perform File specific operations through the VOL + * Purpose: Perform File specific operations through the VOL * * Return: Success: Non-negative * Failure: Negative @@ -2615,28 +2693,34 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_specific(void *file, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, +H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...) { + const H5VL_class_t *cls; /* VOL plugin's class struct */ va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) + /* Start access to the varargs, so they are available in all situations below */ + va_start(arguments, req); + arg_started = TRUE; + /* Special treatment of file access check */ if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { H5P_genplist_t *plist; /* Property list pointer */ H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ va_list tmp_args; /* argument list passed from the API call */ - hid_t fapl_id; + hid_t fapl_id; /* File access property list for accessing the file */ - /* Get the file access property list */ - va_start(tmp_args, req); + /* Get the file access property list to access the file */ + va_copy(tmp_args, arguments); fapl_id = va_arg(tmp_args, hid_t); va_end(tmp_args); - /* Get the VOL info from the fapl */ + /* Get the VOL info from the FAPL */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a file access property list") if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) @@ -2645,30 +2729,34 @@ H5VL_file_specific(void *file, const H5VL_class_t *cls, H5VL_file_specific_t spe /* Get class pointer */ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - /* Call the corresponding VOL callback */ - va_start(arguments, req); - arg_started = TRUE; - if((cls->file_cls.specific)(file, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") } /* end if */ + /* Set wrapper info in API context, for all other operations */ else { - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->file_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file specific' method") - - /* Call the corresponding VOL callback */ - va_start(arguments, req); - arg_started = TRUE; - if((cls->file_cls.specific)(file, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + /* Sanity check */ + HDassert(vol_obj); + + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Set the VOL plugin class pointer */ + cls = vol_obj->plugin->cls; } /* end else */ + + /* Call the corresponding internal VOL routine */ + if(H5VL__file_specific(vol_obj ? vol_obj->data : NULL, cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + done: /* End access to the va_list, if we started it */ if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_specific() */ @@ -2678,69 +2766,72 @@ done: * * Purpose: Performs a plugin-specific operation on a file * + * Note: The 'obj' parameter is allowed to be NULL + * * Return: Success: Non-negative * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VLfile_specific(void *file, hid_t plugin_id, H5VL_file_specific_t specific_type, +H5VLfile_specific(void *obj, hid_t plugin_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVhi**xx", file, plugin_id, specific_type, dxpl_id, req, + H5TRACE6("e", "*xiVhi**xx", obj, plugin_id, specific_type, dxpl_id, req, arguments); - /* Special treatment of file access check */ - if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { - H5P_genplist_t *plist; /* Property list pointer */ - H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ - hid_t fapl_id; + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - fapl_id = va_arg(arguments, hid_t); + /* Call the corresponding internal VOL routine */ + if(H5VL__file_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file specific callback") - /* Get the VOL info from the fapl */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL plugin info") +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLfile_specific() */ - /* Get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + +/*------------------------------------------------------------------------- + * Function: H5VL__file_optional + * + * Purpose: Perform a plugin specific operation + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->file_cls.specific)(file, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") - } /* end if */ - else { - /* Check args and get class pointer */ - if(NULL == file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->file_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `file specific' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->file_cls.specific)(file, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute file specific callback") - } /* end else */ + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file optional' method") + + /* Call the corresponding VOL callback */ + if((cls->file_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed") done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLfile_specific() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_optional() */ /*------------------------------------------------------------------------- * Function: H5VL_file_optional * - * Purpose: perform a plugin specific operation + * Purpose: Perform a plugin specific operation * * Return: Success: Non-negative * Failure: Negative @@ -2748,23 +2839,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_optional(void *file, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, ...) +H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->file_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file optional' method") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((cls->file_cls.optional)(file, dxpl_id, req, arguments) < 0) + if(H5VL__file_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed") done: @@ -2772,6 +2864,10 @@ done: if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_optional() */ @@ -2787,28 +2883,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_optional(void *file, hid_t plugin_id, hid_t dxpl_id, void **req, +H5VLfile_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", file, plugin_id, dxpl_id, req, arguments); + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); /* Check args and get class pointer */ - if(NULL == file) + if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->file_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `file optional' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->file_cls.optional)(file, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute file optional callback") + /* Call the corresponding internal VOL routine */ + if(H5VL__file_optional(obj, cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -2816,7 +2908,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_file_close + * Function: H5VL__file_close * * Purpose: Closes a file through the VOL * @@ -2825,14 +2917,15 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5VL_file_close(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +static herr_t +H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC - HDassert(file); + /* Sanity check */ + HDassert(obj); HDassert(cls); /* Check if the corresponding VOL callback exists */ @@ -2840,11 +2933,47 @@ H5VL_file_close(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file close' method") /* Call the corresponding VOL callback */ - if((cls->file_cls.close)(file, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "close failed") + if((cls->file_cls.close)(obj, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "file close failed") done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_close + * + * Purpose: Closes a file through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__file_close(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "file close failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_close() */ @@ -2859,22 +2988,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_close(void *file, hid_t plugin_id, hid_t dxpl_id, void **req) +H5VLfile_close(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xii**x", file, plugin_id, dxpl_id, req); + H5TRACE4("e", "*xii**x", obj, plugin_id, dxpl_id, req); /* Check args and get class pointer */ - if(NULL == file) + if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(H5VL_file_close(file, cls, dxpl_id, req) < 0) + if(H5VL__file_close(obj, cls, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "unable to close file") done: @@ -3087,7 +3216,7 @@ H5VLgroup_get(void *obj, hid_t plugin_id, H5VL_group_get_t get_type, /* Bypass the H5VLint layer, calling the VOL callback directly */ if((cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute group get callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute group get callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -3122,7 +3251,7 @@ H5VL_group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t sp va_start(arguments, req); arg_started = TRUE; if((cls->group_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") done: /* End access to the va_list, if we started it */ @@ -3166,7 +3295,7 @@ H5VLgroup_specific(void *obj, hid_t plugin_id, H5VL_group_specific_t specific_ty /* Bypass the H5VLint layer, calling the VOL callback directly */ if((cls->group_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -3201,7 +3330,7 @@ H5VL_group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, va_start(arguments, req); arg_started = TRUE; if((cls->group_cls.optional)(obj, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") done: /* End access to the va_list, if we started it */ @@ -3243,7 +3372,7 @@ H5VLgroup_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_lis /* Bypass the H5VLint layer, calling the VOL callback directly */ if((cls->group_cls.optional)(obj, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -3595,7 +3724,7 @@ H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_link /* Bypass the H5VLint layer, calling the VOL callback directly */ if((cls->link_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute link get callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute link get callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -3630,7 +3759,7 @@ H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t * va_start(arguments, req); arg_started = TRUE; if((ret_value = (cls->link_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback") done: /* End access to the va_list, if we started it */ @@ -3674,7 +3803,7 @@ H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, /* Bypass the H5VLint layer, calling the VOL callback directly */ if((ret_value = (cls->link_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -3709,7 +3838,7 @@ H5VL_link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, va_start(arguments, req); arg_started = TRUE; if((cls->link_cls.optional)(obj, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") done: /* End access to the va_list, if we started it */ @@ -3751,7 +3880,7 @@ H5VLlink_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list /* Bypass the H5VLint layer, calling the VOL callback directly */ if((cls->link_cls.optional)(obj, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -3975,7 +4104,7 @@ H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_ob /* Bypass the H5VLint layer, calling the VOL callback directly */ if((cls->object_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute object get callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute object get callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -4054,7 +4183,7 @@ H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, /* Bypass the H5VLint layer, calling the VOL callback directly */ if((ret_value = (cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object specific callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -4089,7 +4218,7 @@ H5VL_object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, va_start(arguments, req); arg_started = TRUE; if((cls->object_cls.optional)(obj, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") done: /* End access to the va_list, if we started it */ @@ -4131,7 +4260,7 @@ H5VLobject_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_li /* Bypass the H5VLint layer, calling the VOL callback directly */ if((cls->object_cls.optional)(obj, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -4345,7 +4474,7 @@ H5VLdatatype_get(void *obj, hid_t plugin_id, H5VL_datatype_get_t get_type, /* Bypass the H5VLint layer, calling the VOL callback directly */ if((cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute datatype get callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute datatype get callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -4380,7 +4509,7 @@ H5VL_datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specifi va_start(arguments, req); arg_started = TRUE; if((cls->datatype_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") done: /* End access to the va_list, if we started it */ @@ -4424,7 +4553,7 @@ H5VLdatatype_specific(void *obj, hid_t plugin_id, H5VL_datatype_specific_t speci /* Bypass the H5VLint layer, calling the VOL callback directly */ if((cls->datatype_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -4459,7 +4588,7 @@ H5VL_datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, va_start(arguments, req); arg_started = TRUE; if((cls->datatype_cls.optional)(obj, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") done: /* End access to the va_list, if we started it */ @@ -4502,7 +4631,7 @@ H5VLdatatype_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, /* Bypass the H5VLint layer, calling the VOL callback directly */ if((cls->datatype_cls.optional)(obj, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") done: FUNC_LEAVE_API_NOINIT(ret_value) diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 51d99b4..1e91523 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -125,10 +125,10 @@ H5_DLL herr_t H5VL_dataset_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, vo /* File functions */ H5_DLL void *H5VL_file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); H5_DLL void *H5VL_file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_file_get(void *file, const H5VL_class_t *cls, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_file_close(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* Group functions */ H5_DLL void *H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); diff --git a/test/tfile.c b/test/tfile.c index f7ac243..e342da0 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1600,6 +1600,7 @@ test_file_is_accessible(void) { hid_t fid; /* File opened with read-write permission */ hid_t fcpl_id; /* File creation property list */ + hid_t fapl = -1; /* File access property list */ int fd; /* POSIX file descriptor */ ssize_t nbytes; /* Number of bytes written */ unsigned u; /* Local index variable */ @@ -1610,8 +1611,12 @@ test_file_is_accessible(void) /* Output message about test being performed */ MESSAGE(5, ("Testing Detection of HDF5 Files\n")); + /* Get FAPL */ + fapl = h5_fileaccess(); + CHECK(fapl, FAIL, "H5Pcreate"); + /* Create a file */ - fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid, FAIL, "H5Fcreate"); /* Close file */ @@ -1619,7 +1624,7 @@ test_file_is_accessible(void) CHECK(ret, FAIL, "H5Fclose"); /* Verify that the file is an HDF5 file */ - status = H5Fis_accessible(FILE1, H5P_DEFAULT); + status = H5Fis_accessible(FILE1, fapl); VERIFY(status, TRUE, "H5Fis_accessible"); @@ -1631,7 +1636,7 @@ test_file_is_accessible(void) CHECK(ret, FAIL, "H5Pset_userblock"); /* Create file with non-default user block */ - fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl_id, fapl); CHECK(fid, FAIL, "H5Fcreate"); /* Release file-creation property list */ @@ -1643,7 +1648,7 @@ test_file_is_accessible(void) CHECK(ret, FAIL, "H5Fclose"); /* Verify that the file is an HDF5 file */ - status = H5Fis_accessible(FILE1, H5P_DEFAULT); + status = H5Fis_accessible(FILE1, fapl); VERIFY(status, TRUE, "H5Fis_accessible"); @@ -1664,9 +1669,13 @@ test_file_is_accessible(void) CHECK(ret, FAIL, "HDclose"); /* Verify that the file is not an HDF5 file */ - status = H5Fis_accessible(FILE1, H5P_DEFAULT); + status = H5Fis_accessible(FILE1, fapl); VERIFY(status, FALSE, "H5Fis_accessible"); + /* Close property list */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + } /* end test_file_is_accessible() */ @@ -1683,6 +1692,7 @@ test_file_ishdf5(void) { hid_t file; /* File opened with read-write permission */ hid_t fcpl; /* File creation property list */ + hid_t fapl = -1; /* File access property list */ int fd; /* File Descriptor */ ssize_t nbytes; /* Number of bytes written */ unsigned u; /* Local index variable */ @@ -1693,8 +1703,12 @@ test_file_ishdf5(void) /* Output message about test being performed */ MESSAGE(5, ("Testing Detection of HDF5 Files (using deprecated H5Fis_hdf5() call)\n")); + /* Get FAPL */ + fapl = h5_fileaccess(); + CHECK(fapl, FAIL, "H5Pcreate"); + /* Create a file */ - file = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + file = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(file, FAIL, "H5Fcreate"); /* Close file */ @@ -1714,7 +1728,7 @@ test_file_ishdf5(void) CHECK(ret, FAIL, "H5Pset_userblock"); /* Create file with non-default user block */ - file = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT); + file = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); CHECK(file, FAIL, "H5Fcreate"); /* Release file-creation property list */ @@ -1750,6 +1764,10 @@ test_file_ishdf5(void) status = H5Fis_hdf5(FILE1); VERIFY(status, FALSE, "H5Fis_hdf5"); + /* Close property list */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + } /* end test_file_ishdf5() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -2240,10 +2258,8 @@ test_file_double_file_dataset_open(hbool_t new_format) MESSAGE(5, ("Testing double file and dataset open/close\n")); /* Setting up test file */ - - fapl = H5Pcreate(H5P_FILE_ACCESS); + fapl = h5_fileaccess(); CHECK(fapl, FAIL, "H5Pcreate"); - if(new_format) { ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); CHECK(ret, FAIL, "H5Pset_libver_bounds"); |