diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5F.c | 13 | ||||
-rw-r--r-- | src/H5VL.c | 4 | ||||
-rw-r--r-- | src/H5VLnative.c | 254 | ||||
-rw-r--r-- | src/H5VLprivate.h | 3 | ||||
-rw-r--r-- | src/H5VLpublic.h | 2 |
5 files changed, 128 insertions, 148 deletions
@@ -1508,20 +1508,9 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") /* Open the file */ - if((ret_value = H5VL_file_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))<0) + if((ret_value = H5VL_file_open(filename, flags, fapl_id))<0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open file") -#if 0 - /* Open the file */ - if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open file") - /* Get an atom for the file */ - if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") - /* Keep this ID in file object structure */ - new_file->file_id = ret_value; -#endif - done: FUNC_LEAVE_API(ret_value) } /* end H5Fopen() */ @@ -513,7 +513,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VL_file_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id) +H5VL_file_open(const char *name, unsigned flags, hid_t fapl_id) { H5VL_class_t *vol_plugin; /* VOL for file */ H5VL_id_wrapper_t *uid_info; /* user id structure */ @@ -533,7 +533,7 @@ H5VL_file_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, h if(NULL == vol_plugin->file_cls.open) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file open' method") /* call the corresponding VOL open callback */ - if((file_id = (vol_plugin->file_cls.open)(name, flags, fcpl_id, fapl_id, dxpl_id)) < 0) + if((file_id = (vol_plugin->file_cls.open)(name, flags, fapl_id)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "open failed") /* Create a new id that points to a struct that holds the file id and the VOL plugin */ diff --git a/src/H5VLnative.c b/src/H5VLnative.c index e717205..f3cb2ae 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -56,8 +56,7 @@ static hid_t H5VL_NATIVE_g = 0; /* Prototypes */ static herr_t H5VL_native_term(void); -static hid_t H5VL_native_file_open(const char *name, unsigned flags, hid_t fcpl_id, - hid_t fapl_id, hid_t dxpl_id); +static hid_t H5VL_native_file_open(const char *name, unsigned flags, hid_t fapl_id); static herr_t H5VL_native_file_close(hid_t fid); static hid_t H5VL_native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); static herr_t H5VL_native_file_flush(hid_t fid, H5F_scope_t scope); @@ -269,8 +268,7 @@ done: *------------------------------------------------------------------------- */ static hid_t -H5VL_native_file_open(const char *name, unsigned flags, hid_t fcpl_id, - hid_t fapl_id, hid_t dxpl_id) +H5VL_native_file_open(const char *name, unsigned flags, hid_t fapl_id) { H5F_t *new_file; /* file struct */ hid_t ret_value; @@ -278,7 +276,7 @@ H5VL_native_file_open(const char *name, unsigned flags, hid_t fcpl_id, FUNC_ENTER_NOAPI_NOINIT /* Open the file */ - if(NULL == (new_file = H5F_open(name, flags, fcpl_id, fapl_id, dxpl_id))) + if(NULL == (new_file = H5F_open(name, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open file") /* Get an atom for the file */ @@ -426,7 +424,6 @@ H5VL_native_file_flush(hid_t object_id, H5F_scope_t scope) if(NULL == (f = (H5F_t *)H5I_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") break; - case H5I_GROUP: { H5G_t *grp; @@ -434,9 +431,8 @@ H5VL_native_file_flush(hid_t object_id, H5F_scope_t scope) if(NULL == (grp = (H5G_t *)H5I_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid group identifier") oloc = H5G_oloc(grp); + break; } - break; - case H5I_DATATYPE: { H5T_t *type; @@ -444,9 +440,8 @@ H5VL_native_file_flush(hid_t object_id, H5F_scope_t scope) if(NULL == (type = (H5T_t *)H5I_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid type identifier") oloc = H5T_oloc(type); + break; } - break; - case H5I_DATASET: { H5D_t *dset; @@ -454,8 +449,8 @@ H5VL_native_file_flush(hid_t object_id, H5F_scope_t scope) if(NULL == (dset = (H5D_t *)H5I_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") oloc = H5D_oloc(dset); + break; } - break; case H5I_ATTR: { @@ -464,9 +459,8 @@ H5VL_native_file_flush(hid_t object_id, H5F_scope_t scope) if(NULL == (attr = (H5A_t *)H5I_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid attribute identifier") oloc = H5A_oloc(attr); + break; } - break; - case H5I_UNINIT: case H5I_BADID: case H5I_DATASPACE: @@ -912,46 +906,46 @@ H5VL_native_group_get(hid_t obj_id, H5VL_group_get_t get_type, int num_args, va_ FUNC_ENTER_NOAPI_NOINIT switch (get_type) { - /* H5Gget_create_plist */ - case H5VL_GROUP_GET_GCPL: - { - hid_t *new_gcpl_id; - H5G_t *grp = NULL; + /* H5Gget_create_plist */ + case H5VL_GROUP_GET_GCPL: + { + hid_t *new_gcpl_id; + H5G_t *grp = NULL; - /* Check args */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(obj_id, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + /* Check args */ + if(NULL == (grp = (H5G_t *)H5I_object_verify(obj_id, H5I_GROUP))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") - new_gcpl_id = va_arg (arguments, hid_t *); + new_gcpl_id = va_arg (arguments, hid_t *); - if((*new_gcpl_id = H5G_get_create_plist(grp)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for group") - break; - } - /* H5Fget_info2 */ - case H5VL_GROUP_GET_INFO: - { - H5G_info_t *grp_info = va_arg (arguments, H5G_info_t *); - haddr_t *addr = va_arg (arguments, haddr_t *); - H5G_loc_t loc; - H5O_loc_t oloc; /* Opened object object location */ - - if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - - if(!H5F_addr_defined(*addr)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no address supplied") - - oloc.addr = *addr; - oloc.file = loc.oloc->file; - - /* Retrieve the group's information */ - if(H5G__obj_info(&oloc, grp_info/*out*/, H5AC_ind_dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from group") + if((*new_gcpl_id = H5G_get_create_plist(grp)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for group") + break; + } + /* H5Fget_info2 */ + case H5VL_GROUP_GET_INFO: + { + H5G_info_t *grp_info = va_arg (arguments, H5G_info_t *); + haddr_t *addr = va_arg (arguments, haddr_t *); + H5G_loc_t loc; + H5O_loc_t oloc; /* Opened object object location */ + + if(H5G_loc(obj_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + + if(!H5F_addr_defined(*addr)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no address supplied") + + oloc.addr = *addr; + oloc.file = loc.oloc->file; + + /* Retrieve the group's information */ + if(H5G__obj_info(&oloc, grp_info/*out*/, H5AC_ind_dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from group") } done: @@ -1087,49 +1081,49 @@ H5VL_native_object_get(hid_t id, H5VL_object_get_t get_type, int num_args, va_li HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") switch (get_type) { - /* H5Oget_info / H5Oget_info_by_name / H5Oget_info_by_idx */ - case H5VL_OBJECT_GET_INFO: - { - H5O_info_t *obj_info = va_arg (arguments, H5O_info_t *); - haddr_t *addr = va_arg (arguments, haddr_t *); - H5O_loc_t oloc; /* Opened object object location */ - - if(!H5F_addr_defined(*addr)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no address supplied") - - oloc.addr = *addr; - oloc.file = loc.oloc->file; - - /* Retrieve the object's information */ - if(H5O_get_info(&oloc, H5AC_ind_dxpl_id, TRUE, obj_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve object info") - break; - } - /* H5Oget_comment / H5Oget_comment_by_name */ - case H5VL_OBJECT_GET_COMMENT: - { - ssize_t *ret = va_arg (arguments, ssize_t *); - char *comment = va_arg (arguments, char *); - size_t bufsize = va_arg (arguments, size_t); - - if(3 == num_args) { - /* Retrieve the object's comment */ - if((*ret = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize, - H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") - } - else if(5 == num_args) { - char *name = va_arg (arguments, char *); - hid_t lapl_id = va_arg (arguments, hid_t); + /* H5Oget_info / H5Oget_info_by_name / H5Oget_info_by_idx */ + case H5VL_OBJECT_GET_INFO: + { + H5O_info_t *obj_info = va_arg (arguments, H5O_info_t *); + haddr_t *addr = va_arg (arguments, haddr_t *); + H5O_loc_t oloc; /* Opened object object location */ - /* Retrieve the object's comment */ - if((*ret = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize, lapl_id, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + if(!H5F_addr_defined(*addr)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no address supplied") + + oloc.addr = *addr; + oloc.file = loc.oloc->file; + + /* Retrieve the object's information */ + if(H5O_get_info(&oloc, H5AC_ind_dxpl_id, TRUE, obj_info) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve object info") + break; } - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object") + /* H5Oget_comment / H5Oget_comment_by_name */ + case H5VL_OBJECT_GET_COMMENT: + { + ssize_t *ret = va_arg (arguments, ssize_t *); + char *comment = va_arg (arguments, char *); + size_t bufsize = va_arg (arguments, size_t); + + if(3 == num_args) { + /* Retrieve the object's comment */ + if((*ret = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize, + H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + } + else if(5 == num_args) { + char *name = va_arg (arguments, char *); + hid_t lapl_id = va_arg (arguments, hid_t); + + /* Retrieve the object's comment */ + if((*ret = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize, lapl_id, H5AC_ind_dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + } + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object") } done: /* Release the object location @@ -1179,48 +1173,46 @@ H5VL_native_object_lookup(hid_t loc_id, H5VL_object_lookup_t lookup_type, H5G_loc_reset(&obj_loc); switch (lookup_type) { - case H5VL_OBJECT_LOOKUP: - { + case H5VL_OBJECT_LOOKUP: obj_addr = loc.oloc->addr; break; - } - case H5VL_OBJECT_LOOKUP_BY_NAME: - { - char *name = va_arg (arguments, char *); - hid_t lapl_id = va_arg (arguments, hid_t); - - HDassert(name && *name); - - /* Find the object's location */ - if((ret_value = H5G_loc_find(&loc, name, &obj_loc/*out*/, lapl_id, H5AC_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") - loc_found = TRUE; - obj_addr = (haddr_t)obj_loc.oloc->addr; - break; - } - case H5VL_OBJECT_LOOKUP_BY_IDX: - { - char *group_name = va_arg (arguments, char *); - H5_index_t idx_type = va_arg (arguments, H5_index_t); - H5_iter_order_t order = va_arg (arguments, H5_iter_order_t); - hsize_t n = va_arg (arguments, hsize_t); - hid_t lapl_id = va_arg (arguments, hid_t); - - /* Find the object's location, according to the order in the index */ - if((ret_value = H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, - &obj_loc/*out*/, lapl_id, H5AC_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") - loc_found = TRUE; - obj_addr = (haddr_t)obj_loc.oloc->addr; - break; - } - case H5VL_OBJECT_LOOKUP_BY_ADDR: - { - obj_addr = va_arg (arguments, haddr_t); - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't lookup this object") + case H5VL_OBJECT_LOOKUP_BY_NAME: + { + char *name = va_arg (arguments, char *); + hid_t lapl_id = va_arg (arguments, hid_t); + + HDassert(name && *name); + + /* Find the object's location */ + if((ret_value = H5G_loc_find(&loc, name, &obj_loc/*out*/, lapl_id, H5AC_dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + loc_found = TRUE; + obj_addr = (haddr_t)obj_loc.oloc->addr; + break; + } + case H5VL_OBJECT_LOOKUP_BY_IDX: + { + char *group_name = va_arg (arguments, char *); + H5_index_t idx_type = va_arg (arguments, H5_index_t); + H5_iter_order_t order = va_arg (arguments, H5_iter_order_t); + hsize_t n = va_arg (arguments, hsize_t); + hid_t lapl_id = va_arg (arguments, hid_t); + + /* Find the object's location, according to the order in the index */ + if((ret_value = H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, + &obj_loc/*out*/, lapl_id, H5AC_dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") + loc_found = TRUE; + obj_addr = (haddr_t)obj_loc.oloc->addr; + break; + } + case H5VL_OBJECT_LOOKUP_BY_ADDR: + { + obj_addr = va_arg (arguments, haddr_t); + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't lookup this object") } *location[0] = obj_addr; diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 9cdadb1..ac7c1d2 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -55,8 +55,7 @@ H5_DLL hid_t H5VL_register(const void *cls, size_t size, hbool_t app_ref); H5_DLL herr_t H5VL_replace_with_uids(hid_t *oid_list, ssize_t num_ids); H5_DLL int H5VL_inc_ref_uid(hid_t fid, hbool_t app_ref); -H5_DLL hid_t H5VL_file_open(const char *name, unsigned flags, hid_t fcpl_id, - hid_t fapl_id, hid_t dxpl_id); +H5_DLL hid_t H5VL_file_open(const char *name, unsigned flags, hid_t fapl_id); H5_DLL hid_t H5VL_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); H5_DLL herr_t H5VL_file_close(hid_t file_id); H5_DLL herr_t H5VL_file_flush(hid_t file_id, H5F_scope_t scope); diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 02e90f3..1702148 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -78,7 +78,7 @@ typedef enum H5VL_object_lookup_t { /* H5F routines */ typedef struct H5VL_file_class_t { hid_t (*create)(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); - hid_t (*open) (const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id); + hid_t (*open) (const char *name, unsigned flags, hid_t fapl_id); herr_t (*flush) (hid_t file_id, H5F_scope_t scope); herr_t (*get) (hid_t file_id, H5VL_file_get_t get_type, int num_args, va_list arguments); herr_t (*close) (hid_t file_id); |