diff options
Diffstat (limited to 'src/H5F.c')
-rw-r--r-- | src/H5F.c | 101 |
1 files changed, 47 insertions, 54 deletions
@@ -51,7 +51,6 @@ /********************/ - /*********************/ /* Package Variables */ /*********************/ @@ -188,7 +187,7 @@ H5Fget_create_plist(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") if(H5VL_file_get(obj->vol_obj, obj->vol_info->vol_cls, H5VL_FILE_GET_FCPL, - H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) + H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file creation properties") done: @@ -232,7 +231,7 @@ H5Fget_access_plist(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") if(H5VL_file_get(file->vol_obj, file->vol_info->vol_cls, H5VL_FILE_GET_FAPL, - H5AC_dxpl_id, H5_REQUEST_NULL, &fapl_id) < 0) + H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, &fapl_id) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file creation properties") ret_value = fapl_id; @@ -300,7 +299,7 @@ H5Fget_obj_count(hid_t file_id, unsigned types) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file id") if(H5VL_file_get(obj->vol_obj, obj->vol_info->vol_cls, H5VL_FILE_GET_OBJ_COUNT, - H5AC_dxpl_id, H5_REQUEST_NULL, types, &ret_value) < 0) + H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, types, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object count in file(s)") } /* iterate over all open files and get the obj count for each */ @@ -408,7 +407,7 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") if(H5VL_file_get(obj->vol_obj, obj->vol_info->vol_cls, H5VL_FILE_GET_OBJ_IDS, - H5AC_dxpl_id, H5_REQUEST_NULL, types, max_objs, oid_list, &ret_value) < 0) + H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, types, max_objs, oid_list, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object count in file(s)") } /* iterate over all open files and get the obj count for each */ @@ -478,8 +477,8 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle) if(NULL == (obj = (H5VL_object_t *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL, - H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl) < 0) + if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id, + H5_REQUEST_NULL, H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file handle") done: @@ -521,7 +520,7 @@ H5Fis_accessible(const char *name, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") /* Call into the VOL to check if file is accessible */ - if(H5VL_file_specific(NULL, NULL, H5VL_FILE_IS_ACCESSIBLE, H5AC_dxpl_id, + if(H5VL_file_specific(NULL, NULL, H5VL_FILE_IS_ACCESSIBLE, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, fapl_id, name, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file handle") @@ -564,7 +563,8 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) H5P_genplist_t *plist; /* Property list pointer */ H5VL_class_t *vol_cls = NULL; /* VOL Class structure for callback info */ H5VL_t *vol_info = NULL; /* VOL info struct */ - H5VL_plugin_prop_t plugin_prop; /* Property for vol plugin ID & info */ + H5VL_plugin_prop_t plugin_prop; /* Property for vol plugin ID & info */ + hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* return value */ FUNC_ENTER_API(FAIL) @@ -589,12 +589,9 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file create property list") - /* Check the file access property list */ - if(H5P_DEFAULT == fapl_id) - fapl_id = H5P_FILE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id, H5I_INVALID_HID, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* get the VOL info from the fapl */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) @@ -608,7 +605,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* create a new file or truncate an existing file through the VOL */ if(NULL == (file = H5VL_file_create(vol_cls, filename, flags, fcpl_id, fapl_id, - H5AC_dxpl_id, H5_REQUEST_NULL))) + dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file") /* setup VOL info struct */ @@ -676,6 +673,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) H5VL_plugin_prop_t plugin_prop; /* Property for vol plugin ID & info */ H5VL_class_t *vol_cls = NULL; /* VOL Class structure for callback info */ H5VL_t *vol_info = NULL; /* VOL info struct */ + hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* return value */ FUNC_ENTER_API(FAIL) @@ -688,11 +686,10 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) if((flags & ~H5F_ACC_PUBLIC_FLAGS) || (flags & H5F_ACC_TRUNC) || (flags & H5F_ACC_EXCL)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags") - if(H5P_DEFAULT == fapl_id) - fapl_id = H5P_FILE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id, H5I_INVALID_HID, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* get the VOL info from the fapl */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) @@ -704,7 +701,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Open the file through the VOL layer */ - if(NULL == (file = H5VL_file_open(vol_cls, filename, flags, fapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) + if(NULL == (file = H5VL_file_open(vol_cls, filename, flags, fapl_id, dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file") /* setup VOL info struct */ @@ -758,8 +755,8 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) if(NULL == (obj = H5VL_get_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_specific(obj->vol_obj, obj->vol_info->vol_cls, H5VL_FILE_FLUSH, H5AC_dxpl_id, - H5_REQUEST_NULL, obj_type, scope) < 0) + if(H5VL_file_specific(obj->vol_obj, obj->vol_info->vol_cls, H5VL_FILE_FLUSH, + H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, obj_type, scope) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file") done: @@ -833,7 +830,7 @@ H5F_close_file(void *_file) /* Close the file through the VOL*/ if((ret_value = H5VL_file_close(file->vol_obj, file->vol_info->vol_cls, - H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) + H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") /* free file */ @@ -860,10 +857,6 @@ done: * Programmer: Robb Matzke * Friday, October 16, 1998 * - * Modifications: - * Quincey Koziol, May 14, 2002 - * Keep old file's read/write intent in reopened file. - * *------------------------------------------------------------------------- */ hid_t @@ -877,19 +870,19 @@ H5Freopen(hid_t file_id) H5TRACE1("i", "i", file_id); /* get the file object */ - if(NULL == (obj = (H5VL_object_t *)H5I_object(file_id))) + if(NULL == (obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL, - H5VL_FILE_REOPEN, &file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") + if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id, + H5_REQUEST_NULL, H5VL_FILE_REOPEN, &file) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") if (NULL == file) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") /* Get an atom for the file */ if((ret_value = H5VL_register_id(H5I_FILE, file, obj->vol_info, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") done: FUNC_LEAVE_API(ret_value) @@ -926,7 +919,7 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") if((ret_value = H5VL_file_get(obj->vol_obj, obj->vol_info->vol_cls, H5VL_FILE_GET_INTENT, - H5AC_dxpl_id, H5_REQUEST_NULL, intent_flags)) < 0) + H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, intent_flags)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file intent") } @@ -962,8 +955,8 @@ H5Fget_freespace(hid_t file_id) if(NULL == (obj = (H5VL_object_t *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL, - H5VL_FILE_GET_FREE_SPACE, &ret_value) < 0) + if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id, + H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SPACE, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file free space") done: @@ -1000,8 +993,8 @@ H5Fget_filesize(hid_t file_id, hsize_t *size) if(NULL == (file = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL, - H5VL_FILE_GET_SIZE, size) < 0) + if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_ind_read_dxpl_id, + H5_REQUEST_NULL, H5VL_FILE_GET_SIZE, size) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file size") done: @@ -1064,7 +1057,7 @@ H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* get image through the VOL */ - if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL, + if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, H5VL_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file image") @@ -1108,8 +1101,8 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) if(NULL == (obj = (H5VL_object_t *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL, - H5VL_FILE_GET_MDC_CONF, config_ptr) < 0) + if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id, + H5_REQUEST_NULL, H5VL_FILE_GET_MDC_CONF, config_ptr) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get mdc configuration") done: @@ -1145,8 +1138,8 @@ H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) if(NULL == (obj = (H5VL_object_t *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL, - H5VL_FILE_SET_MDC_CONFIG, config_ptr) < 0) + if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id, + H5_REQUEST_NULL, H5VL_FILE_SET_MDC_CONFIG, config_ptr) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "uanvle to set MDC configuration") done: @@ -1186,8 +1179,8 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr) if(NULL == hit_rate_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer") - if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL, - H5VL_FILE_GET_MDC_HR, hit_rate_ptr) < 0) + if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_ind_read_dxpl_id, + H5_REQUEST_NULL, H5VL_FILE_GET_MDC_HR, hit_rate_ptr) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get MDC hit rate") done: @@ -1227,7 +1220,7 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, if(NULL == (file = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_dxpl_id, + if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_ind_read_dxpl_id, 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_INTERNAL, H5E_CANTGET, FAIL, "unable to get MDC size") @@ -1270,8 +1263,8 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id) if(NULL == (obj = (H5VL_object_t *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL, - H5VL_FILE_RESET_MDC_HIT_RATE) < 0) + if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id, + H5_REQUEST_NULL, H5VL_FILE_RESET_MDC_HIT_RATE) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't reset cache hit rate") done: @@ -1322,7 +1315,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") if(H5VL_file_get(obj->vol_obj, obj->vol_info->vol_cls, H5VL_FILE_GET_NAME, - H5AC_dxpl_id, H5_REQUEST_NULL, type, size, name, &ret_value) < 0) + H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, type, size, name, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file name") done: @@ -1371,7 +1364,7 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) if(NULL == (obj = H5VL_get_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, H5VL_FILE_GET_INFO, type, finfo) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file info") @@ -1411,7 +1404,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, if(sect_info && nsects == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "nsects must be > 0") - if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, type, nsects) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file free sections") done: @@ -1446,8 +1439,8 @@ H5Fclear_elink_file_cache(hid_t file_id) if(NULL == (file = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL, - H5VL_FILE_CLEAR_ELINK_CACHE) < 0) + if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_ind_read_dxpl_id, + H5_REQUEST_NULL, H5VL_FILE_CLEAR_ELINK_CACHE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") done: |