diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Adeprec.c | 7 | ||||
-rw-r--r-- | src/H5D.c | 14 | ||||
-rw-r--r-- | src/H5F.c | 60 | ||||
-rw-r--r-- | src/H5Ftest.c | 14 | ||||
-rw-r--r-- | src/H5G.c | 14 | ||||
-rw-r--r-- | src/H5Gloc.c | 8 | ||||
-rw-r--r-- | src/H5I.c | 94 | ||||
-rw-r--r-- | src/H5Iprivate.h | 8 | ||||
-rw-r--r-- | src/H5Ipublic.h | 2 | ||||
-rw-r--r-- | src/H5L.c | 9 | ||||
-rw-r--r-- | src/H5O.c | 26 | ||||
-rw-r--r-- | src/H5VL.c | 171 | ||||
-rw-r--r-- | src/H5VLnative.c | 386 | ||||
-rw-r--r-- | src/H5VLprivate.h | 6 | ||||
-rw-r--r-- | src/H5VLpublic.h | 58 |
15 files changed, 433 insertions, 444 deletions
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 75f644f..8c3801a 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -47,6 +47,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ #include "H5Opkg.h" /* Object headers */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -306,7 +307,7 @@ H5Aget_num_attrs(hid_t id) { H5O_loc_t *loc; /* Object location for attribute */ void *obj; - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ hid_t loc_id; H5I_type_t id_type; int ret_value; @@ -321,8 +322,8 @@ H5Aget_num_attrs(hid_t id) that needs to go through the VOL actually go through the VOL*/ if (H5I_FILE_PUBLIC == id_type || H5I_GROUP_PUBLIC == id_type || H5I_DATASET_PUBLIC == id_type || H5I_DATATYPE_PUBLIC == id_type || - H5I_ATTRIBUTE_PUBLIC == id_type) { - if(NULL == (uid_info = (H5I_t *)H5I_object(id))) + H5I_ATTR_PUBLIC == id_type) { + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(id))) HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, NULL, "invalid user identifier") loc_id = uid_info->obj_id; } @@ -333,7 +333,7 @@ H5Dget_space(hid_t dset_id) H5TRACE1("i", "i", dset_id); /* get the dataspace through the VOL */ - if(H5VL_dataset_get(dset_id, H5D_GET_SPACE, 1, &ret_value) < 0) + if(H5VL_dataset_get(dset_id, H5VL_DATASET_GET_SPACE, 1, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get data space") done: FUNC_LEAVE_API(ret_value) @@ -363,7 +363,7 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation) H5TRACE2("e", "i*Ds", dset_id, allocation); /* Read data space address through the VOL and return */ - if((ret_value=H5VL_dataset_get(dset_id, H5D_GET_SPACE_STATUS, 1, allocation)) < 0) + if((ret_value=H5VL_dataset_get(dset_id, H5VL_DATASET_GET_SPACE_STATUS, 1, allocation)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get space status") done: @@ -396,7 +396,7 @@ H5Dget_type(hid_t dset_id) H5TRACE1("i", "i", dset_id); /* get the datatype through the VOL */ - if(H5VL_dataset_get(dset_id, H5D_GET_TYPE, 1, &ret_value) < 0) + if(H5VL_dataset_get(dset_id, H5VL_DATASET_GET_TYPE, 1, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get datatype") done: @@ -428,7 +428,7 @@ H5Dget_create_plist(hid_t dset_id) FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", dset_id); - if(H5VL_dataset_get(dset_id, H5D_GET_DCPL, 1, &ret_value) < 0) + if(H5VL_dataset_get(dset_id, H5VL_DATASET_GET_DCPL, 1, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get dataset creation properties") done: @@ -477,7 +477,7 @@ H5Dget_access_plist(hid_t dset_id) FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", dset_id); - if(H5VL_dataset_get(dset_id, H5D_GET_DAPL, 1, &ret_value) < 0) + if(H5VL_dataset_get(dset_id, H5VL_DATASET_GET_DAPL, 1, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get dataset access properties") done: @@ -512,7 +512,7 @@ H5Dget_storage_size(hid_t dset_id) H5TRACE1("h", "i", dset_id); /* get storage size through the VOL */ - if(H5VL_dataset_get(dset_id, H5D_GET_STORAGE_SIZE, 1, &ret_value) < 0) + if(H5VL_dataset_get(dset_id, H5VL_DATASET_GET_STORAGE_SIZE, 1, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get storage size") done: @@ -543,7 +543,7 @@ H5Dget_offset(hid_t dset_id) H5TRACE1("a", "i", dset_id); /* get offset through the VOL */ - if(H5VL_dataset_get(dset_id, H5D_GET_OFFSET, 1, &ret_value) < 0) + if(H5VL_dataset_get(dset_id, H5VL_DATASET_GET_OFFSET, 1, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get offset") done: @@ -36,8 +36,8 @@ #include "H5Tprivate.h" /* Datatypes */ #include "H5VLprivate.h" /* VOL plugins */ -/* Declare a free list to manage the H5I_t struct */ -H5FL_DEFINE_STATIC(H5I_t); +/* Declare a free list to manage the H5VL_id_wrapper_t struct */ +H5FL_DEFINE_STATIC(H5VL_id_wrapper_t); /* Struct only used by functions H5F_get_objects and H5F_get_objects_cb */ typedef struct H5F_olist_t { @@ -193,7 +193,7 @@ H5Fget_create_plist(hid_t uid) FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", uid); - if(H5VL_file_get(uid, H5F_GET_FCPL, 1, &ret_value) < 0) + if(H5VL_file_get(uid, H5VL_FILE_GET_FCPL, 1, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file creation properties") done: @@ -230,7 +230,7 @@ H5Fget_access_plist(hid_t uid) FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", uid); - if(H5VL_file_get(uid, H5F_GET_FAPL, 1, &ret_value) < 0) + if(H5VL_file_get(uid, H5VL_FILE_GET_FAPL, 1, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file creation properties") done: @@ -370,7 +370,7 @@ ssize_t H5Fget_obj_count(hid_t uid, unsigned types) { H5F_t *f = NULL; /* File to query */ - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ hid_t id; ssize_t ret_value; /* Return value */ @@ -378,7 +378,7 @@ H5Fget_obj_count(hid_t uid, unsigned types) H5TRACE2("Zs", "iIu", uid, types); if (H5I_FILE_PUBLIC == H5I_get_type(uid)) { - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") id = uid_info->obj_id; } @@ -455,7 +455,7 @@ ssize_t H5Fget_obj_ids(hid_t uid, unsigned types, size_t max_objs, hid_t *oid_list) { H5F_t *f = NULL; /* File to query */ - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ hid_t id; ssize_t ret_value; /* Return value */ @@ -463,7 +463,7 @@ H5Fget_obj_ids(hid_t uid, unsigned types, size_t max_objs, hid_t *oid_list) H5TRACE4("Zs", "iIuz*i", uid, types, max_objs, oid_list); if (H5I_FILE_PUBLIC == H5I_get_type(uid)) { - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") id = uid_info->obj_id; } @@ -752,7 +752,7 @@ H5Fget_vfd_handle(hid_t uid, hid_t fapl, void **file_handle) if(!file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file handle pointer") - if((ret_value = H5VL_file_get(uid, H5F_GET_VFD_HANDLE, 2, file_handle, fapl)) < 0) + if((ret_value = H5VL_file_get(uid, H5VL_FILE_GET_VFD_HANDLE, 2, file_handle, fapl)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file handle") done: @@ -1902,7 +1902,7 @@ H5Freopen(hid_t uid) { H5F_t *old_file = NULL; H5F_t *new_file = NULL; - H5I_t *uid_info, *new_uid_info; + H5VL_id_wrapper_t *uid_info, *new_uid_info; hid_t file_id, new_file_id, ret_value; FUNC_ENTER_API(FAIL) @@ -1911,7 +1911,7 @@ H5Freopen(hid_t uid) /* Get the file */ if(H5I_FILE_PUBLIC != H5I_get_type(uid)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a user ID") - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") file_id = uid_info->obj_id; @@ -1938,7 +1938,7 @@ H5Freopen(hid_t uid) new_file->file_id = new_file_id; #if 1 /*MSC - This needs to go through the VOL */ - if(NULL == (new_uid_info = H5FL_MALLOC(H5I_t))) + if(NULL == (new_uid_info = H5FL_MALLOC(H5VL_id_wrapper_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") new_uid_info->obj_id = new_file_id; new_uid_info->vol_plugin = uid_info->vol_plugin; @@ -1979,7 +1979,7 @@ H5Fget_intent(hid_t uid, unsigned *intent_flags) /* If no intent flags were passed in, exit quietly */ if(intent_flags) { - if((ret_value = H5VL_file_get(uid, H5F_GET_INTENT, 1, intent_flags)) < 0) + if((ret_value = H5VL_file_get(uid, H5VL_FILE_GET_INTENT, 1, intent_flags)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file intent") } @@ -2011,13 +2011,13 @@ H5F_get_id(H5F_t *file, hbool_t app_ref) HDassert(file); if(file->file_id == -1) { - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ /* Get an atom for the file */ if((file->file_id = H5I_register(H5I_FILE, file, app_ref)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file") /* Create a new id that points to a struct that holds the file id and the VOL id */ - if(NULL == (uid_info = H5FL_MALLOC(H5I_t))) + if(NULL == (uid_info = H5FL_MALLOC(H5VL_id_wrapper_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") uid_info->obj_id = file->file_id; uid_info->vol_plugin = (H5VL_class_t *)H5I_object(file->vol_id); @@ -2402,7 +2402,7 @@ H5Fget_freespace(hid_t uid) FUNC_ENTER_API(FAIL) H5TRACE1("Hs", "i", uid); - if(H5VL_file_get(uid, H5F_GET_FREE_SPACE, 1, &ret_value) < 0) + if(H5VL_file_get(uid, H5VL_FILE_GET_FREE_SPACE, 1, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file free space") done: @@ -2436,7 +2436,7 @@ H5Fget_filesize(hid_t uid, hsize_t *size) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", uid, size); - if((ret_value = H5VL_file_get(uid, H5F_GET_SIZE, 1, size)) < 0) + if((ret_value = H5VL_file_get(uid, H5VL_FILE_GET_SIZE, 1, size)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file size") done: @@ -2474,7 +2474,7 @@ H5Fget_mdc_config(hid_t uid, H5AC_cache_config_t *config_ptr) if((NULL == config_ptr) || (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config_ptr") - if((ret_value = H5VL_file_get(uid, H5F_GET_MDC_CONF, 1, config_ptr)) < 0) + if((ret_value = H5VL_file_get(uid, H5VL_FILE_GET_MDC_CONF, 1, config_ptr)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get mdc config") done: @@ -2501,7 +2501,7 @@ herr_t H5Fset_mdc_config(hid_t uid, H5AC_cache_config_t *config_ptr) { H5F_t *file; /* File object for file ID */ - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -2509,7 +2509,7 @@ H5Fset_mdc_config(hid_t uid, H5AC_cache_config_t *config_ptr) if(H5I_FILE_PUBLIC != H5I_get_type(uid)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a user ID") - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") /* Check args */ @@ -2552,7 +2552,7 @@ H5Fget_mdc_hit_rate(hid_t uid, double *hit_rate_ptr) if(NULL == hit_rate_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer") - if((ret_value = H5VL_file_get(uid, H5F_GET_MDC_HR, 1, hit_rate_ptr)) < 0) + if((ret_value = H5VL_file_get(uid, H5VL_FILE_GET_MDC_HR, 1, hit_rate_ptr)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get MDC hit rate") done: @@ -2587,7 +2587,7 @@ H5Fget_mdc_size(hid_t uid, size_t *max_size_ptr, size_t *min_clean_size_ptr, H5TRACE5("e", "i*z*z*z*Is", uid, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr); - if((ret_value = H5VL_file_get(uid, H5F_GET_MDC_SIZE, 4, max_size_ptr, + if((ret_value = H5VL_file_get(uid, H5VL_FILE_GET_MDC_SIZE, 4, 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 hit rate") @@ -2620,7 +2620,7 @@ herr_t H5Freset_mdc_hit_rate_stats(hid_t uid) { H5F_t *file; /* File object for file ID */ - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -2628,7 +2628,7 @@ H5Freset_mdc_hit_rate_stats(hid_t uid) if(H5I_FILE_PUBLIC != H5I_get_type(uid)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a user ID") - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") /* Check args */ @@ -2677,8 +2677,8 @@ H5Fget_name(hid_t uid, char *name/*out*/, size_t size) /* MSC - temp fix to handle later when all user level ids are of type UID */ if (H5I_FILE_PUBLIC == H5I_get_type(uid) || H5I_GROUP_PUBLIC == H5I_get_type(uid) || H5I_DATATYPE_PUBLIC == H5I_get_type(uid) || H5I_DATASET_PUBLIC == H5I_get_type(uid) || - H5I_ATTRIBUTE_PUBLIC == H5I_get_type(uid)) { - if(H5VL_file_get(uid, H5F_GET_NAME, 3, name, &ret_value, size) < 0) + H5I_ATTR_PUBLIC == H5I_get_type(uid)) { + if(H5VL_file_get(uid, H5VL_FILE_GET_NAME, 3, name, &ret_value, size) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file name") } else { @@ -2746,7 +2746,7 @@ H5Fget_info2(hid_t uid, H5F_info2_t *finfo) if(!finfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - if((ret_value = H5VL_file_get(uid, H5F_GET_INFO, 1, finfo)) < 0) + if((ret_value = H5VL_file_get(uid, H5VL_FILE_GET_INFO, 1, finfo)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file info") done: FUNC_LEAVE_API(ret_value) @@ -2781,7 +2781,7 @@ H5Fget_free_sections(hid_t uid, 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_get(uid, H5F_GET_FREE_SECTIONS, 4, sect_info, &ret_value, + if(H5VL_file_get(uid, H5VL_FILE_GET_FREE_SECTIONS, 4, sect_info, &ret_value, type, nsects) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file info") done: @@ -2807,7 +2807,7 @@ herr_t H5Fclear_elink_file_cache(hid_t uid) { H5F_t *file; /* File */ - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -2816,7 +2816,7 @@ H5Fclear_elink_file_cache(hid_t uid) /* Check args */ if(H5I_FILE_PUBLIC != H5I_get_type(uid)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a user ID") - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") if(NULL == (file = (H5F_t *)H5I_object_verify(uid_info->obj_id, H5I_FILE))) diff --git a/src/H5Ftest.c b/src/H5Ftest.c index 3e33b84..b885205 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -45,7 +45,7 @@ #include "H5Gpkg.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5SMpkg.h" /* Shared object header messages */ - +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ /* Local Macros */ @@ -100,14 +100,14 @@ H5F_get_sohm_mesg_count_test(hid_t uid, unsigned type_id, size_t *mesg_count) { H5F_t *file; /* File info */ - H5I_t *uid_info; + H5VL_id_wrapper_t *uid_info; hid_t file_id; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT if (H5I_FILE_PUBLIC == H5I_get_type(uid)) { - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") file_id = uid_info->obj_id; } @@ -148,14 +148,14 @@ herr_t H5F_check_cached_stab_test(hid_t uid) { H5F_t *file; /* File info */ - H5I_t *uid_info; + H5VL_id_wrapper_t *uid_info; hid_t file_id; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT if (H5I_FILE_PUBLIC == H5I_get_type(uid)) { - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") file_id = uid_info->obj_id; } @@ -193,14 +193,14 @@ herr_t H5F_get_maxaddr_test(hid_t uid, haddr_t *maxaddr) { H5F_t *file; /* File info */ - H5I_t *uid_info; + H5VL_id_wrapper_t *uid_info; hid_t file_id; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT if (H5I_FILE_PUBLIC == H5I_get_type(uid)) { - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") file_id = uid_info->obj_id; } @@ -437,7 +437,7 @@ H5Gget_create_plist(hid_t uid) FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", uid); - if(H5VL_group_get(uid, H5G_GET_GCPL, 1, &ret_value) < 0) + if(H5VL_group_get(uid, H5VL_GROUP_GET_GCPL, 1, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group creation properties") done: @@ -477,11 +477,11 @@ H5Gget_info(hid_t loc_id, H5G_info_t *grp_info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Get the token for the Object location through the VOL */ - if(H5VL_object_lookup (loc_id, H5O_LOOKUP, 1, &location) < 0) + if(H5VL_object_lookup (loc_id, H5VL_OBJECT_LOOKUP, 1, &location) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to locate object") /* Get the group info through the VOL using the location token */ - if((ret_value = H5VL_group_get(loc_id, H5G_GET_INFO, 2, grp_info, location)) < 0) + if((ret_value = H5VL_group_get(loc_id, H5VL_GROUP_GET_INFO, 2, grp_info, location)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") done: @@ -529,11 +529,11 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Get the token for the Object location through the VOL */ - if(H5VL_object_lookup (loc_id, H5O_LOOKUP_BY_NAME, 3, &location, name, lapl_id) < 0) + if(H5VL_object_lookup (loc_id, H5VL_OBJECT_LOOKUP_BY_NAME, 3, &location, name, lapl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to locate object") /* Get the group info through the VOL using the location token */ - if((ret_value = H5VL_group_get(loc_id, H5G_GET_INFO, 2, grp_info, location)) < 0) + if((ret_value = H5VL_group_get(loc_id, H5VL_GROUP_GET_INFO, 2, grp_info, location)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") done: @@ -587,12 +587,12 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Get the token for the Object location through the VOL */ - if(H5VL_object_lookup(loc_id, H5O_LOOKUP_BY_IDX, 6, &location, group_name, + if(H5VL_object_lookup(loc_id, H5VL_OBJECT_LOOKUP_BY_IDX, 6, &location, group_name, idx_type, order, n, lapl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to locate object") /* Get the group info through the VOL using the location token */ - if((ret_value = H5VL_group_get(loc_id, H5G_GET_INFO, 2, grp_info, location)) < 0) + if((ret_value = H5VL_group_get(loc_id, H5VL_GROUP_GET_INFO, 2, grp_info, location)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") done: diff --git a/src/H5Gloc.c b/src/H5Gloc.c index b29776f..25a50fd 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -41,7 +41,7 @@ #include "H5Gpkg.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ - +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ /* Local Macros */ @@ -159,7 +159,7 @@ static herr_t H5G_loc_get_comment_cb(H5G_loc_t *grp_loc, const char *name, herr_t H5G_loc(hid_t id, H5G_loc_t *loc) { - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ hid_t loc_id; H5I_type_t id_type; herr_t ret_value = SUCCEED; /* Return value */ @@ -173,8 +173,8 @@ H5G_loc(hid_t id, H5G_loc_t *loc) that needs to go through the VOL actually go through the VOL*/ if (H5I_FILE_PUBLIC == id_type || H5I_GROUP_PUBLIC == id_type || H5I_DATASET_PUBLIC == id_type || H5I_DATATYPE_PUBLIC == id_type || - H5I_ATTRIBUTE_PUBLIC == id_type) { - if(NULL == (uid_info = (H5I_t *)H5I_object(id))) + H5I_ATTR_PUBLIC == id_type) { + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") loc_id = uid_info->obj_id; } @@ -48,6 +48,7 @@ #include "H5Ipkg.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Oprivate.h" /* Object headers */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /* Define this to compile in support for dumping ID information */ /* #define H5I_DEBUG_OUTPUT */ @@ -126,7 +127,6 @@ static H5I_type_t H5I_next_type = (H5I_type_t) H5I_NTYPES; H5FL_DEFINE_STATIC(H5I_id_info_t); /*--------------------- Local function prototypes ---------------------------*/ -static herr_t H5I_free(H5I_t *id_struct); static H5I_id_info_t *H5I_find_id(hid_t id); #ifdef H5I_DEBUG_OUTPUT static herr_t H5I_debug(H5I_type_t type); @@ -148,25 +148,7 @@ DESCRIPTION static herr_t H5I_init_interface(void) { - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Register high level file user id */ - if(H5I_register_type(H5I_FILE_PUBLIC, (size_t)H5I_FILE_PUBLIC_HASHSIZE, 0, (H5I_free_t)H5I_free)<H5I_FILE) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize interface") - /* Register high level group user id */ - if(H5I_register_type(H5I_GROUP_PUBLIC, (size_t)H5I_GROUP_PUBLIC_HASHSIZE, 0, (H5I_free_t)H5I_free)<H5I_FILE) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize interface") - /* Register high level dataset user id */ - if(H5I_register_type(H5I_DATASET_PUBLIC, (size_t)H5I_DATASET_PUBLIC_HASHSIZE, 0, (H5I_free_t)H5I_free)<H5I_FILE) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize interface") - /* Register high level attribute user id */ - if(H5I_register_type(H5I_ATTRIBUTE_PUBLIC, (size_t)H5I_ATTRIBUTE_PUBLIC_HASHSIZE, 0, (H5I_free_t)H5I_free)<H5I_FILE) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize interface") - /* Register high level datatype user id */ - if(H5I_register_type(H5I_DATATYPE_PUBLIC, (size_t)H5I_DATATYPE_PUBLIC_HASHSIZE, 0, (H5I_free_t)H5I_free)<H5I_FILE) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize interface") + FUNC_ENTER_NOAPI_NOINIT_NOERR done: FUNC_LEAVE_NOAPI(SUCCEED) @@ -223,39 +205,6 @@ H5I_term_interface(void) /*------------------------------------------------------------------------- - * Function: H5I_free - * - * Purpose: Frees the structure of a user level ID - * - * Return: Success: Non-negative - * - * Failure: Negative - * - * Programmer: Mohamad Chaarawi - * March, 2012 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -H5I_free(H5I_t *id_struct) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - /* Sanity check */ - HDassert(id_struct); - - H5MM_xfree(id_struct); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_free() */ - - -/*------------------------------------------------------------------------- * Function: H5Iregister_type * * Purpose: Public interface to H5I_register_type. Creates a new type @@ -1063,7 +1012,7 @@ void * H5I_object_verify(hid_t id, H5I_type_t id_type) { H5I_id_info_t *id_ptr = NULL; /*ptr to the new atom */ - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ void *ret_value = NULL; /*return value */ FUNC_ENTER_NOAPI(NULL) @@ -1076,8 +1025,8 @@ H5I_object_verify(hid_t id, H5I_type_t id_type) (H5I_GROUP_PUBLIC == H5I_get_type(id) && H5I_GROUP_PUBLIC != id_type) || (H5I_DATATYPE_PUBLIC == H5I_get_type(id) && H5I_DATATYPE_PUBLIC != id_type) || (H5I_DATASET_PUBLIC == H5I_get_type(id) && H5I_DATASET_PUBLIC != id_type) || - (H5I_ATTRIBUTE_PUBLIC == H5I_get_type(id) && H5I_ATTRIBUTE_PUBLIC != id_type)) { - if(NULL == (uid_info = (H5I_t *)H5I_object(id))) + (H5I_ATTR_PUBLIC == H5I_get_type(id) && H5I_ATTR_PUBLIC != id_type)) { + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") id = uid_info->obj_id; } @@ -1185,17 +1134,6 @@ H5Iremove_verify(hid_t id, H5I_type_t id_type) FUNC_ENTER_API(NULL) -#if 0 - if (H5I_FILE_PUBLIC == H5I_get_type(uid)) { - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") - id = uid_info->obj_id; - } - else { - id = uid; - } -#endif - if(H5I_IS_LIB_TYPE(id_type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") @@ -1331,7 +1269,7 @@ done: int H5Idec_ref(hid_t uid) { - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ int ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1342,7 +1280,7 @@ H5Idec_ref(hid_t uid) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") if (H5I_FILE_PUBLIC == H5I_get_type(uid) || H5I_GROUP_PUBLIC == H5I_get_type(uid)) { - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") if((ret_value = H5I_dec_app_ref(uid_info->obj_id)) < 0) @@ -1546,7 +1484,7 @@ done: int H5Iinc_ref(hid_t uid) { - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ int ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1557,7 +1495,7 @@ H5Iinc_ref(hid_t uid) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") if (H5I_FILE_PUBLIC == H5I_get_type(uid) || H5I_GROUP_PUBLIC == H5I_get_type(uid)) { - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") if((ret_value = H5I_inc_ref(uid_info->obj_id, TRUE)) < 0) @@ -2247,7 +2185,7 @@ done: hid_t H5Iget_file_id(hid_t uid) { - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ hid_t id; hid_t ret_value; /* Return value */ @@ -2256,8 +2194,8 @@ H5Iget_file_id(hid_t uid) if (H5I_FILE_PUBLIC == H5I_get_type(uid) || H5I_GROUP_PUBLIC == H5I_get_type(uid) || H5I_DATASET_PUBLIC == H5I_get_type(uid) || H5I_DATATYPE_PUBLIC == H5I_get_type(uid) || - H5I_ATTRIBUTE_PUBLIC == H5I_get_type(uid)) { - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + H5I_ATTR_PUBLIC == H5I_get_type(uid)) { + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") id = uid_info->obj_id; } @@ -2380,14 +2318,14 @@ H5I_replace_with_uids(hid_t *old_list, ssize_t num_ids) /* Only iterate through hash table if there are IDs in group */ if(type_ptr->ids > 0) { H5I_id_info_t *id_ptr; /*ptr to the new ID */ - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ unsigned i; /*counter */ /* Start at the beginning of the array */ for(i = 0; i < type_ptr->hash_size; i++) { id_ptr = type_ptr->id_list[i]; while(id_ptr) { - if(NULL == (uid_info = (H5I_t *)H5I_object(id_ptr->id))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(id_ptr->id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") if (uid_info->obj_id == old_list[j]) { old_list[j] = id_ptr->id; @@ -2446,14 +2384,14 @@ H5I_inc_ref_uid(hid_t id, hbool_t app_ref) /* Only iterate through hash table if there are IDs in group */ if(type_ptr->ids > 0) { H5I_id_info_t *id_ptr; /*ptr to the new ID */ - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ unsigned i; /*counter */ /* Start at the beginning of the array */ for(i = 0; i < type_ptr->hash_size; i++) { id_ptr = type_ptr->id_list[i]; while(id_ptr) { - if(NULL == (uid_info = (H5I_t *)H5I_object(id_ptr->id))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(id_ptr->id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") if (uid_info->obj_id == id) { /* Increment reference count on atom. */ diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h index c8bf768..07f0d5d 100644 --- a/src/H5Iprivate.h +++ b/src/H5Iprivate.h @@ -49,7 +49,7 @@ #define H5I_FILE_PUBLIC_HASHSIZE 64 #define H5I_GROUP_PUBLIC_HASHSIZE 64 #define H5I_DATASET_PUBLIC_HASHSIZE 64 -#define H5I_ATTRIBUTE_PUBLIC_HASHSIZE 64 +#define H5I_ATTR_PUBLIC_HASHSIZE 64 #define H5I_DATATYPE_PUBLIC_HASHSIZE 64 #define H5I_GENPROPCLS_HASHSIZE 64 #define H5I_GENPROPOBJ_HASHSIZE 128 @@ -57,12 +57,6 @@ #define H5I_ERRMSG_HASHSIZE 64 #define H5I_ERRSTK_HASHSIZE 64 -/* type of the ID passed to users */ -typedef struct H5I_t { - hid_t obj_id; /* actual id for object */ - H5VL_class_t *vol_plugin; /* pointer to the VOL structure */ -} H5I_t; - /* Private Functions in H5I.c */ H5_DLL H5I_type_t H5I_register_type(H5I_type_t type_id, size_t hash_size, unsigned reserved, H5I_free_t free_func); H5_DLL int H5I_nmembers(H5I_type_t type); diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h index 5416b6e..1673f60 100644 --- a/src/H5Ipublic.h +++ b/src/H5Ipublic.h @@ -48,7 +48,7 @@ typedef enum H5I_type_t { H5I_FILE_PUBLIC, /*type ID for upper level file ID objects */ H5I_GROUP_PUBLIC, /*type ID for upper level group ID objects */ H5I_DATASET_PUBLIC, /*type ID for upper level dataset ID objects */ - H5I_ATTRIBUTE_PUBLIC, /*type ID for upper level attribute ID objects */ + H5I_ATTR_PUBLIC, /*type ID for upper level attribute ID objects */ H5I_DATATYPE_PUBLIC, /*type ID for upper level datatype ID objects */ H5I_GENPROP_CLS, /*type ID for generic property list classes */ H5I_GENPROP_LST, /*type ID for generic property lists */ @@ -36,6 +36,7 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Oprivate.h" /* File objects */ #include "H5Pprivate.h" /* Property lists */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ /* Local Macros */ @@ -1154,7 +1155,7 @@ H5Literate(hid_t id, H5_index_t idx_type, H5_iter_order_t order, H5G_link_iterate_t lnk_op; /* Link operator */ hsize_t last_lnk; /* Index of last object looked at */ hsize_t idx; /* Internal location to hold index */ - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ hid_t grp_id; herr_t ret_value; /* Return value */ @@ -1168,7 +1169,7 @@ H5Literate(hid_t id, H5_index_t idx_type, H5_iter_order_t order, at some point needs to be removed once all high level operations that needs to go through the VOL actually go through the VOL*/ if (H5I_FILE_PUBLIC == id_type || H5I_GROUP_PUBLIC == id_type) { - if(NULL == (uid_info = (H5I_t *)H5I_object(id))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") grp_id = uid_info->obj_id; id_type = H5I_get_type(grp_id); @@ -1312,7 +1313,7 @@ H5Lvisit(hid_t uid, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data) { H5I_type_t id_type; /* Type of ID */ - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ hid_t grp_id; herr_t ret_value; /* Return value */ @@ -1322,7 +1323,7 @@ H5Lvisit(hid_t uid, H5_index_t idx_type, H5_iter_order_t order, id_type = H5I_get_type(uid); if (H5I_FILE_PUBLIC == id_type) { - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") grp_id = uid_info->obj_id; id_type = H5I_get_type(grp_id); @@ -241,7 +241,7 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Get the token for the Object location through the VOL */ - if(H5VL_object_lookup (loc_id, H5O_LOOKUP_BY_NAME, 3, &location, name, lapl_id) < 0) + if(H5VL_object_lookup (loc_id, H5VL_OBJECT_LOOKUP_BY_NAME, 3, &location, name, lapl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to locate object") /* Open the object through the VOL */ @@ -304,7 +304,7 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Get the token for the Object location through the VOL */ - if(H5VL_object_lookup(loc_id, H5O_LOOKUP_BY_IDX, 6, &location, group_name, + if(H5VL_object_lookup(loc_id, H5VL_OBJECT_LOOKUP_BY_IDX, 6, &location, group_name, idx_type, order, n, lapl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to locate object") @@ -367,7 +367,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) H5TRACE2("i", "ia", loc_id, addr); /* Get the token for the Object location through the VOL */ - if(H5VL_object_lookup (loc_id, H5O_LOOKUP_BY_ADDR, 2, &location, addr) < 0) + if(H5VL_object_lookup (loc_id, H5VL_OBJECT_LOOKUP_BY_ADDR, 2, &location, addr) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to locate object") /* Open the object through the VOL */ @@ -607,10 +607,10 @@ H5Oget_info(hid_t loc_id, H5O_info_t *oinfo) else { /* Get the token for the Object location through the VOL */ - if(H5VL_object_lookup (loc_id, H5O_LOOKUP, 1, &location) < 0) + if(H5VL_object_lookup (loc_id, H5VL_OBJECT_LOOKUP, 1, &location) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to locate object") /* Get the group info through the VOL using the location token */ - if((ret_value = H5VL_object_get(loc_id, H5O_GET_INFO, 2, oinfo, location)) < 0) + if((ret_value = H5VL_object_get(loc_id, H5VL_OBJECT_GET_INFO, 2, oinfo, location)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") } @@ -658,11 +658,11 @@ H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lap HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Get the token for the Object location through the VOL */ - if(H5VL_object_lookup (loc_id, H5O_LOOKUP_BY_NAME, 3, &location, name, lapl_id) < 0) + if(H5VL_object_lookup (loc_id, H5VL_OBJECT_LOOKUP_BY_NAME, 3, &location, name, lapl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to locate object") /* Get the group info through the VOL using the location token */ - if((ret_value = H5VL_object_get(loc_id, H5O_GET_INFO, 2, oinfo, location)) < 0) + if((ret_value = H5VL_object_get(loc_id, H5VL_OBJECT_GET_INFO, 2, oinfo, location)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") done: @@ -716,12 +716,12 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Get the token for the Object location through the VOL */ - if(H5VL_object_lookup(loc_id, H5O_LOOKUP_BY_IDX, 6, &location, group_name, + if(H5VL_object_lookup(loc_id, H5VL_OBJECT_LOOKUP_BY_IDX, 6, &location, group_name, idx_type, order, n, lapl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to locate object") /* Get the group info through the VOL using the location token */ - if((ret_value = H5VL_object_get(loc_id, H5O_GET_INFO, 2, oinfo, location)) < 0) + if((ret_value = H5VL_object_get(loc_id, H5VL_OBJECT_GET_INFO, 2, oinfo, location)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") done: @@ -843,7 +843,7 @@ H5Oget_comment(hid_t loc_id, char *comment, size_t bufsize) FUNC_ENTER_API(FAIL) H5TRACE3("Zs", "i*sz", loc_id, comment, bufsize); - if(H5VL_object_get(loc_id, H5O_GET_COMMENT, 3, &ret_value, comment, bufsize) < 0) + if(H5VL_object_get(loc_id, H5VL_OBJECT_GET_COMMENT, 3, &ret_value, comment, bufsize) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object info") done: @@ -885,7 +885,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") - if(H5VL_object_get(loc_id, H5O_GET_COMMENT, 5, &ret_value, comment, bufsize, + if(H5VL_object_get(loc_id, H5VL_OBJECT_GET_COMMENT, 5, &ret_value, comment, bufsize, name, lapl_id) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object info") @@ -2416,7 +2416,7 @@ done: H5O_loc_t * H5O_get_loc(hid_t id) { - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ hid_t object_id; H5I_type_t id_type; H5O_loc_t *ret_value; /* Return value */ @@ -2431,7 +2431,7 @@ H5O_get_loc(hid_t id) that needs to go through the VOL actually go through the VOL*/ if (H5I_GROUP_PUBLIC == id_type || H5I_DATASET_PUBLIC == id_type || H5I_DATATYPE_PUBLIC == id_type) { - if(NULL == (uid_info = (H5I_t *)H5I_object(id))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(id))) HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, NULL, "invalid user identifier") object_id = uid_info->obj_id; } @@ -45,13 +45,14 @@ #include "H5VLpkg.h" /* VOL package header */ #include "H5VLprivate.h" /* VOL */ -/* Declare a free list to manage the H5I_t struct */ -H5FL_DEFINE_STATIC(H5I_t); +/* Declare a free list to manage the H5VL_id_wrapper_t struct */ +H5FL_DEFINE_STATIC(H5VL_id_wrapper_t); /********************/ /* Local Prototypes */ /********************/ static herr_t H5VL_free_cls(H5VL_class_t *cls); +static herr_t H5VL_free_id_wrapper(H5VL_id_wrapper_t *id_struct); /*------------------------------------------------------------------------- @@ -103,8 +104,24 @@ H5VL_init_interface(void) FUNC_ENTER_NOAPI_NOINIT + /* register VOL ID type */ if(H5I_register_type(H5I_VOL, (size_t)H5I_VOL_HASHSIZE, 0, (H5I_free_t)H5VL_free_cls)<H5I_FILE) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize interface") + /* Register high level file user id */ + if(H5I_register_type(H5I_FILE_PUBLIC, (size_t)H5I_FILE_PUBLIC_HASHSIZE, 0, (H5I_free_t)H5VL_free_id_wrapper)<H5I_FILE) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize interface") + /* Register high level group user id */ + if(H5I_register_type(H5I_GROUP_PUBLIC, (size_t)H5I_GROUP_PUBLIC_HASHSIZE, 0, (H5I_free_t)H5VL_free_id_wrapper)<H5I_FILE) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize interface") + /* Register high level dataset user id */ + if(H5I_register_type(H5I_DATASET_PUBLIC, (size_t)H5I_DATASET_PUBLIC_HASHSIZE, 0, (H5I_free_t)H5VL_free_id_wrapper)<H5I_FILE) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize interface") + /* Register high level attribute user id */ + if(H5I_register_type(H5I_ATTR_PUBLIC, (size_t)H5I_ATTR_PUBLIC_HASHSIZE, 0, (H5I_free_t)H5VL_free_id_wrapper)<H5I_FILE) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize interface") + /* Register high level datatype user id */ + if(H5I_register_type(H5I_DATATYPE_PUBLIC, (size_t)H5I_DATATYPE_PUBLIC_HASHSIZE, 0, (H5I_free_t)H5VL_free_id_wrapper)<H5I_FILE) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize interface") done: FUNC_LEAVE_NOAPI(ret_value) @@ -190,6 +207,40 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL_free_id_wrapper + * + * Purpose: Frees the structure of a user level ID + * + * Return: Success: Non-negative + * + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_free_id_wrapper(H5VL_id_wrapper_t *id_struct) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(id_struct); + + /* free the ID wrapper */ + H5MM_xfree(id_struct); + + /* MSC need to decrement the ref count on the VOL struct */ + +done: + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5VL_free_id_wrapper() */ + + +/*------------------------------------------------------------------------- * Function: H5VLregister * * Purpose: Registers a new vol plugin as a member of the virtual object @@ -528,7 +579,7 @@ hid_t H5VL_file_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id) { H5VL_class_t *vol_plugin; /* VOL for file */ - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ H5P_genplist_t *plist; /* Property list pointer */ hid_t plugin_id = -1; /* VOL ID */ hid_t file_id; @@ -553,7 +604,7 @@ H5VL_file_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, h /* Create a new id that points to a struct that holds the file id and the VOL id */ /* Allocate new id structure */ - if(NULL == (uid_info = H5FL_MALLOC(H5I_t))) + if(NULL == (uid_info = H5FL_MALLOC(H5VL_id_wrapper_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") uid_info->obj_id = file_id; //uid_info->vol_id = plugin_id; @@ -589,7 +640,7 @@ hid_t H5VL_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { H5VL_class_t *vol_plugin; /* VOL for file */ - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ H5P_genplist_t *plist; /* Property list pointer */ hid_t plugin_id = -1; /* VOL ID */ hid_t file_id; @@ -614,7 +665,7 @@ H5VL_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Create a new id that points to a struct that holds the file id and the VOL id */ /* Allocate new id structure */ - if(NULL == (uid_info = H5FL_MALLOC(H5I_t))) + if(NULL == (uid_info = H5FL_MALLOC(H5VL_id_wrapper_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") uid_info->obj_id = file_id; uid_info->vol_plugin = vol_plugin; @@ -649,7 +700,7 @@ done: herr_t H5VL_file_close(hid_t uid) { - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) @@ -659,7 +710,7 @@ H5VL_file_close(hid_t uid) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a user ID") /* get the ID struct */ - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") #if 0 @@ -702,7 +753,7 @@ done: herr_t H5VL_file_flush(hid_t uid, H5F_scope_t scope) { - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) @@ -712,7 +763,7 @@ H5VL_file_flush(hid_t uid, H5F_scope_t scope) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a user ID") /* get the ID struct */ - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") if(NULL == uid_info->vol_plugin->file_cls.flush) @@ -742,7 +793,7 @@ done: herr_t H5VL_file_get(hid_t uid, H5VL_file_get_t get_type, int num_args, ...) { - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ va_list arguments; /* argument list passed from the API call */ herr_t ret_value = SUCCEED; @@ -751,11 +802,11 @@ H5VL_file_get(hid_t uid, H5VL_file_get_t get_type, int num_args, ...) /* Check/fix arguments. */ if (H5I_FILE_PUBLIC != H5I_get_type(uid) && H5I_GROUP_PUBLIC != H5I_get_type(uid) && H5I_DATATYPE_PUBLIC != H5I_get_type(uid) && H5I_DATASET_PUBLIC != H5I_get_type(uid) && - H5I_ATTRIBUTE_PUBLIC != H5I_get_type(uid)) + H5I_ATTR_PUBLIC != H5I_get_type(uid)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a user ID") /* get the ID struct */ - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") if(NULL == uid_info->vol_plugin->file_cls.get) @@ -789,15 +840,15 @@ done: hid_t H5VL_group_create(hid_t uid, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id) { - H5I_t *uid_info1; /* user id structure of the location where the group will be created */ - H5I_t *uid_info2; /* user id structure of new created group*/ + H5VL_id_wrapper_t *uid_info1; /* user id structure of the location where the group will be created */ + H5VL_id_wrapper_t *uid_info2; /* user id structure of new created group*/ hid_t group_id; /* actual group ID */ hid_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* get the ID struct */ - if(NULL == (uid_info1 = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info1 = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") /* check if the corresponding VOL create callback exists */ @@ -811,7 +862,7 @@ H5VL_group_create(hid_t uid, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid /* Create a new id that points to a struct that holds the group id and the VOL id */ /* Allocate new id structure */ - if(NULL == (uid_info2 = H5FL_MALLOC(H5I_t))) + if(NULL == (uid_info2 = H5FL_MALLOC(H5VL_id_wrapper_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") uid_info2->obj_id = group_id; uid_info2->vol_plugin = uid_info1->vol_plugin; @@ -842,15 +893,15 @@ done: hid_t H5VL_group_open(hid_t uid, const char *name, hid_t gapl_id) { - H5I_t *uid_info1; /* user id structure of the location where the group will be opend */ - H5I_t *uid_info2; /* user id structure of new opend group*/ + H5VL_id_wrapper_t *uid_info1; /* user id structure of the location where the group will be opend */ + H5VL_id_wrapper_t *uid_info2; /* user id structure of new opend group*/ hid_t group_id; /* actual group ID */ hid_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* get the ID struct */ - if(NULL == (uid_info1 = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info1 = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") /* check if the corresponding VOL open callback exists */ @@ -863,7 +914,7 @@ H5VL_group_open(hid_t uid, const char *name, hid_t gapl_id) /* Create a new id that points to a struct that holds the group id and the VOL id */ /* Allocate new id structure */ - if(NULL == (uid_info2 = H5FL_MALLOC(H5I_t))) + if(NULL == (uid_info2 = H5FL_MALLOC(H5VL_id_wrapper_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") uid_info2->obj_id = group_id; uid_info2->vol_plugin = uid_info1->vol_plugin; @@ -893,7 +944,7 @@ done: herr_t H5VL_group_close(hid_t uid) { - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) @@ -903,7 +954,7 @@ H5VL_group_close(hid_t uid) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a user ID") /* get the ID struct */ - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") if(NULL == uid_info->vol_plugin->group_cls.close) @@ -936,7 +987,7 @@ done: herr_t H5VL_group_get(hid_t uid, H5VL_group_get_t get_type, int num_args, ...) { - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ va_list arguments; /* argument list passed from the API call */ H5I_type_t id_type; /* Type of ID */ herr_t ret_value = SUCCEED; @@ -949,7 +1000,7 @@ H5VL_group_get(hid_t uid, H5VL_group_get_t get_type, int num_args, ...) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a user ID") /* get the ID struct */ - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") if(NULL == uid_info->vol_plugin->group_cls.get) @@ -984,8 +1035,8 @@ done: hid_t H5VL_object_open(hid_t uid, void *obj_loc, hid_t lapl_id) { - H5I_t *uid_info1; /* user id structure of the location where the object will be opend */ - H5I_t *uid_info2; /* user id structure of new opend object*/ + H5VL_id_wrapper_t *uid_info1; /* user id structure of the location where the object will be opend */ + H5VL_id_wrapper_t *uid_info2; /* user id structure of new opend object*/ H5I_type_t id_type; hid_t object_id; /* actual object ID */ hid_t ret_value; /* Return value */ @@ -993,7 +1044,7 @@ H5VL_object_open(hid_t uid, void *obj_loc, hid_t lapl_id) FUNC_ENTER_NOAPI(FAIL) /* get the ID struct */ - if(NULL == (uid_info1 = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info1 = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") /* check if the corresponding VOL open callback exists */ @@ -1007,7 +1058,7 @@ H5VL_object_open(hid_t uid, void *obj_loc, hid_t lapl_id) /* Create a new id that points to a struct that holds the object id and the VOL id */ /* Allocate new id structure */ - if(NULL == (uid_info2 = H5FL_MALLOC(H5I_t))) + if(NULL == (uid_info2 = H5FL_MALLOC(H5VL_id_wrapper_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") uid_info2->obj_id = object_id; uid_info2->vol_plugin = uid_info1->vol_plugin; @@ -1056,7 +1107,7 @@ done: herr_t H5VL_object_close(hid_t uid) { - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ H5I_type_t id_type; herr_t ret_value = SUCCEED; @@ -1082,7 +1133,7 @@ H5VL_object_close(hid_t uid) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a user ID") /* get the ID struct */ - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") if(NULL == uid_info->vol_plugin->object_cls.close) @@ -1115,7 +1166,7 @@ done: herr_t H5VL_object_lookup(hid_t uid, H5VL_object_lookup_t lookup_type, int num_args, ...) { - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ va_list arguments; /* argument list passed from the API call */ H5I_type_t id_type; herr_t ret_value = SUCCEED; @@ -1126,11 +1177,11 @@ H5VL_object_lookup(hid_t uid, H5VL_object_lookup_t lookup_type, int num_args, .. /* Check id */ if(H5I_FILE_PUBLIC != id_type && H5I_GROUP_PUBLIC != id_type && H5I_DATASET_PUBLIC != id_type && H5I_DATATYPE_PUBLIC != id_type && - H5I_ATTRIBUTE_PUBLIC != id_type) + H5I_ATTR_PUBLIC != id_type) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a user ID") /* lookup the ID struct */ - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") if(NULL == uid_info->vol_plugin->object_cls.lookup) @@ -1163,7 +1214,7 @@ done: herr_t H5VL_object_get(hid_t uid, H5VL_object_get_t get_type, int num_args, ...) { - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ va_list arguments; /* argument list passed from the API call */ H5I_type_t id_type; herr_t ret_value = SUCCEED; @@ -1174,11 +1225,11 @@ H5VL_object_get(hid_t uid, H5VL_object_get_t get_type, int num_args, ...) /* Check id */ if(H5I_GROUP_PUBLIC != id_type && H5I_DATASET_PUBLIC != id_type && H5I_DATATYPE_PUBLIC != id_type && H5I_FILE_PUBLIC != id_type && - H5I_ATTRIBUTE_PUBLIC != id_type) + H5I_ATTR_PUBLIC != id_type) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a user ID") /* get the ID struct */ - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") if(NULL == uid_info->vol_plugin->object_cls.get) @@ -1212,13 +1263,13 @@ herr_t H5VL_datatype_commit(hid_t uid, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id) { - H5I_t *uid_info1; /* user id structure of the location where the datatype will be commitd */ + H5VL_id_wrapper_t *uid_info1; /* user id structure of the location where the datatype will be commitd */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* get the ID struct */ - if(NULL == (uid_info1 = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info1 = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") /* check if the corresponding VOL commit callback exists */ @@ -1233,7 +1284,7 @@ H5VL_datatype_commit(hid_t uid, const char *name, hid_t type_id, hid_t lcpl_id, #if 0 /* Create a new id that points to a struct that holds the datatype id and the VOL id */ /* Allocate new id structure */ - if(NULL == (uid_info2 = H5FL_MALLOC(H5I_t))) + if(NULL == (uid_info2 = H5FL_MALLOC(H5VL_id_wrapper_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") uid_info2->obj_id = type_id; uid_info2->vol_plugin = uid_info1->vol_plugin; @@ -1265,15 +1316,15 @@ done: hid_t H5VL_datatype_open(hid_t uid, const char *name, hid_t tapl_id) { - H5I_t *uid_info1; /* user id structure of the location where the datatype will be opend */ - H5I_t *uid_info2; /* user id structure of new opend datatype*/ + H5VL_id_wrapper_t *uid_info1; /* user id structure of the location where the datatype will be opend */ + H5VL_id_wrapper_t *uid_info2; /* user id structure of new opend datatype*/ hid_t datatype_id; /* actual datatype ID */ hid_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* get the ID struct */ - if(NULL == (uid_info1 = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info1 = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") /* check if the corresponding VOL open callback exists */ @@ -1287,7 +1338,7 @@ H5VL_datatype_open(hid_t uid, const char *name, hid_t tapl_id) /* Create a new id that points to a struct that holds the datatype id and the VOL id */ /* Allocate new id structure */ - if(NULL == (uid_info2 = H5FL_MALLOC(H5I_t))) + if(NULL == (uid_info2 = H5FL_MALLOC(H5VL_id_wrapper_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") uid_info2->obj_id = datatype_id; uid_info2->vol_plugin = uid_info1->vol_plugin; @@ -1319,15 +1370,15 @@ hid_t H5VL_dataset_create(hid_t uid, const char *name, hid_t dtype_id, hid_t space_id, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id) { - H5I_t *uid_info1; /* user id structure of the location where the dataset will be created */ - H5I_t *uid_info2; /* user id structure of new created dataset*/ + H5VL_id_wrapper_t *uid_info1; /* user id structure of the location where the dataset will be created */ + H5VL_id_wrapper_t *uid_info2; /* user id structure of new created dataset*/ hid_t dataset_id; /* actual dataset ID */ hid_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* get the ID struct */ - if(NULL == (uid_info1 = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info1 = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") /* check if the corresponding VOL create callback exists */ @@ -1341,7 +1392,7 @@ H5VL_dataset_create(hid_t uid, const char *name, hid_t dtype_id, hid_t space_id, /* Create a new id that points to a struct that holds the dataset id and the VOL id */ /* Allocate new id structure */ - if(NULL == (uid_info2 = H5FL_MALLOC(H5I_t))) + if(NULL == (uid_info2 = H5FL_MALLOC(H5VL_id_wrapper_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") uid_info2->obj_id = dataset_id; uid_info2->vol_plugin = uid_info1->vol_plugin; @@ -1372,15 +1423,15 @@ done: hid_t H5VL_dataset_open(hid_t uid, const char *name, hid_t dapl_id) { - H5I_t *uid_info1; /* user id structure of the location where the dataset will be opend */ - H5I_t *uid_info2; /* user id structure of new opend dataset*/ + H5VL_id_wrapper_t *uid_info1; /* user id structure of the location where the dataset will be opend */ + H5VL_id_wrapper_t *uid_info2; /* user id structure of new opend dataset*/ hid_t dataset_id; /* actual dataset ID */ hid_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* get the ID struct */ - if(NULL == (uid_info1 = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info1 = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") /* check if the corresponding VOL open callback exists */ @@ -1393,7 +1444,7 @@ H5VL_dataset_open(hid_t uid, const char *name, hid_t dapl_id) /* Create a new id that points to a struct that holds the dataset id and the VOL id */ /* Allocate new id structure */ - if(NULL == (uid_info2 = H5FL_MALLOC(H5I_t))) + if(NULL == (uid_info2 = H5FL_MALLOC(H5VL_id_wrapper_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") uid_info2->obj_id = dataset_id; uid_info2->vol_plugin = uid_info1->vol_plugin; @@ -1423,7 +1474,7 @@ done: herr_t H5VL_dataset_close(hid_t uid) { - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) @@ -1433,7 +1484,7 @@ H5VL_dataset_close(hid_t uid) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a user ID") /* get the ID struct */ - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") if(NULL == uid_info->vol_plugin->dataset_cls.close) @@ -1466,7 +1517,7 @@ done: herr_t H5VL_dataset_read(hid_t uid, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf) { - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) @@ -1476,7 +1527,7 @@ herr_t H5VL_dataset_read(hid_t uid, hid_t mem_type_id, hid_t mem_space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a user ID") /* get the ID struct */ - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") if(NULL == uid_info->vol_plugin->dataset_cls.read) @@ -1507,7 +1558,7 @@ done: herr_t H5VL_dataset_write(hid_t uid, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf) { - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) @@ -1517,7 +1568,7 @@ herr_t H5VL_dataset_write(hid_t uid, hid_t mem_type_id, hid_t mem_space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a user ID") /* get the ID struct */ - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") if(NULL == uid_info->vol_plugin->dataset_cls.write) @@ -1548,7 +1599,7 @@ done: herr_t H5VL_dataset_get(hid_t uid, H5VL_dataset_get_t get_type, int num_args, ...) { - H5I_t *uid_info; /* user id structure */ + H5VL_id_wrapper_t *uid_info; /* user id structure */ va_list arguments; /* argument list passed from the API call */ herr_t ret_value = SUCCEED; @@ -1559,7 +1610,7 @@ H5VL_dataset_get(hid_t uid, H5VL_dataset_get_t get_type, int num_args, ...) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a user ID") /* get the ID struct */ - if(NULL == (uid_info = (H5I_t *)H5I_object(uid))) + if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") if(NULL == uid_info->vol_plugin->dataset_cls.get) diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 23e1ce5..7d59ded 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -567,190 +567,190 @@ H5VL_native_file_get(hid_t obj_id, H5VL_file_get_t get_type, int num_args, va_li } /* end else */ switch (get_type) { - /* H5Fget_access_plist */ - case H5F_GET_FAPL: - { - hid_t *plist_id = va_arg (arguments, hid_t *); - - /* Retrieve the file's access property list */ - if((*plist_id = H5F_get_access_plist(f, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file access property list") - break; - } - /* H5Fget_create_plist */ - case H5F_GET_FCPL: - { - H5P_genplist_t *plist; /* Property list */ - hid_t *plist_id = va_arg (arguments, hid_t *); - - if(NULL == (plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + /* H5Fget_access_plist */ + case H5VL_FILE_GET_FAPL: + { + hid_t *plist_id = va_arg (arguments, hid_t *); - /* Create the property list object to return */ - if((*plist_id = H5P_copy_plist(plist, TRUE)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to copy file creation properties") + /* Retrieve the file's access property list */ + if((*plist_id = H5F_get_access_plist(f, TRUE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file access property list") + break; + } + /* H5Fget_create_plist */ + case H5VL_FILE_GET_FCPL: + { + H5P_genplist_t *plist; /* Property list */ + hid_t *plist_id = va_arg (arguments, hid_t *); - break; - } - /* H5Fget_filesize */ - case H5F_GET_SIZE: - { - haddr_t eof; /* End of file address */ - hsize_t *ret = va_arg (arguments, hsize_t *); + if(NULL == (plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - /* Go get the actual file size */ - if(HADDR_UNDEF == (eof = H5FDget_eof(f->shared->lf))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") - *ret = (hsize_t)eof; - break; - } - /* H5Fget_freespace */ - case H5F_GET_FREE_SPACE: - { - hsize_t tot_space; /* Amount of free space in the file */ - hssize_t *ret = va_arg (arguments, hssize_t *); + /* Create the property list object to return */ + if((*plist_id = H5P_copy_plist(plist, TRUE)) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to copy file creation properties") - /* Go get the actual amount of free space in the file */ - if(H5MF_get_freespace(f, H5AC_ind_dxpl_id, &tot_space, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") - *ret = (hssize_t)tot_space; - break; - } - case H5F_GET_FREE_SECTIONS: - { - H5F_sect_info_t *sect_info = va_arg (arguments, H5F_sect_info_t *); - ssize_t *ret = va_arg (arguments, ssize_t *); - H5F_mem_t type = va_arg (arguments, H5F_mem_t); - size_t nsects = va_arg (arguments, size_t); - - /* Go get the free-space section information in the file */ - if((*ret = H5MF_get_free_sections(f, H5AC_ind_dxpl_id, - type, nsects, sect_info)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") - break; - } - /* H5Fget_info2 */ - case H5F_GET_INFO: - { - H5F_info2_t *finfo = va_arg (arguments, H5F_info2_t *); - - /* For file IDs, get the file object directly */ - /* (This prevents the H5G_loc() call from returning the file pointer for - * the top file in a mount hierarchy) - */ - HDassert(f->shared); - - /* Reset file info struct */ - HDmemset(finfo, 0, sizeof(*finfo)); - - /* Get the size of the superblock and any superblock extensions */ - if(H5F_super_size(f, H5AC_ind_dxpl_id, &finfo->super.super_size, - &finfo->super.super_ext_size) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve superblock sizes") - - /* Get the size of any persistent free space */ - if(H5MF_get_freespace(f, H5AC_ind_dxpl_id, &finfo->free.tot_space, - &finfo->free.meta_size) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve free space information") - - /* Check for SOHM info */ - if(H5F_addr_defined(f->shared->sohm_addr)) - if(H5SM_ih_size(f, H5AC_ind_dxpl_id, &finfo->sohm.hdr_size, &finfo->sohm.msgs_info) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve SOHM index & heap storage info") - - /* Set version # fields */ - finfo->super.version = f->shared->sblock->super_vers; - finfo->sohm.version = f->shared->sohm_vers; - finfo->free.version = HDF5_FREESPACE_VERSION; - break; - } - /* H5Fget_intent */ - case H5F_GET_INTENT: - { - unsigned *ret = va_arg (arguments, unsigned *); - - /* HDF5 uses some flags internally that users don't know about. - * Simplify things for them so that they only get either H5F_ACC_RDWR - * or H5F_ACC_RDONLY. - */ - if(H5F_INTENT(f) & H5F_ACC_RDWR) - *ret = H5F_ACC_RDWR; - else - *ret = H5F_ACC_RDONLY; - break; - } - /* H5Fget_name */ - case H5F_GET_NAME: - { - char *name = va_arg (arguments, char *); - ssize_t *ret = va_arg (arguments, ssize_t *); - size_t size = va_arg (arguments, size_t); - size_t len; + break; + } + /* H5Fget_filesize */ + case H5VL_FILE_GET_SIZE: + { + haddr_t eof; /* End of file address */ + hsize_t *ret = va_arg (arguments, hsize_t *); + + /* Go get the actual file size */ + if(HADDR_UNDEF == (eof = H5FDget_eof(f->shared->lf))) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") + *ret = (hsize_t)eof; + break; + } + /* H5Fget_freespace */ + case H5VL_FILE_GET_FREE_SPACE: + { + hsize_t tot_space; /* Amount of free space in the file */ + hssize_t *ret = va_arg (arguments, hssize_t *); + + /* Go get the actual amount of free space in the file */ + if(H5MF_get_freespace(f, H5AC_ind_dxpl_id, &tot_space, NULL) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") + *ret = (hssize_t)tot_space; + break; + } + case H5VL_FILE_GET_FREE_SECTIONS: + { + H5F_sect_info_t *sect_info = va_arg (arguments, H5F_sect_info_t *); + ssize_t *ret = va_arg (arguments, ssize_t *); + H5F_mem_t type = va_arg (arguments, H5F_mem_t); + size_t nsects = va_arg (arguments, size_t); + + /* Go get the free-space section information in the file */ + if((*ret = H5MF_get_free_sections(f, H5AC_ind_dxpl_id, + type, nsects, sect_info)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") + break; + } + /* H5Fget_info2 */ + case H5VL_FILE_GET_INFO: + { + H5F_info2_t *finfo = va_arg (arguments, H5F_info2_t *); + + /* For file IDs, get the file object directly */ + /* (This prevents the H5G_loc() call from returning the file pointer for + * the top file in a mount hierarchy) + */ + HDassert(f->shared); + + /* Reset file info struct */ + HDmemset(finfo, 0, sizeof(*finfo)); + + /* Get the size of the superblock and any superblock extensions */ + if(H5F_super_size(f, H5AC_ind_dxpl_id, &finfo->super.super_size, + &finfo->super.super_ext_size) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve superblock sizes") + + /* Get the size of any persistent free space */ + if(H5MF_get_freespace(f, H5AC_ind_dxpl_id, &finfo->free.tot_space, + &finfo->free.meta_size) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve free space information") + + /* Check for SOHM info */ + if(H5F_addr_defined(f->shared->sohm_addr)) + if(H5SM_ih_size(f, H5AC_ind_dxpl_id, &finfo->sohm.hdr_size, &finfo->sohm.msgs_info) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve SOHM index & heap storage info") + + /* Set version # fields */ + finfo->super.version = f->shared->sblock->super_vers; + finfo->sohm.version = f->shared->sohm_vers; + finfo->free.version = HDF5_FREESPACE_VERSION; + break; + } + /* H5Fget_intent */ + case H5VL_FILE_GET_INTENT: + { + unsigned *ret = va_arg (arguments, unsigned *); + + /* HDF5 uses some flags internally that users don't know about. + * Simplify things for them so that they only get either H5F_ACC_RDWR + * or H5F_ACC_RDONLY. + */ + if(H5F_INTENT(f) & H5F_ACC_RDWR) + *ret = H5F_ACC_RDWR; + else + *ret = H5F_ACC_RDONLY; + break; + } + /* H5Fget_name */ + case H5VL_FILE_GET_NAME: + { + char *name = va_arg (arguments, char *); + ssize_t *ret = va_arg (arguments, ssize_t *); + size_t size = va_arg (arguments, size_t); + size_t len; - len = HDstrlen(H5F_OPEN_NAME(f)); + len = HDstrlen(H5F_OPEN_NAME(f)); - if(name) { - HDstrncpy(name, H5F_OPEN_NAME(f), MIN(len + 1,size)); - if(len >= size) - name[size-1]='\0'; - } /* end if */ + if(name) { + HDstrncpy(name, H5F_OPEN_NAME(f), MIN(len + 1,size)); + if(len >= size) + name[size-1]='\0'; + } /* end if */ - /* Set the return value for the API call */ - *ret = (ssize_t)len; - break; - } - /* H5Fget_vfd_handle */ - case H5F_GET_VFD_HANDLE: - { - void **file_handle = va_arg (arguments, void **); - hid_t fapl = va_arg (arguments, hid_t); + /* Set the return value for the API call */ + *ret = (ssize_t)len; + break; + } + /* H5Fget_vfd_handle */ + case H5VL_FILE_GET_VFD_HANDLE: + { + void **file_handle = va_arg (arguments, void **); + hid_t fapl = va_arg (arguments, hid_t); - /* Retrieve the VFD handle for the file */ - if(H5F_get_vfd_handle(f, fapl, file_handle) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle") - break; - } - /* H5Fget_mdc_config */ - case H5F_GET_MDC_CONF: - { - H5AC_cache_config_t *config_ptr = va_arg (arguments, H5AC_cache_config_t *); + /* Retrieve the VFD handle for the file */ + if(H5F_get_vfd_handle(f, fapl, file_handle) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle") + break; + } + /* H5Fget_mdc_config */ + case H5VL_FILE_GET_MDC_CONF: + { + H5AC_cache_config_t *config_ptr = va_arg (arguments, H5AC_cache_config_t *); - /* Go get the resize configuration */ - if(H5AC_get_cache_auto_resize_config(f->shared->cache, config_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.") - break; - } - /* H5Fget_mdc_hit_rate */ - case H5F_GET_MDC_HR: - { - double *hit_rate_ptr = va_arg (arguments, double *); + /* Go get the resize configuration */ + if(H5AC_get_cache_auto_resize_config(f->shared->cache, config_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.") + break; + } + /* H5Fget_mdc_hit_rate */ + case H5VL_FILE_GET_MDC_HR: + { + double *hit_rate_ptr = va_arg (arguments, double *); - /* Go get the current hit rate */ - if(H5AC_get_cache_hit_rate(f->shared->cache, hit_rate_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_hit_rate() failed.") - break; - } - /* H5Fget_mdc_size */ - case H5F_GET_MDC_SIZE: - { - size_t *max_size_ptr = va_arg (arguments, size_t *); - size_t *min_clean_size_ptr = va_arg (arguments, size_t *); - size_t *cur_size_ptr = va_arg (arguments, size_t *); - int *cur_num_entries_ptr = va_arg (arguments, int *); - int32_t cur_num_entries; - - /* Go get the size data */ - if(H5AC_get_cache_size(f->shared->cache, max_size_ptr, min_clean_size_ptr, - cur_size_ptr, &cur_num_entries) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_size() failed.") - - if(cur_num_entries_ptr != NULL) - *cur_num_entries_ptr = (int)cur_num_entries; - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information") - } + /* Go get the current hit rate */ + if(H5AC_get_cache_hit_rate(f->shared->cache, hit_rate_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_hit_rate() failed.") + break; + } + /* H5Fget_mdc_size */ + case H5VL_FILE_GET_MDC_SIZE: + { + size_t *max_size_ptr = va_arg (arguments, size_t *); + size_t *min_clean_size_ptr = va_arg (arguments, size_t *); + size_t *cur_size_ptr = va_arg (arguments, size_t *); + int *cur_num_entries_ptr = va_arg (arguments, int *); + int32_t cur_num_entries; + + /* Go get the size data */ + if(H5AC_get_cache_size(f->shared->cache, max_size_ptr, min_clean_size_ptr, + cur_size_ptr, &cur_num_entries) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_size() failed.") + + if(cur_num_entries_ptr != NULL) + *cur_num_entries_ptr = (int)cur_num_entries; + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information") + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_native_file_get() */ @@ -930,7 +930,7 @@ H5VL_native_group_get(hid_t obj_id, H5VL_group_get_t get_type, int num_args, va_ switch (get_type) { /* H5Gget_create_plist */ - case H5G_GET_GCPL: + case H5VL_GROUP_GET_GCPL: { H5O_linfo_t linfo; /* Link info message */ htri_t ginfo_exists; @@ -1001,7 +1001,7 @@ H5VL_native_group_get(hid_t obj_id, H5VL_group_get_t get_type, int num_args, va_ break; } /* H5Fget_info2 */ - case H5G_GET_INFO: + case H5VL_GROUP_GET_INFO: { H5G_info_t *grp_info = va_arg (arguments, H5G_info_t *); haddr_t *addr = va_arg (arguments, haddr_t *); @@ -1027,7 +1027,7 @@ H5VL_native_group_get(hid_t obj_id, H5VL_group_get_t get_type, int num_args, va_ } done: - if (H5G_GET_GCPL == get_type) { + if (H5VL_GROUP_GET_GCPL == get_type) { if(*new_gcpl_id < 0) { if(new_id > 0) if(H5I_dec_app_ref(new_id) < 0) @@ -1167,7 +1167,7 @@ H5VL_native_object_get(hid_t id, H5VL_object_get_t get_type, int num_args, va_li switch (get_type) { /* H5Oget_info / H5Oget_info_by_name / H5Oget_info_by_idx */ - case H5O_GET_INFO: + case H5VL_OBJECT_GET_INFO: { H5O_info_t *obj_info = va_arg (arguments, H5O_info_t *); haddr_t *addr = va_arg (arguments, haddr_t *); @@ -1185,7 +1185,7 @@ H5VL_native_object_get(hid_t id, H5VL_object_get_t get_type, int num_args, va_li break; } /* H5Oget_comment / H5Oget_comment_by_name */ - case H5O_GET_COMMENT: + case H5VL_OBJECT_GET_COMMENT: { ssize_t *ret = va_arg (arguments, ssize_t *); char *comment = va_arg (arguments, char *); @@ -1258,12 +1258,12 @@ H5VL_native_object_lookup(hid_t loc_id, H5VL_object_lookup_t lookup_type, H5G_loc_reset(&obj_loc); switch (lookup_type) { - case H5O_LOOKUP: + case H5VL_OBJECT_LOOKUP: { obj_addr = loc.oloc->addr; break; } - case H5O_LOOKUP_BY_NAME: + case H5VL_OBJECT_LOOKUP_BY_NAME: { char *name = va_arg (arguments, char *); hid_t lapl_id = va_arg (arguments, hid_t); @@ -1277,7 +1277,7 @@ H5VL_native_object_lookup(hid_t loc_id, H5VL_object_lookup_t lookup_type, obj_addr = (haddr_t)obj_loc.oloc->addr; break; } - case H5O_LOOKUP_BY_IDX: + case H5VL_OBJECT_LOOKUP_BY_IDX: { char *group_name = va_arg (arguments, char *); H5_index_t idx_type = va_arg (arguments, H5_index_t); @@ -1293,7 +1293,7 @@ H5VL_native_object_lookup(hid_t loc_id, H5VL_object_lookup_t lookup_type, obj_addr = (haddr_t)obj_loc.oloc->addr; break; } - case H5O_LOOKUP_BY_ADDR: + case H5VL_OBJECT_LOOKUP_BY_ADDR: { obj_addr = va_arg (arguments, haddr_t); break; @@ -1771,7 +1771,7 @@ H5VL_native_dataset_get(hid_t id, H5VL_dataset_get_t get_type, int num_args, va_ switch (get_type) { /* H5Dget_space */ - case H5D_GET_SPACE: + case H5VL_DATASET_GET_SPACE: { ret_id = va_arg (arguments, hid_t *); @@ -1788,7 +1788,7 @@ H5VL_native_dataset_get(hid_t id, H5VL_dataset_get_t get_type, int num_args, va_ break; } /* H5Dget_space_statuc */ - case H5D_GET_SPACE_STATUS: + case H5VL_DATASET_GET_SPACE_STATUS: { H5D_space_status_t *allocation = va_arg (arguments, H5D_space_status_t *); @@ -1799,7 +1799,7 @@ H5VL_native_dataset_get(hid_t id, H5VL_dataset_get_t get_type, int num_args, va_ break; } /* H5Dget_type */ - case H5D_GET_TYPE: + case H5VL_DATASET_GET_TYPE: { ret_id = va_arg (arguments, hid_t *); @@ -1829,7 +1829,7 @@ H5VL_native_dataset_get(hid_t id, H5VL_dataset_get_t get_type, int num_args, va_ break; } /* H5Dget_create_plist */ - case H5D_GET_DCPL: + case H5VL_DATASET_GET_DCPL: { H5P_genplist_t *dcpl_plist; /* Dataset's DCPL */ H5P_genplist_t *new_plist; /* Copy of dataset's DCPL */ @@ -1919,7 +1919,7 @@ H5VL_native_dataset_get(hid_t id, H5VL_dataset_get_t get_type, int num_args, va_ break; } /* H5Dget_type */ - case H5D_GET_DAPL: + case H5VL_DATASET_GET_DAPL: { H5P_genplist_t *old_plist; /* Default DAPL */ H5P_genplist_t *new_plist; /* New DAPL */ @@ -1949,7 +1949,7 @@ H5VL_native_dataset_get(hid_t id, H5VL_dataset_get_t get_type, int num_args, va_ break; } /* H5Dget_type */ - case H5D_GET_STORAGE_SIZE: + case H5VL_DATASET_GET_STORAGE_SIZE: { hsize_t *ret = va_arg (arguments, hsize_t *); @@ -1958,7 +1958,7 @@ H5VL_native_dataset_get(hid_t id, H5VL_dataset_get_t get_type, int num_args, va_ break; } /* H5Dget_type */ - case H5D_GET_OFFSET: + case H5VL_DATASET_GET_OFFSET: { haddr_t *ret = va_arg (arguments, haddr_t *); @@ -1970,14 +1970,14 @@ H5VL_native_dataset_get(hid_t id, H5VL_dataset_get_t get_type, int num_args, va_ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from dataset") } done: - if (H5D_GET_DCPL == get_type || H5D_GET_DAPL == get_type) { + if (H5VL_DATASET_GET_DCPL == get_type || H5VL_DATASET_GET_DAPL == get_type) { if(*ret_id < 0) { if(new_id > 0) if(H5I_dec_app_ref(new_id) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't free") } /* end if */ } - if (H5D_GET_SPACE == get_type) { + if (H5VL_DATASET_GET_SPACE == get_type) { if(*ret_id < 0) { if(space!=NULL) { if(H5S_close(space) < 0) @@ -1985,7 +1985,7 @@ done: } /* end if */ } /* end if */ } - if (H5D_GET_TYPE == get_type) { + if (H5VL_DATASET_GET_TYPE == get_type) { if(*ret_id < 0) { if(dt && H5T_close(dt) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype") diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 3ebd0c3..949fd90 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -29,7 +29,11 @@ /****************************/ /* Library Private Typedefs */ /****************************/ - +/* type of the ID passed to users */ +typedef struct H5VL_id_wrapper_t { + hid_t obj_id; /* actual id for object */ + H5VL_class_t *vol_plugin; /* pointer to the VOL structure */ +} H5VL_id_wrapper_t; /*****************************/ /* Library Private Variables */ diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 7ebba77..b8eafa4 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -26,51 +26,51 @@ /* types for all file get API routines */ typedef enum H5VL_file_get_t { - H5F_GET_FAPL = 0, /*file access property list */ - H5F_GET_FCPL = 1, /*file creation property list */ - H5F_GET_SIZE = 2, /*file size */ - H5F_GET_FREE_SPACE = 3, /*file freespace */ - H5F_GET_INFO = 4, /*file info */ - H5F_GET_INTENT = 5, /*file intent */ - H5F_GET_NAME = 6, /*file name */ - H5F_GET_OBJ_COUNT = 7, /*object count in file */ - H5F_GET_OBJ_IDS = 8, /*object ids in file */ - H5F_GET_VFD_HANDLE = 9, /*file VFD handle */ - H5F_GET_MDC_CONF = 10, /*file metadata cache configuration */ - H5F_GET_MDC_HR = 11, /*file metadata cache hit rate */ - H5F_GET_MDC_SIZE = 12, /*file metadata cache size */ - H5F_GET_FREE_SECTIONS = 13 /*file free selections */ + H5VL_FILE_GET_FAPL = 0, /*file access property list */ + H5VL_FILE_GET_FCPL = 1, /*file creation property list */ + H5VL_FILE_GET_SIZE = 2, /*file size */ + H5VL_FILE_GET_FREE_SPACE = 3, /*file freespace */ + H5VL_FILE_GET_INFO = 4, /*file info */ + H5VL_FILE_GET_INTENT = 5, /*file intent */ + H5VL_FILE_GET_NAME = 6, /*file name */ + H5VL_FILE_GET_OBJ_COUNT = 7, /*object count in file */ + H5VL_FILE_GET_OBJ_IDS = 8, /*object ids in file */ + H5VL_FILE_GET_VFD_HANDLE = 9, /*file VFD handle */ + H5VL_FILE_GET_MDC_CONF = 10, /*file metadata cache configuration */ + H5VL_FILE_GET_MDC_HR = 11, /*file metadata cache hit rate */ + H5VL_FILE_GET_MDC_SIZE = 12, /*file metadata cache size */ + H5VL_FILE_GET_FREE_SECTIONS = 13 /*file free selections */ } H5VL_file_get_t; /* types for all dataset get API routines */ typedef enum H5VL_dataset_get_t { - H5D_GET_SPACE = 0, /* dataspace */ - H5D_GET_SPACE_STATUS = 1, /* space status */ - H5D_GET_TYPE = 2, /* datatype */ - H5D_GET_DCPL = 3, /* creation property list */ - H5D_GET_DAPL = 4, /* access property list */ - H5D_GET_STORAGE_SIZE = 5, /* storage size */ - H5D_GET_OFFSET = 6 /* offset */ + H5VL_DATASET_GET_SPACE = 0, /* dataspace */ + H5VL_DATASET_GET_SPACE_STATUS = 1, /* space status */ + H5VL_DATASET_GET_TYPE = 2, /* datatype */ + H5VL_DATASET_GET_DCPL = 3, /* creation property list */ + H5VL_DATASET_GET_DAPL = 4, /* access property list */ + H5VL_DATASET_GET_STORAGE_SIZE = 5, /* storage size */ + H5VL_DATASET_GET_OFFSET = 6 /* offset */ } H5VL_dataset_get_t; /* types for all group get API routines */ typedef enum H5VL_group_get_t { - H5G_GET_GCPL = 0, /*group creation property list */ - H5G_GET_INFO = 1 /*group info */ + H5VL_GROUP_GET_GCPL = 0, /*group creation property list */ + H5VL_GROUP_GET_INFO = 1 /*group info */ } H5VL_group_get_t; /* types for all object get API routines */ typedef enum H5VL_object_get_t { - H5O_GET_INFO = 0, /*object info */ - H5O_GET_COMMENT = 1 /*object comment */ + H5VL_OBJECT_GET_INFO = 0, /*object info */ + H5VL_OBJECT_GET_COMMENT = 1 /*object comment */ } H5VL_object_get_t; /* types for all object lookup API routines */ typedef enum H5VL_object_lookup_t { - H5O_LOOKUP = 0, - H5O_LOOKUP_BY_NAME = 1, - H5O_LOOKUP_BY_IDX = 2, - H5O_LOOKUP_BY_ADDR = 3 + H5VL_OBJECT_LOOKUP = 0, + H5VL_OBJECT_LOOKUP_BY_NAME = 1, + H5VL_OBJECT_LOOKUP_BY_IDX = 2, + H5VL_OBJECT_LOOKUP_BY_ADDR = 3 } H5VL_object_lookup_t; #define H5VL_VOL_DEFAULT 0 /* Default VOL plugin value */ |