diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5A.c | 3 | ||||
-rw-r--r-- | src/H5Aint.c | 59 | ||||
-rw-r--r-- | src/H5D.c | 1 | ||||
-rw-r--r-- | src/H5Dint.c | 3 | ||||
-rw-r--r-- | src/H5Doh.c | 5 | ||||
-rw-r--r-- | src/H5F.c | 4 | ||||
-rw-r--r-- | src/H5Fefc.c | 1 | ||||
-rw-r--r-- | src/H5G.c | 4 | ||||
-rw-r--r-- | src/H5Gdeprec.c | 25 | ||||
-rw-r--r-- | src/H5Gint.c | 1 | ||||
-rw-r--r-- | src/H5Goh.c | 5 | ||||
-rw-r--r-- | src/H5Gtraverse.c | 9 | ||||
-rw-r--r-- | src/H5I.c | 17 | ||||
-rw-r--r-- | src/H5L.c | 9 | ||||
-rw-r--r-- | src/H5Lexternal.c | 2 | ||||
-rw-r--r-- | src/H5O.c | 10 | ||||
-rw-r--r-- | src/H5R.c | 7 | ||||
-rw-r--r-- | src/H5Rdeprec.c | 11 | ||||
-rw-r--r-- | src/H5T.c | 4 | ||||
-rw-r--r-- | src/H5Toh.c | 12 | ||||
-rw-r--r-- | src/H5VLint.c | 2 | ||||
-rw-r--r-- | src/H5VLnative.c | 24 |
22 files changed, 128 insertions, 90 deletions
@@ -971,7 +971,8 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* get the name through the VOL */ - if(H5VL_attr_get(obj, vol_plugin, H5VL_ATTR_GET_NAME, H5_REQUEST_NULL, loc_params, size, name, &ret_value) < 0) + if(H5VL_attr_get(obj, vol_plugin, H5VL_ATTR_GET_NAME, H5_REQUEST_NULL, + loc_params, size, name, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get name") #if 0 diff --git a/src/H5Aint.c b/src/H5Aint.c index 687dfc9..5aa0dcd 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -43,7 +43,8 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Opkg.h" /* Object headers */ #include "H5SMprivate.h" /* Shared Object Header Messages */ - +#include "H5VLnative.h" /* Native Plugin */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ /* Local Macros */ @@ -149,6 +150,7 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, hssize_t snelmts; /* elements in attribute */ size_t nelmts; /* elements in attribute */ htri_t tri_ret; /* htri_t return value */ + H5A_t *attr = NULL; H5A_t *ret_value = NULL; /* Attribute created */ FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, loc->oloc->addr, NULL) @@ -178,15 +180,15 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, HGOTO_ERROR(H5E_ATTR, H5E_BADTYPE, NULL, "datatype is not sensible") /* Build the attribute information */ - if(NULL == (ret_value = H5FL_CALLOC(H5A_t))) + if(NULL == (attr = H5FL_CALLOC(H5A_t))) HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, NULL, "memory allocation failed for attribute info") - if(NULL == (ret_value->shared = H5FL_CALLOC(H5A_shared_t))) + if(NULL == (attr->shared = H5FL_CALLOC(H5A_shared_t))) HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, NULL, "can't allocate shared attr structure") /* If the creation property list is H5P_DEFAULT, use the default character encoding */ if(acpl_id == H5P_DEFAULT) - ret_value->shared->encoding = H5F_DEFAULT_CSET; + attr->shared->encoding = H5F_DEFAULT_CSET; else { H5P_genplist_t *ac_plist; /* ACPL Property list */ @@ -194,57 +196,57 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, if(NULL == (ac_plist = (H5P_genplist_t *)H5I_object(acpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list") - if(H5P_get(ac_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &(ret_value->shared->encoding)) < 0) + if(H5P_get(ac_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &(attr->shared->encoding)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get character encoding flag") } /* end else */ /* Copy the attribute name */ - ret_value->shared->name = H5MM_xstrdup(name); + attr->shared->name = H5MM_xstrdup(name); /* Copy datatype */ - if(NULL == (ret_value->shared->dt = H5T_copy(type, H5T_COPY_ALL))) + if(NULL == (attr->shared->dt = H5T_copy(type, H5T_COPY_ALL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't get shared datatype info") /* Mark datatype as being on disk now */ - if(H5T_set_loc(ret_value->shared->dt, loc->oloc->file, H5T_LOC_DISK) < 0) + if(H5T_set_loc(attr->shared->dt, loc->oloc->file, H5T_LOC_DISK) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location") /* Set the latest format for datatype, if requested */ if(H5F_USE_LATEST_FORMAT(loc->oloc->file)) - if(H5T_set_latest_version(ret_value->shared->dt) < 0) + if(H5T_set_latest_version(attr->shared->dt) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of datatype") /* Copy the dataspace for the attribute */ - ret_value->shared->ds = H5S_copy(space, FALSE, TRUE); + attr->shared->ds = H5S_copy(space, FALSE, TRUE); /* Set the latest format for dataspace, if requested */ if(H5F_USE_LATEST_FORMAT(loc->oloc->file)) - if(H5S_set_latest_version(ret_value->shared->ds) < 0) + if(H5S_set_latest_version(attr->shared->ds) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of dataspace") /* Copy the object header information */ - if(H5O_loc_copy(&(ret_value->oloc), loc->oloc, H5_COPY_DEEP) < 0) + if(H5O_loc_copy(&(attr->oloc), loc->oloc, H5_COPY_DEEP) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to copy entry") /* Deep copy of the group hierarchy path */ - if(H5G_name_copy(&(ret_value->path), loc->path, H5_COPY_DEEP) < 0) + if(H5G_name_copy(&(attr->path), loc->path, H5_COPY_DEEP) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "unable to copy path") /* Check if any of the pieces should be (or are already) shared in the * SOHM table */ - if(H5SM_try_share(ret_value->oloc.file, dxpl_id, NULL, 0, H5O_DTYPE_ID, ret_value->shared->dt, NULL) < 0) + if(H5SM_try_share(attr->oloc.file, dxpl_id, NULL, 0, H5O_DTYPE_ID, attr->shared->dt, NULL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share datatype failed") - if(H5SM_try_share(ret_value->oloc.file, dxpl_id, NULL, 0, H5O_SDSPACE_ID, ret_value->shared->ds, NULL) < 0) + if(H5SM_try_share(attr->oloc.file, dxpl_id, NULL, 0, H5O_SDSPACE_ID, attr->shared->ds, NULL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share dataspace failed") /* Check whether datatype is committed & increment ref count * (to maintain ref. count incr/decr similarity with "shared message" * type of datatype sharing) */ - if(H5T_committed(ret_value->shared->dt)) { + if(H5T_committed(attr->shared->dt)) { /* Increment the reference count on the shared datatype */ - if(H5T_link(ret_value->shared->dt, 1, dxpl_id) < 0) + if(H5T_link(attr->shared->dt, 1, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, NULL, "unable to adjust shared datatype link count") } /* end if */ @@ -252,32 +254,35 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, * datatype and dataspace messages themselves, or the size of the "shared" * messages if either or both of them are shared. */ - ret_value->shared->dt_size = H5O_msg_raw_size(ret_value->oloc.file, H5O_DTYPE_ID, FALSE, ret_value->shared->dt); - ret_value->shared->ds_size = H5O_msg_raw_size(ret_value->oloc.file, H5O_SDSPACE_ID, FALSE, ret_value->shared->ds); + attr->shared->dt_size = H5O_msg_raw_size(attr->oloc.file, H5O_DTYPE_ID, FALSE, attr->shared->dt); + attr->shared->ds_size = H5O_msg_raw_size(attr->oloc.file, H5O_SDSPACE_ID, FALSE, attr->shared->ds); /* Get # of elements for attribute's dataspace */ - if((snelmts = H5S_GET_EXTENT_NPOINTS(ret_value->shared->ds)) < 0) + if((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, NULL, "dataspace is invalid") H5_ASSIGN_OVERFLOW(nelmts, snelmts, hssize_t, size_t); - HDassert(ret_value->shared->dt_size > 0); - HDassert(ret_value->shared->ds_size > 0); - ret_value->shared->data_size = nelmts * H5T_GET_SIZE(ret_value->shared->dt); + HDassert(attr->shared->dt_size > 0); + HDassert(attr->shared->ds_size > 0); + attr->shared->data_size = nelmts * H5T_GET_SIZE(attr->shared->dt); /* Hold the symbol table entry (and file) open */ - if(H5O_open(&(ret_value->oloc)) < 0) + if(H5O_open(&(attr->oloc)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open") - ret_value->obj_opened = TRUE; + attr->obj_opened = TRUE; /* Set the version to encode the attribute with */ - if(H5A_set_version(ret_value->oloc.file, ret_value) < 0) + if(H5A_set_version(attr->oloc.file, attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, NULL, "unable to update attribute version") /* Insert the attribute into the object header */ - if(H5O_attr_create(&(ret_value->oloc), dxpl_id, ret_value) < 0) + if(H5O_attr_create(&(attr->oloc), dxpl_id, attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, NULL, "unable to create attribute in object header") + ret_value = attr; done: + if(NULL == ret_value && attr && H5A_close(attr)) + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") FUNC_LEAVE_NOAPI_TAG(ret_value, NULL) } /* H5A_create() */ @@ -185,7 +185,6 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, /* get the file object */ if(NULL == (obj = (void *)H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") diff --git a/src/H5Dint.c b/src/H5Dint.c index 09f99e8..780651d 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -34,7 +34,8 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ - +#include "H5VLnative.h" /* Native Plugin */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ /* Local Macros */ diff --git a/src/H5Doh.c b/src/H5Doh.c index 37b0f52..dd0bbb8 100644 --- a/src/H5Doh.c +++ b/src/H5Doh.c @@ -30,7 +30,8 @@ #include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ #include "H5Opkg.h" /* Object headers */ - +#include "H5VLnative.h" /* Native Plugin */ +#include "H5VLprivate.h" /* VOL */ /****************/ /* Local Macros */ @@ -251,6 +252,8 @@ H5O__dset_open(const H5G_loc_t *obj_loc, hid_t lapl_id, hid_t dxpl_id, hbool_t a /* Register an ID for the dataset */ if((ret_value = H5I_register(H5I_DATASET, dset, app_ref)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataset") + if(H5VL_native_register_aux(ret_value) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't attach native vol info to ID") done: if(ret_value < 0) @@ -26,6 +26,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ +#include "H5VLnative.h" /* Native Plugin */ #include "H5VLprivate.h" /* VOL plugins */ /****************/ @@ -1099,12 +1100,11 @@ H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - /* get the file object */ if(NULL == (obj = (void *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(obj, vol_plugin, H5VL_FILE_RESET_MDC_HIT_RATE, H5_REQUEST_NULL, config_ptr) < 0) + if(H5VL_file_optional(obj, vol_plugin, H5VL_FILE_SET_MDC_CONFIG, H5_REQUEST_NULL, config_ptr) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "uanvle to set MDC configuration") done: diff --git a/src/H5Fefc.c b/src/H5Fefc.c index 09a1cfb..98f1d6b 100644 --- a/src/H5Fefc.c +++ b/src/H5Fefc.c @@ -350,7 +350,6 @@ H5F_efc_close(H5F_t *parent, H5F_t *file) /* Get external file cache */ efc = parent->shared->efc; - /* Check if the EFC exists. If it does not, just call H5F_try_close(). We * support this so clients do not have to make 2 different calls depending * on the state of the efc. */ @@ -649,7 +649,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, /* Get the group info through the VOL using the location token */ if((ret_value = H5VL_group_get(obj, vol_plugin, H5VL_GROUP_GET_INFO, H5_REQUEST_NULL, - grp_info, loc_params)) < 0) + loc_params, grp_info)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") done: @@ -716,7 +716,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, /* Get the group info through the VOL using the location token */ if((ret_value = H5VL_group_get(obj, vol_plugin, H5VL_GROUP_GET_INFO, H5_REQUEST_NULL, - grp_info, loc_params)) < 0) + loc_params, grp_info)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") done: diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index ba3f284..5235dde 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -905,6 +905,7 @@ herr_t H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, void *op_data) { + H5G_loc_t loc; /* Location of object */ H5G_link_iterate_t lnk_op; /* Link operator */ hsize_t last_obj; /* Index of last object looked at */ hsize_t idx; /* Internal location to hold index */ @@ -914,6 +915,8 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, H5TRACE5("e", "i*s*Isx*x", loc_id, name, idx_p, op, op_data); /* Check args */ + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(idx_p && *idx_p < 0) @@ -930,33 +933,13 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, lnk_op.op_func.op_old = op; /* Call private function. */ - if((ret_value = H5G_iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_iterate(&loc, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") /* Set the index we stopped at */ if(idx_p) *idx_p = (int)last_obj; -#if 0 - herr_t ret_value; - - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "i*s*Isx*x", loc_id, name, idx_p, op, op_data); - - /* Check args */ - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(idx_p && *idx_p < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified") - if(!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") - - /* iterate over the links through the VOL */ - if((ret_value = H5VL_link_iterate(loc_id, name, FALSE, H5_INDEX_NAME, H5_ITER_INC, (hsize_t *)idx_p, - op, op_data, H5P_LINK_ACCESS_DEFAULT)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") -#endif - done: FUNC_LEAVE_API(ret_value) } /* end H5Giterate() */ diff --git a/src/H5Gint.c b/src/H5Gint.c index 87c0aa8..7a5e8f4 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -45,6 +45,7 @@ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ +#include "H5VLnative.h" /* Native Plugin */ #include "H5VLprivate.h" /* VOL */ /****************/ diff --git a/src/H5Goh.c b/src/H5Goh.c index c6115db..4109633 100644 --- a/src/H5Goh.c +++ b/src/H5Goh.c @@ -29,7 +29,8 @@ #include "H5Gpkg.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5Opkg.h" /* Object headers */ - +#include "H5VLnative.h" /* Native Plugin */ +#include "H5VLprivate.h" /* VOL */ /****************/ /* Local Macros */ @@ -226,6 +227,8 @@ H5O_group_open(const H5G_loc_t *obj_loc, hid_t UNUSED lapl_id, hid_t dxpl_id, hb /* Register an ID for the group */ if((ret_value = H5I_register(H5I_GROUP, grp, app_ref)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") + if(H5VL_native_register_aux(ret_value) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't attach native vol info to ID") done: if(ret_value < 0) diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 44362b2..ce41d0e 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -45,6 +45,7 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Ppublic.h" /* Property Lists */ #include "H5WBprivate.h" /* Wrapped Buffers */ +#include "H5VLnative.h" /* Native Plugin */ #include "H5VLprivate.h" /* VOL */ /****************/ @@ -180,7 +181,6 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, hid_t lapl_id = (-1); /* LAPL local to this routine */ H5P_genplist_t *lapl; /* LAPL with nlinks set */ hid_t cur_grp = (-1); - H5VL_class_t *vol_plugin; /* VOL structure attached to id */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -210,11 +210,8 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") if((cur_grp = H5I_register(H5I_GROUP, grp, FALSE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group") - - /* attach VOL information to the ID */ - vol_plugin = H5F_get_vol_cls(grp_loc->oloc->file); - if (H5I_register_aux(cur_grp, vol_plugin, (H5I_free_t)H5VL_close) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't attach vol info to ID") + if(H5VL_native_register_aux(cur_grp) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't attach native vol info to ID") /* Check for generic default property list and use link access default if so */ if(_lapl_id == H5P_DEFAULT) { @@ -2180,9 +2180,20 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size) FUNC_ENTER_API(FAIL) H5TRACE3("Zs", "ixz", id, name, size); - /* Get object location */ - if(H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location") + /* add a workaround for named datatypes for now */ + if(H5I_TYPE(id) == H5I_DATATYPE) { + H5T_t *type = NULL, *dt = NULL; + + if(NULL == (dt = (H5T_t *)H5VL_get_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a type") + if(H5G_loc_real((void *)type, H5I_DATATYPE, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + } + else { + /* Get object location */ + if(H5G_loc(id, &loc) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location") + } /* Call internal group routine to retrieve object's name */ if((ret_value = H5G_get_name(&loc, name, size, NULL, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) @@ -316,7 +316,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, } /* Make sure that the VOL plugins are the same */ if(H5L_SAME_LOC != dst_loc_id && H5L_SAME_LOC != src_loc_id) { - if (vol_plugin1 != vol_plugin2) + if (vol_plugin1->cls != vol_plugin2->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") } @@ -400,7 +400,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, } /* Make sure that the VOL plugins are the same */ if(H5L_SAME_LOC != dst_loc_id && H5L_SAME_LOC != src_loc_id) { - if (vol_plugin1 != vol_plugin2) + if (vol_plugin1->cls != vol_plugin2->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") } @@ -564,7 +564,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, } /* Make sure that the VOL plugins are the same */ if(H5L_SAME_LOC != new_loc_id && H5L_SAME_LOC != cur_loc_id) { - if (vol_plugin1 != vol_plugin2) + if (vol_plugin1->cls != vol_plugin2->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") } @@ -2574,7 +2574,6 @@ H5L_delete(H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id) /* Set up user data for unlink operation */ udata.dxpl_id = dxpl_id; - if(H5G_traverse(loc, norm_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK|H5G_TARGET_MOUNT, H5L_delete_cb, &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "can't unlink object") @@ -2737,6 +2736,8 @@ H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name, HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") if((grp_id = H5I_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group ID") + if(H5VL_native_register_aux(grp_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't attach native vol info to ID") if(udata->copy) { if((link_class->copy_func)(udata->lnk->name, grp_id, udata->lnk->u.ud.udata, udata->lnk->u.ud.size) < 0) diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index d0729b1..17bb5e1 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -590,7 +590,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, /* get the file object */ if(NULL == (obj = (void *)H5I_object(link_loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(link_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") @@ -497,7 +497,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, } /* Make sure that the VOL plugins are the same */ if(H5L_SAME_LOC != new_loc_id && H5L_SAME_LOC != obj_id) { - if (vol_plugin1 != vol_plugin2) + if (vol_plugin1->cls != vol_plugin2->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") } @@ -3488,7 +3488,6 @@ H5O_visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, /* (Takes ownership of the obj_loc information) */ if((obj_id = H5O_open_by_loc(&obj_loc, lapl_id, dxpl_id, TRUE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") - if(H5VL_native_register_aux(obj_id) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't attach native vol info to ID") @@ -3503,6 +3502,7 @@ H5O_visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, /* Check for object being a group */ if(oinfo.type == H5O_TYPE_GROUP) { H5G_loc_t start_loc; /* Location of starting group */ + H5G_loc_t vis_loc; /* Location of visited group */ /* Get the location of the starting group */ if(H5G_loc(obj_id, &start_loc) < 0) @@ -3538,8 +3538,12 @@ H5O_visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object node into visited list") } /* end if */ + /* Get the location of the visited group */ + if(H5G_loc(obj_id, &vis_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Call internal group visitation routine */ - if((ret_value = H5G_visit(&obj_loc, ".", idx_type, order, H5O_visit_cb, &udata, lapl_id, dxpl_id)) < 0) + if((ret_value = H5G_visit(&vis_loc, ".", idx_type, order, H5O_visit_cb, &udata, + lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") } /* end if */ @@ -543,6 +543,13 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r if(_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") + /* get the vol object */ + if(NULL == (obj = (void *)H5VL_get_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + /* get the plugin pointer */ + if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") + loc_params.type = H5VL_OBJECT_BY_REF; loc_params.loc_data.loc_by_ref.ref_type = ref_type; loc_params.loc_data.loc_by_ref._ref = _ref; diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index e6850b2..f55675e 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -152,8 +152,8 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(id); - /* get the file object */ - if(NULL == (obj = (void *)H5I_object(id))) + /* get the vol object */ + if(NULL == (obj = (void *)H5VL_get_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(id))) @@ -213,6 +213,13 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) if(_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") + /* get the vol object */ + if(NULL == (obj = (void *)H5VL_get_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + /* get the plugin pointer */ + if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") + loc_params.type = H5VL_OBJECT_BY_REF; loc_params.loc_data.loc_by_ref.ref_type = ref_type; loc_params.loc_data.loc_by_ref._ref = _ref; @@ -3141,10 +3141,6 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method) /* check args */ HDassert(old_dt); - /* Check if the VOL_obj exists, then this type is the one we want to copy */ - //if(NULL != old->vol_obj) - //old_dt = (H5T_t *)(old->vol_obj); - /* Allocate space */ if(NULL == (new_dt = H5FL_MALLOC(H5T_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); diff --git a/src/H5Toh.c b/src/H5Toh.c index 7961706..8454467 100644 --- a/src/H5Toh.c +++ b/src/H5Toh.c @@ -29,7 +29,8 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Opkg.h" /* Object headers */ #include "H5Tpkg.h" /* Datatypes */ - +#include "H5VLnative.h" /* Native Plugin */ +#include "H5VLprivate.h" /* VOL */ /****************/ /* Local Macros */ @@ -146,6 +147,8 @@ H5O_dtype_open(const H5G_loc_t *obj_loc, hid_t UNUSED lapl_id, hid_t dxpl_id, hb /* Register an ID for the datatype */ if((ret_value = H5I_register(H5I_DATATYPE, type, app_ref)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") + if(H5VL_native_register_aux(ret_value) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't attach native vol info to ID") done: if(ret_value < 0) @@ -216,15 +219,18 @@ done: static H5O_loc_t * H5O_dtype_get_oloc(hid_t obj_id) { - H5T_t *type; /* Datatype opened */ + H5T_t *type=NULL, *dt=NULL; /* Datatype opened */ H5O_loc_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Get the datatype */ - if(NULL == (type = (H5T_t *)H5I_object(obj_id))) + if(NULL == (dt = (H5T_t *)H5I_object(obj_id))) HGOTO_ERROR(H5E_OHDR, H5E_BADATOM, NULL, "couldn't get object from ID") + if(NULL == (type = (H5T_t *)H5T_get_named_type(dt))) + type = dt; + /* Get the datatype's object header location */ if(NULL == (ret_value = H5T_oloc(type))) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from object") diff --git a/src/H5VLint.c b/src/H5VLint.c index b0c532a..d70acfe 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -1697,7 +1697,7 @@ H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, H5VL_t *vol_plugi FUNC_ENTER_NOAPI(FAIL) /* check if both objects are associated with the same VOL plugin */ - if (vol_plugin1 != vol_plugin2) + if(vol_plugin1->cls != vol_plugin2->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be copied") if(NULL == vol_plugin1->cls->object_cls.copy) diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 9f79946..07d574d 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -781,8 +781,8 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t UNUSED req, va_l /* Copy the name into the user's buffer, if given */ if(buf) { - HDstrncpy(buf, attr->shared->name, MIN((size_t)(ret_value + 1), buf_size)); - if((size_t)ret_value >= buf_size) + HDstrncpy(buf, attr->shared->name, MIN((size_t)(*ret_val + 1), buf_size)); + if((size_t)(*ret_val) >= buf_size) buf[buf_size - 1]='\0'; } /* end if */ @@ -907,12 +907,12 @@ H5VL_native_attr_remove(void *obj, H5VL_loc_params_t loc_params, const char *att if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Adelete */ + if(H5VL_OBJECT_BY_SELF == loc_params.type) { /* H5Adelete */ /* Delete the attribute from the location */ if(H5O_attr_remove(loc.oloc, attr_name, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") } - else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Adelete_by_name */ + else if(H5VL_OBJECT_BY_NAME == loc_params.type) { /* H5Adelete_by_name */ /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; obj_loc.path = &obj_path; @@ -928,7 +928,7 @@ H5VL_native_attr_remove(void *obj, H5VL_loc_params_t loc_params, const char *att if(H5O_attr_remove(obj_loc.oloc, attr_name, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") } - if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Adelete_by_idx */ + else if(H5VL_OBJECT_BY_IDX == loc_params.type) { /* H5Adelete_by_idx */ /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; obj_loc.path = &obj_path; @@ -1018,6 +1018,20 @@ H5VL_native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") + /* + * Check arguments. We cannot commit an immutable type because H5Tclose() + * normally fails on such types (try H5Tclose(H5T_NATIVE_INT)) but closing + * a named type should always succeed. + */ + if(H5T_STATE_NAMED == dt->shared->state || H5T_STATE_OPEN == dt->shared->state) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "datatype is already committed") + if(H5T_STATE_IMMUTABLE == dt->shared->state) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "datatype is immutable") + + /* Check for a "sensible" datatype to store on disk */ + if(H5T_is_sensible(dt) <= 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "datatype is not sensible") + /* Copy the datatype - the copied one will be the type that is committed, and attached to original datatype above the VOL layer*/ |