diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-07-23 21:38:44 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-07-23 21:38:44 (GMT) |
commit | ad690e7be37389bdb48af7dc08b37bbd3a75aa86 (patch) | |
tree | 3d13da365c48a4e432deb367d158c1a3a13c92e1 /src | |
parent | 89456ae48793e7063298980277e718491db13813 (diff) | |
download | hdf5-ad690e7be37389bdb48af7dc08b37bbd3a75aa86.zip hdf5-ad690e7be37389bdb48af7dc08b37bbd3a75aa86.tar.gz hdf5-ad690e7be37389bdb48af7dc08b37bbd3a75aa86.tar.bz2 |
[svn-r25476] - fix error output in several places.
- uncomment tests to check error output in Makefiles.
- fix bug in native implementation of H5Aiterate.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5A.c | 6 | ||||
-rw-r--r-- | src/H5D.c | 8 | ||||
-rw-r--r-- | src/H5Dio.c | 4 | ||||
-rw-r--r-- | src/H5G.c | 2 | ||||
-rw-r--r-- | src/H5L.c | 4 | ||||
-rw-r--r-- | src/H5O.c | 6 | ||||
-rw-r--r-- | src/H5R.c | 2 | ||||
-rw-r--r-- | src/H5Tcommit.c | 2 | ||||
-rw-r--r-- | src/H5VLint.c | 10 | ||||
-rw-r--r-- | src/H5VLnative.c | 17 |
10 files changed, 36 insertions, 25 deletions
@@ -434,7 +434,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) /* Create the attribute through the VOL */ if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin, attr_name, aapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open attribute") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") /* Get an atom for the attribute */ if((ret_value = H5I_register2(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) @@ -510,7 +510,7 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, /* Create the attribute through the VOL */ if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin, attr_name, aapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open attribute") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") /* Get an atom for the attribute */ if((ret_value = H5I_register2(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) @@ -595,7 +595,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Create the attribute through the VOL */ if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin, NULL, aapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open attribute") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") /* Get an atom for the attribute */ if((ret_value = H5I_register2(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) @@ -200,7 +200,7 @@ 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") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") /* 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") @@ -299,7 +299,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, /* get the file object */ if(NULL == (obj = (void *)H5VL_get_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(loc_id))) @@ -366,7 +366,7 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) /* get the file object */ if(NULL == (obj = (void *)H5VL_get_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(loc_id))) @@ -374,7 +374,7 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) /* Create the dataset through the VOL */ if(NULL == (dset = H5VL_dataset_open(obj, loc_params, vol_plugin, name, dapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset") /* Get an atom for the dataset */ if((ret_value = H5I_register2(H5I_DATASET, dset, vol_plugin, TRUE)) < 0) diff --git a/src/H5Dio.c b/src/H5Dio.c index cd4dae4..3afdb04 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -132,7 +132,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, /* check arguments */ if(NULL == (dset = (void *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") if(mem_space_id < 0 || file_space_id < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") @@ -223,7 +223,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, /* check arguments */ if(NULL == (dset = (void *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") /* Get the default dataset transfer property list if the user didn't provide one */ if(H5P_DEFAULT == dxpl_id) @@ -483,7 +483,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) /* Create the group through the VOL */ if(NULL == (grp = H5VL_group_open(obj, loc_params, vol_plugin, name, gapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") /* Get an atom for the group */ if((ret_value = H5I_register2(H5I_GROUP, grp, vol_plugin, TRUE)) < 0) @@ -1050,7 +1050,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, /* Get the link info through the VOL */ if((ret_value = H5VL_link_get(obj, loc_params, vol_plugin, H5VL_LINK_GET_INFO, H5AC_dxpl_id, H5_EVENT_STACK_NULL, linfo)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) @@ -1116,7 +1116,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, /* Get the link info through the VOL */ if((ret_value = H5VL_link_get(obj, loc_params, vol_plugin, H5VL_LINK_GET_INFO, H5AC_dxpl_id, H5_EVENT_STACK_NULL, linfo)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) @@ -256,7 +256,7 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) /* Open the object through the VOL */ if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin, &opened_type, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open object") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") if ((ret_value = H5VL_object_register(opened_obj, opened_type, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") @@ -333,7 +333,7 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, /* Open the object through the VOL */ if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin, &opened_type, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open object") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") if ((ret_value = H5VL_object_register(opened_obj, opened_type, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") @@ -404,7 +404,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) /* Open the object through the VOL */ if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin, &opened_type, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open object") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") if ((ret_value = H5VL_object_register(opened_obj, opened_type, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") @@ -605,7 +605,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r /* Open the object through the VOL */ if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin, &opened_type, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open object") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to dereference object") /* Get an atom for the object */ if ((ret_value = H5VL_object_register(opened_obj, opened_type, vol_plugin, TRUE)) < 0) diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index cab6223..40024ff 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -622,7 +622,7 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) /* Create the datatype through the VOL */ if(NULL == (dt = H5VL_datatype_open(obj, loc_params, vol_plugin, name, tapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open datatype") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open datatype") /* Get an atom for the datatype */ if ((ret_value = H5VL_create_datatype(dt, vol_plugin, TRUE)) < 0) diff --git a/src/H5VLint.c b/src/H5VLint.c index 65250a1..fe3b794 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -523,7 +523,7 @@ H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, cons HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "vol plugin has no `attr open' method") /* call the corresponding VOL open callback */ if(NULL == (ret_value = (vol_plugin->cls->attr_cls.open) (obj, loc_params, name, aapl_id, dxpl_id, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "attribute open failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed") vol_plugin->nrefs ++; done: @@ -829,7 +829,7 @@ H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, #endif /* call the corresponding VOL open callback */ if(NULL == (ret_value = (vol_plugin->cls->datatype_cls.open)(obj, loc_params, name, tapl_id, dxpl_id, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "open failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") vol_plugin->nrefs ++; done: @@ -1015,7 +1015,7 @@ H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, c else { /* call the corresponding VOL open callback */ if(NULL == (ret_value = (vol_plugin->cls->dataset_cls.open)(obj, loc_params, name, dapl_id, dxpl_id, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "open failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") vol_plugin->nrefs ++; } @@ -1599,7 +1599,7 @@ H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, con else { /* call the corresponding VOL open callback */ if(NULL == (ret_value = (vol_plugin->cls->group_cls.open)(obj, loc_params, name, gapl_id, dxpl_id, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "open failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") vol_plugin->nrefs ++; } done: @@ -1882,7 +1882,7 @@ H5VL_object_open(void *obj, H5VL_loc_params_t params, H5VL_t *vol_plugin, H5I_ty HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "vol plugin has no `object open' method") /* call the corresponding VOL open callback */ if(NULL == (ret_value = (vol_plugin->cls->object_cls.open)(obj, params, opened_type, dxpl_id, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "open failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") vol_plugin->nrefs++; done: diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 4dcd2ba..c26f68b 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -660,6 +660,7 @@ static herr_t H5VL_native_attr_iterate(void *obj, H5VL_loc_params_t loc_params, hsize_t last_attr; /* Index of last attribute examined */ void *temp_obj = NULL; H5I_type_t obj_type; + H5VL_t *vol_plugin = NULL; /* VOL plugin information */ herr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -677,9 +678,15 @@ static herr_t H5VL_native_attr_iterate(void *obj, H5VL_loc_params_t loc_params, /* Iterate over the links */ if(loc_params.type == H5VL_OBJECT_BY_SELF) { + /* Build the vol plugin struct */ + if(NULL == (vol_plugin = (H5VL_t *)H5MM_calloc(sizeof(H5VL_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + vol_plugin->cls = &H5VL_native_g; + vol_plugin->nrefs = 1; + /* Get an atom for the object */ - if((obj_loc_id = H5VL_native_register(loc_params.obj_type, obj, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register object"); + if((obj_loc_id = H5I_register2(loc_params.obj_type, obj, vol_plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register object") } else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* Set up opened group location to fill in */ @@ -724,7 +731,11 @@ done: /* Release resources */ if(loc_params.type == H5VL_OBJECT_BY_SELF) { if(obj_loc_id >= 0 && NULL == H5I_remove(obj_loc_id)) - HDONE_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object"); + HDONE_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to free identifier"); + + vol_plugin->nrefs--; + if(0 == vol_plugin->nrefs) + H5MM_free(vol_plugin); } else if(loc_params.type == H5VL_OBJECT_BY_NAME) { if(obj_loc_id >= 0) { |