diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 14:04:36 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 14:04:36 (GMT) |
commit | f1ba03cea5b82699a984c80bd2deac14fdc8df18 (patch) | |
tree | ebe777c3e0b83f4c4cec9212731da9ebe0a0cfd3 /src/H5Gdeprec.c | |
parent | 10343c197906415388f2a4c8d292e21d25cf7381 (diff) | |
download | hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.zip hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.tar.gz hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.tar.bz2 |
Source formatted
Diffstat (limited to 'src/H5Gdeprec.c')
-rw-r--r-- | src/H5Gdeprec.c | 544 |
1 files changed, 264 insertions, 280 deletions
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 1d85eb7..a731bcf 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -29,30 +29,27 @@ /* Module Setup */ /****************/ -#include "H5Gmodule.h" /* This source code file is part of the H5G module */ - +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5VLprivate.h" /* Virtual Object Layer */ #include "H5VLnative_private.h" /* Native VOL connector */ - /****************/ /* Local Macros */ /****************/ - /******************/ /* Local Typedefs */ /******************/ @@ -60,43 +57,37 @@ #ifndef H5_NO_DEPRECATED_SYMBOLS /* User data for path traversal routine for getting object info */ typedef struct { - H5G_stat_t *statbuf; /* Stat buffer about object */ - hbool_t follow_link; /* Whether we are following a link or not */ - H5F_t *loc_file; /* Pointer to the file the location is in */ + H5G_stat_t *statbuf; /* Stat buffer about object */ + hbool_t follow_link; /* Whether we are following a link or not */ + H5F_t * loc_file; /* Pointer to the file the location is in */ } H5G_trav_goi_t; - /********************/ /* Package Typedefs */ /********************/ - /********************/ /* Local Prototypes */ /********************/ -static herr_t H5G__get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char *name, - const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, - H5G_own_loc_t *own_loc/*out*/); +static herr_t H5G__get_objinfo_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/); #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /*********************/ /* Package Variables */ /*********************/ - /*****************************/ /* Library Private Variables */ /*****************************/ - /*******************/ /* Local Variables */ /*******************/ - #ifndef H5_NO_DEPRECATED_SYMBOLS - + /*------------------------------------------------------------------------- * Function: H5G_map_obj_type * @@ -112,13 +103,13 @@ static herr_t H5G__get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char *name, H5G_obj_t H5G_map_obj_type(H5O_type_t obj_type) { - H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ + H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR /* Map object type to older "group" object type */ - switch(obj_type) { + switch (obj_type) { case H5O_TYPE_GROUP: ret_value = H5G_GROUP; break; @@ -143,7 +134,6 @@ H5G_map_obj_type(H5O_type_t obj_type) FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_map_obj_type() */ - /*------------------------------------------------------------------------- * Function: H5Gcreate1 * @@ -172,82 +162,82 @@ H5G_map_obj_type(H5O_type_t obj_type) hid_t H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) { - void *grp = NULL; /* New group created */ - H5VL_object_t *vol_obj; /* Object of loc_id */ + void * grp = NULL; /* New group created */ + H5VL_object_t * vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; - hid_t tmp_gcpl = H5I_INVALID_HID; /* Temporary group creation property list */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t tmp_gcpl = H5I_INVALID_HID; /* Temporary group creation property list */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*sz", loc_id, name, size_hint); /* Check arguments */ - if(!name || !*name) + if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name given") /* Check if we need to create a non-standard GCPL */ - if(size_hint > 0) { - H5O_ginfo_t ginfo; /* Group info property */ - H5P_genplist_t *gc_plist; /* Property list created */ + if (size_hint > 0) { + H5O_ginfo_t ginfo; /* Group info property */ + H5P_genplist_t *gc_plist; /* Property list created */ /* Get the default property list */ - if(NULL == (gc_plist = (H5P_genplist_t *)H5I_object(H5P_GROUP_CREATE_DEFAULT))) + if (NULL == (gc_plist = (H5P_genplist_t *)H5I_object(H5P_GROUP_CREATE_DEFAULT))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") /* Make a copy of the default property list */ - if((tmp_gcpl = H5P_copy_plist(gc_plist, FALSE)) < 0) + if ((tmp_gcpl = H5P_copy_plist(gc_plist, FALSE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list") /* Get pointer to the copied property list */ - if(NULL == (gc_plist = (H5P_genplist_t *)H5I_object(tmp_gcpl))) + if (NULL == (gc_plist = (H5P_genplist_t *)H5I_object(tmp_gcpl))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") /* Get the group info property */ - if(H5P_get(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) + if (H5P_get(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get group info") /* Set the non-default local heap size hint */ H5_CHECKED_ASSIGN(ginfo.lheap_size_hint, uint32_t, size_hint, size_t); - if(H5P_set(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) + if (H5P_set(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set group info") } else tmp_gcpl = H5P_GROUP_CREATE_DEFAULT; /* Set up collective metadata if appropriate */ - if(H5CX_set_loc(loc_id) < 0) + if (H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read info") /* Set location parameters */ - loc_params.type = H5VL_OBJECT_BY_SELF; - loc_params.obj_type = H5I_get_type(loc_id); + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); /* get the location object */ - if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the group */ - if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, H5P_LINK_CREATE_DEFAULT, tmp_gcpl, - H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if (NULL == + (grp = H5VL_group_create(vol_obj, &loc_params, name, H5P_LINK_CREATE_DEFAULT, tmp_gcpl, + H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ - if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) + if ((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: - if(H5I_INVALID_HID != tmp_gcpl && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT) - if(H5I_dec_ref(tmp_gcpl) < 0) + if (H5I_INVALID_HID != tmp_gcpl && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT) + if (H5I_dec_ref(tmp_gcpl) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release property list") - if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if (H5I_INVALID_HID == ret_value) + if (grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) } /* end H5Gcreate1() */ - /*------------------------------------------------------------------------- * Function: H5Gopen1 * @@ -268,44 +258,43 @@ done: hid_t H5Gopen1(hid_t loc_id, const char *name) { - void *grp = NULL; /* Group opened */ - H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ + void * grp = NULL; /* Group opened */ + H5VL_object_t * vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "i*s", loc_id, name); /* Check args */ - if(!name || !*name) + if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") /* Set location parameters */ - loc_params.type = H5VL_OBJECT_BY_SELF; - loc_params.obj_type = H5I_get_type(loc_id); + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); /* get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the group */ - if(NULL == (grp = H5VL_group_open(vol_obj, &loc_params, name, H5P_GROUP_ACCESS_DEFAULT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if (NULL == (grp = H5VL_group_open(vol_obj, &loc_params, name, H5P_GROUP_ACCESS_DEFAULT, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") /* Get an atom for the group */ - if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) + if ((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: - if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if (H5I_INVALID_HID == ret_value) + if (grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) } /* end H5Gopen1() */ - /*------------------------------------------------------------------------- * Function: H5Glink * @@ -317,66 +306,68 @@ done: herr_t H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new_name) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "iLl*s*s", cur_loc_id, type, cur_name, new_name); /* Check arguments */ - if(!cur_name || !*cur_name) + if (!cur_name || !*cur_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") - if(!new_name || !*new_name) + if (!new_name || !*new_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") /* Set up collective metadata if appropriate */ - if(H5CX_set_loc(cur_loc_id) < 0) + if (H5CX_set_loc(cur_loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Create link */ - if(type == H5L_TYPE_HARD) { - H5VL_object_t *vol_obj; /* Object of loc_id */ + if (type == H5L_TYPE_HARD) { + H5VL_object_t * vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; - H5VL_object_t tmp_vol_obj; /* Temporary object */ + H5VL_object_t tmp_vol_obj; /* Temporary object */ - loc_params1.type = H5VL_OBJECT_BY_NAME; - loc_params1.obj_type = H5I_get_type(cur_loc_id); - loc_params1.loc_data.loc_by_name.name = cur_name; + loc_params1.type = H5VL_OBJECT_BY_NAME; + loc_params1.obj_type = H5I_get_type(cur_loc_id); + loc_params1.loc_data.loc_by_name.name = cur_name; loc_params1.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; - loc_params2.type = H5VL_OBJECT_BY_NAME; - loc_params2.loc_data.loc_by_name.name = new_name; + loc_params2.type = H5VL_OBJECT_BY_NAME; + loc_params2.loc_data.loc_by_name.name = new_name; loc_params2.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; /* get the location object */ - if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id))) + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Construct a temporary VOL object */ - tmp_vol_obj.data = NULL; + tmp_vol_obj.data = NULL; tmp_vol_obj.connector = vol_obj->connector; /* Create the link through the VOL */ - if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, H5P_LINK_CREATE_DEFAULT, - H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj->data, &loc_params1) < 0) + if (H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, H5P_LINK_CREATE_DEFAULT, + H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + vol_obj->data, &loc_params1) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ - else if(type == H5L_TYPE_SOFT) { - H5VL_object_t *vol_obj; /* Object of loc_id */ + else if (type == H5L_TYPE_SOFT) { + H5VL_object_t * vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; - loc_params.type = H5VL_OBJECT_BY_NAME; - loc_params.loc_data.loc_by_name.name = new_name; + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = new_name; loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; - loc_params.obj_type = H5I_get_type(cur_loc_id); + loc_params.obj_type = H5I_get_type(cur_loc_id); /* get the location object */ - if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id))) + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Create the link through the VOL */ - if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, H5P_LINK_CREATE_DEFAULT, - H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, cur_name) < 0) + if (H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, H5P_LINK_CREATE_DEFAULT, + H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + cur_name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end else-if */ else @@ -386,7 +377,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Glink() */ - /*------------------------------------------------------------------------- * Function: H5Glink2 * @@ -396,73 +386,74 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, - hid_t new_loc_id, const char *new_name) +H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_id, const char *new_name) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "i*sLli*s", cur_loc_id, cur_name, type, new_loc_id, new_name); /* Check arguments */ - if(!cur_name || !*cur_name) + if (!cur_name || !*cur_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") - if(!new_name || !*new_name) + if (!new_name || !*new_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") /* Set up collective metadata if appropriate */ - if(H5CX_set_loc(cur_loc_id) < 0) + if (H5CX_set_loc(cur_loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Create the appropriate kind of link */ - if(type == H5L_TYPE_HARD) { - H5VL_object_t *vol_obj1; /* Object of loc_id */ - H5VL_object_t *vol_obj2; /* Object of loc_id */ + if (type == H5L_TYPE_HARD) { + H5VL_object_t * vol_obj1; /* Object of loc_id */ + H5VL_object_t * vol_obj2; /* Object of loc_id */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; - loc_params1.type = H5VL_OBJECT_BY_NAME; - loc_params1.obj_type = H5I_get_type(cur_loc_id); - loc_params1.loc_data.loc_by_name.name = cur_name; + loc_params1.type = H5VL_OBJECT_BY_NAME; + loc_params1.obj_type = H5I_get_type(cur_loc_id); + loc_params1.loc_data.loc_by_name.name = cur_name; loc_params1.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; - loc_params2.type = H5VL_OBJECT_BY_NAME; - loc_params2.obj_type = H5I_get_type(new_loc_id); - loc_params2.loc_data.loc_by_name.name = new_name; + loc_params2.type = H5VL_OBJECT_BY_NAME; + loc_params2.obj_type = H5I_get_type(new_loc_id); + loc_params2.loc_data.loc_by_name.name = new_name; loc_params2.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; /* get the location object */ - if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(cur_loc_id))) + if (NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(cur_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(new_loc_id))) + if (NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(new_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Create the link through the VOL */ - if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, &loc_params2, H5P_LINK_CREATE_DEFAULT, - H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj1->data, &loc_params1) < 0) + if (H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, &loc_params2, H5P_LINK_CREATE_DEFAULT, + H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + vol_obj1->data, &loc_params1) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ - else if(type == H5L_TYPE_SOFT) { - H5VL_object_t *vol_obj; /* Object of loc_id */ + else if (type == H5L_TYPE_SOFT) { + H5VL_object_t * vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; /* Soft links only need one location, the new_loc_id, but it's possible that * new_loc_id is H5L_SAME_LOC */ - if(new_loc_id == H5L_SAME_LOC) + if (new_loc_id == H5L_SAME_LOC) new_loc_id = cur_loc_id; - loc_params.type = H5VL_OBJECT_BY_NAME; - loc_params.loc_data.loc_by_name.name = new_name; + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = new_name; loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; - loc_params.obj_type = H5I_get_type(new_loc_id); + loc_params.obj_type = H5I_get_type(new_loc_id); /* get the location object */ - if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(new_loc_id))) + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(new_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Create the link through the VOL */ - if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, H5P_LINK_CREATE_DEFAULT, - H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, cur_name) < 0) + if (H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, H5P_LINK_CREATE_DEFAULT, + H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + cur_name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end else-if */ else @@ -472,7 +463,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Glink2() */ - /*------------------------------------------------------------------------- * Function: H5Gmove * @@ -483,41 +473,40 @@ done: herr_t H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) { - H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_object_t * vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*s*s", src_loc_id, src_name, dst_name); /* Set up collective metadata if appropriate */ - if(H5CX_set_loc(src_loc_id) < 0) + if (H5CX_set_loc(src_loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - loc_params1.type = H5VL_OBJECT_BY_NAME; - loc_params1.obj_type = H5I_get_type(src_loc_id); - loc_params1.loc_data.loc_by_name.name = src_name; + loc_params1.type = H5VL_OBJECT_BY_NAME; + loc_params1.obj_type = H5I_get_type(src_loc_id); + loc_params1.loc_data.loc_by_name.name = src_name; loc_params1.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; - loc_params2.type = H5VL_OBJECT_BY_NAME; - loc_params2.loc_data.loc_by_name.name = dst_name; + loc_params2.type = H5VL_OBJECT_BY_NAME; + loc_params2.loc_data.loc_by_name.name = dst_name; loc_params2.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; /* get the location object */ - if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(src_loc_id))) + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(src_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Move the link */ - if(H5VL_link_move(vol_obj, &loc_params1, NULL, &loc_params2, H5P_LINK_CREATE_DEFAULT, - H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if (H5VL_link_move(vol_obj, &loc_params1, NULL, &loc_params2, H5P_LINK_CREATE_DEFAULT, + H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link") done: FUNC_LEAVE_API(ret_value) } /* end H5Gmove() */ - /*------------------------------------------------------------------------- * Function: H5Gmove2 * @@ -526,53 +515,51 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, - const char *dst_name) +H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name) { - H5VL_object_t *vol_obj1 = NULL; /* Object of src_id */ + H5VL_object_t * vol_obj1 = NULL; /* Object of src_id */ H5VL_loc_params_t loc_params1; - H5VL_object_t *vol_obj2 = NULL; /* Object of dst_id */ + H5VL_object_t * vol_obj2 = NULL; /* Object of dst_id */ H5VL_loc_params_t loc_params2; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*si*s", src_loc_id, src_name, dst_loc_id, dst_name); /* Set up collective metadata if appropriate */ - if(H5CX_set_loc(dst_loc_id) < 0) + if (H5CX_set_loc(dst_loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Set location parameter for source object */ - loc_params1.type = H5VL_OBJECT_BY_NAME; - loc_params1.loc_data.loc_by_name.name = src_name; + loc_params1.type = H5VL_OBJECT_BY_NAME; + loc_params1.loc_data.loc_by_name.name = src_name; loc_params1.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; - loc_params1.obj_type = H5I_get_type(src_loc_id); + loc_params1.obj_type = H5I_get_type(src_loc_id); /* Set location parameter for destination object */ - loc_params2.type = H5VL_OBJECT_BY_NAME; - loc_params2.loc_data.loc_by_name.name = dst_name; + loc_params2.type = H5VL_OBJECT_BY_NAME; + loc_params2.loc_data.loc_by_name.name = dst_name; loc_params2.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; - loc_params2.obj_type = H5I_get_type(dst_loc_id); + loc_params2.obj_type = H5I_get_type(dst_loc_id); - if(H5L_SAME_LOC != src_loc_id) + if (H5L_SAME_LOC != src_loc_id) /* get the location object */ - if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id))) + if (NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - if(H5L_SAME_LOC != dst_loc_id) + if (H5L_SAME_LOC != dst_loc_id) /* get the location object */ - if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) + if (NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Move the link */ - if(H5VL_link_move(vol_obj1, &loc_params1, vol_obj2, &loc_params2, H5P_LINK_CREATE_DEFAULT, - H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if (H5VL_link_move(vol_obj1, &loc_params1, vol_obj2, &loc_params2, H5P_LINK_CREATE_DEFAULT, + H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link") done: FUNC_LEAVE_API(ret_value) } /* end H5Gmove2() */ - /*------------------------------------------------------------------------- * Function: H5Gunlink * @@ -583,39 +570,39 @@ done: herr_t H5Gunlink(hid_t loc_id, const char *name) { - H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_object_t * vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*s", loc_id, name); /* Check arguments */ - if(!name || !*name) + if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Set up collective metadata if appropriate */ - if(H5CX_set_loc(loc_id) < 0) + if (H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - loc_params.type = H5VL_OBJECT_BY_NAME; - loc_params.obj_type = H5I_get_type(loc_id); - loc_params.loc_data.loc_by_name.name = name; + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = name; loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; /* Get the location object */ - if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Delete the link */ - if(H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if (H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") done: FUNC_LEAVE_API(ret_value) } /* end H5Gunlink() */ - /*------------------------------------------------------------------------- * Function: H5Gget_linkval * @@ -625,41 +612,41 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) +H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf /*out*/) { - H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_object_t * vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*szx", loc_id, name, size, buf); /* Check arguments */ - if(!name || !*name) + if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Set up collective metadata if appropriate */ - if(H5CX_set_loc(loc_id) < 0) + if (H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - loc_params.type = H5VL_OBJECT_BY_NAME; - loc_params.obj_type = H5I_get_type(loc_id); - loc_params.loc_data.loc_by_name.name = name; + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = name; loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; /* Get the location object */ - if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the link value */ - if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) + if (H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, + size) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link value") done: FUNC_LEAVE_API(ret_value) } /* end H5Gget_linkval() */ - /*------------------------------------------------------------------------- * Function: H5Gset_comment * @@ -680,18 +667,18 @@ done: herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment) { - H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_object_t * vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*s*s", loc_id, name, comment); - if(!name || !*name) + if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Set up collective metadata if appropriate */ - if(H5CX_set_loc(loc_id) < 0) + if (H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Fill in location struct fields */ @@ -701,18 +688,18 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment) loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set the comment */ - if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_SET_COMMENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, comment) < 0) + if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_SET_COMMENT, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, &loc_params, comment) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") done: FUNC_LEAVE_API(ret_value) } /* end H5Gset_comment() */ - /*------------------------------------------------------------------------- * Function: H5Gget_comment * @@ -739,21 +726,21 @@ done: int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) { - H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_object_t * vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; - ssize_t op_ret; /* Return value from operation */ - int ret_value; /* Return value */ + ssize_t op_ret; /* Return value from operation */ + int ret_value; /* Return value */ FUNC_ENTER_API(-1) H5TRACE4("Is", "i*sz*s", loc_id, name, bufsize, buf); - if(!name || !*name) + if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, -1, "no name specified") - if(bufsize > 0 && !buf) + if (bufsize > 0 && !buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, -1, "no buffer specified") /* Set up collective metadata if appropriate */ - if(H5CX_set_loc(loc_id) < 0) + if (H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, -1, "can't set collective metadata read info") /* Fill in location struct fields */ @@ -763,11 +750,12 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, -1, "invalid location identifier") /* Get the comment */ - if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_COMMENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, buf, bufsize, &op_ret) < 0) + if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_COMMENT, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, &loc_params, buf, bufsize, &op_ret) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, -1, "unable to get comment value") /* Set return value */ @@ -777,7 +765,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Gget_comment() */ - /*------------------------------------------------------------------------- * Function: H5Giterate * @@ -803,33 +790,32 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, - void *op_data) +H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, void *op_data) { - H5VL_object_t *vol_obj; /* Object of loc_id */ - H5VL_loc_params_t loc_params; - 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 */ - herr_t ret_value; /* Return value */ + H5VL_object_t * vol_obj; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + 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 */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "i*s*Isx*x", loc_id, name, idx_p, op, op_data); /* Check args */ - if(!name || !*name) + if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(idx_p && *idx_p < 0) + if (idx_p && *idx_p < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified") - if(!op) + if (!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") /* Set number of objects looked at to zero */ last_obj = 0; - idx = (hsize_t)(idx_p == NULL ? 0 : *idx_p); + idx = (hsize_t)(idx_p == NULL ? 0 : *idx_p); /* Build link operator info */ - lnk_op.op_type = H5G_LINK_OP_OLD; + lnk_op.op_type = H5G_LINK_OP_OLD; lnk_op.op_func.op_old = op; /* Fill out location struct */ @@ -839,22 +825,22 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, loc_params.obj_type = H5I_get_type(loc_id); /* Get the object pointer */ - if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") /* Call private iteration function, through VOL callback */ - if((ret_value = H5VL_group_optional(vol_obj, H5VL_NATIVE_GROUP_ITERATE_OLD, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, idx, &last_obj, &lnk_op, op_data)) < 0) + if ((ret_value = H5VL_group_optional(vol_obj, H5VL_NATIVE_GROUP_ITERATE_OLD, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, &loc_params, idx, &last_obj, &lnk_op, op_data)) < 0) HERROR(H5E_SYM, H5E_BADITER, "error iterating over group's links"); /* Set the index we stopped at */ - if(idx_p) + if (idx_p) *idx_p = (int)last_obj; done: FUNC_LEAVE_API(ret_value) } /* end H5Giterate() */ - /*------------------------------------------------------------------------- * Function: H5Gget_num_objs * @@ -874,20 +860,20 @@ done: herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs) { - H5VL_object_t *vol_obj; /* Object of loc_id */ - H5I_type_t id_type; /* Type of ID */ - H5VL_loc_params_t loc_params; - H5G_info_t grp_info; /* Group information */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t * vol_obj; /* Object of loc_id */ + H5I_type_t id_type; /* Type of ID */ + H5VL_loc_params_t loc_params; + H5G_info_t grp_info; /* Group information */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", loc_id, num_objs); /* Check args */ id_type = H5I_get_type(loc_id); - if(!(H5I_GROUP == id_type || H5I_FILE == id_type)) + if (!(H5I_GROUP == id_type || H5I_FILE == id_type)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group (or file) ID") - if(!num_objs) + if (!num_objs) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad pointer to # of objects") /* Fill in location struct fields */ @@ -895,11 +881,12 @@ H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs) loc_params.obj_type = id_type; /* Get group location */ - if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the group's information */ - if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, &grp_info) < 0) + if (H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, + &grp_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info") /* Set the number of objects [i.e. links] in the group */ @@ -909,7 +896,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Gget_num_objs() */ - /*------------------------------------------------------------------------- * Function: H5Gget_objinfo * @@ -928,22 +914,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, - H5G_stat_t *statbuf/*out*/) +H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, H5G_stat_t *statbuf /*out*/) { - H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ - H5VL_loc_params_t loc_params; - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t * vol_obj = NULL; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL); H5TRACE4("e", "i*sbx", loc_id, name, follow_link, statbuf); /* Check arguments */ - if(!name || !*name) + if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Set up collective metadata if appropriate */ - if(H5CX_set_loc(loc_id) < 0) + if (H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info"); /* Retrieve object info */ @@ -954,18 +939,18 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Retrieve the object's information */ - if(H5VL_group_optional(vol_obj, H5VL_NATIVE_GROUP_GET_OBJINFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, (unsigned)follow_link, statbuf) < 0) + if (H5VL_group_optional(vol_obj, H5VL_NATIVE_GROUP_GET_OBJINFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + &loc_params, (unsigned)follow_link, statbuf) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name); done: FUNC_LEAVE_API(ret_value); } /* end H5Gget_objinfo() */ - /*------------------------------------------------------------------------- * Function: H5G__get_objinfo_cb * @@ -980,48 +965,49 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, - H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) +H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/) { - H5G_trav_goi_t *udata = (H5G_trav_goi_t *)_udata; /* User data passed in */ - herr_t ret_value = SUCCEED; /* Return value */ + H5G_trav_goi_t *udata = (H5G_trav_goi_t *)_udata; /* User data passed in */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Check if the name in this group resolved to a valid link */ - if(lnk == NULL && obj_loc == NULL) + if (lnk == NULL && obj_loc == NULL) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "'%s' doesn't exist", name); /* Only modify user's buffer if it's available */ - if(udata->statbuf) { - H5G_stat_t *statbuf = udata->statbuf; /* Convenience pointer for statbuf */ + if (udata->statbuf) { + H5G_stat_t *statbuf = udata->statbuf; /* Convenience pointer for statbuf */ /* Common code to retrieve the file's fileno */ - if(H5F_get_fileno((obj_loc ? obj_loc : grp_loc)->oloc->file, &statbuf->fileno[0]) < 0) + if (H5F_get_fileno((obj_loc ? obj_loc : grp_loc)->oloc->file, &statbuf->fileno[0]) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "unable to read fileno"); /* Info for soft and UD links is gotten by H5L_get_info. If we have * a hard link, follow it and get info on the object */ - if(udata->follow_link || !lnk || (lnk->type == H5L_TYPE_HARD)) { - H5O_info2_t dm_info; /* Data model information */ - H5O_native_info_t nat_info; /* Native information */ - haddr_t obj_addr; /* Address of object */ + if (udata->follow_link || !lnk || (lnk->type == H5L_TYPE_HARD)) { + H5O_info2_t dm_info; /* Data model information */ + H5O_native_info_t nat_info; /* Native information */ + haddr_t obj_addr; /* Address of object */ /* Go retrieve the data model & native object information */ /* (don't need index & heap info) */ HDassert(obj_loc); - if(H5O_get_info(obj_loc->oloc, &dm_info, H5O_INFO_BASIC | H5O_INFO_TIME) < 0) + if (H5O_get_info(obj_loc->oloc, &dm_info, H5O_INFO_BASIC | H5O_INFO_TIME) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get data model object info") - if(H5O_get_native_info(obj_loc->oloc, &nat_info, H5O_INFO_HDR) < 0) + if (H5O_get_native_info(obj_loc->oloc, &nat_info, H5O_INFO_HDR) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get native object info") /* Get mapped object type */ statbuf->type = H5G_map_obj_type(dm_info.type); /* Get object number (i.e. address) for object */ - if(H5VL_native_token_to_addr(obj_loc->oloc->file, H5I_FILE, dm_info.token, &obj_addr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") + if (H5VL_native_token_to_addr(obj_loc->oloc->file, H5I_FILE, dm_info.token, &obj_addr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, + "can't deserialize object token into address") statbuf->objno[0] = (unsigned long)(obj_addr); #if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG @@ -1036,12 +1022,12 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, c statbuf->mtime = dm_info.ctime; /* Retrieve the object header information */ - statbuf->ohdr.size = nat_info.hdr.space.total; - statbuf->ohdr.free = nat_info.hdr.space.free; - statbuf->ohdr.nmesgs = nat_info.hdr.nmesgs; + statbuf->ohdr.size = nat_info.hdr.space.total; + statbuf->ohdr.free = nat_info.hdr.space.free; + statbuf->ohdr.nmesgs = nat_info.hdr.nmesgs; statbuf->ohdr.nchunks = nat_info.hdr.nchunks; } /* end if */ - } /* end if */ + } /* end if */ done: /* Indicate that this callback didn't take ownership of the group * @@ -1051,7 +1037,6 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5G__get_objinfo_cb() */ - /*------------------------------------------------------------------------- * Function: H5G__get_objinfo * @@ -1069,11 +1054,10 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, - H5G_stat_t *statbuf/*out*/) +H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, H5G_stat_t *statbuf /*out*/) { - H5G_trav_goi_t udata; /* User data for callback */ - herr_t ret_value = SUCCEED; /* Return value */ + H5G_trav_goi_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE; @@ -1082,28 +1066,29 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, HDassert(name && *name); /* Reset stat buffer */ - if(statbuf) + if (statbuf) HDmemset(statbuf, 0, sizeof(H5G_stat_t)); /* Set up user data for retrieving information */ - udata.statbuf = statbuf; + udata.statbuf = statbuf; udata.follow_link = follow_link; - udata.loc_file = loc->oloc->file; + udata.loc_file = loc->oloc->file; /* Traverse the group hierarchy to locate the object to get info about */ - if(H5G_traverse(loc, name, (unsigned)(follow_link ? H5G_TARGET_NORMAL : (H5G_TARGET_SLINK | H5G_TARGET_UDLINK)), H5G__get_objinfo_cb, &udata) < 0) + if (H5G_traverse(loc, name, + (unsigned)(follow_link ? H5G_TARGET_NORMAL : (H5G_TARGET_SLINK | H5G_TARGET_UDLINK)), + H5G__get_objinfo_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist"); /* If we're pointing at a soft or UD link, get the real link length and type */ - if(statbuf && follow_link == 0) { - H5L_info2_t linfo; /* Link information buffer */ - herr_t ret; + if (statbuf && follow_link == 0) { + H5L_info2_t linfo; /* Link information buffer */ + herr_t ret; /* Get information about link to the object. If this fails, e.g. * because the object is ".", just treat the object as a hard link. */ - H5E_BEGIN_TRY { - ret = H5L_get_info(loc, name, &linfo); - } H5E_END_TRY; + H5E_BEGIN_TRY { ret = H5L_get_info(loc, name, &linfo); } + H5E_END_TRY; if (ret >= 0 && linfo.type != H5L_TYPE_HARD) { statbuf->linklen = linfo.u.val_size; @@ -1122,7 +1107,6 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5G__get_objinfo() */ - /*------------------------------------------------------------------------- * Function: H5Gget_objname_by_idx * @@ -1149,15 +1133,15 @@ done: ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size) { - H5VL_object_t *vol_obj; /* Object of loc_id */ - H5VL_loc_params_t loc_params; - ssize_t ret_value; /* Return value */ + H5VL_object_t * vol_obj; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("Zs", "ih*sz", loc_id, idx, name, size); /* Set up collective metadata if appropriate */ - if(H5CX_set_loc(loc_id) < 0) + if (H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, (-1), "can't set collective metadata read info") /* Fill in location struct fields */ @@ -1170,18 +1154,18 @@ H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size) loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Call internal function */ - if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0) + if (H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + name, size, &ret_value) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "can't get object name") done: FUNC_LEAVE_API(ret_value) } /* end H5Gget_objname_by_idx() */ - /*------------------------------------------------------------------------- * Function: H5Gget_objtype_by_idx * @@ -1200,37 +1184,37 @@ done: H5G_obj_t H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) { - H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_object_t * vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; - H5O_info2_t oinfo; /* Object info (contains object type) */ - H5G_obj_t ret_value; /* Return value */ + H5O_info2_t oinfo; /* Object info (contains object type) */ + H5G_obj_t ret_value; /* Return value */ FUNC_ENTER_API(H5G_UNKNOWN) H5TRACE2("Go", "ih", loc_id, idx); /* Set location parameters */ - loc_params.type = H5VL_OBJECT_BY_IDX; - loc_params.loc_data.loc_by_idx.name = "."; + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = "."; loc_params.loc_data.loc_by_idx.idx_type = H5_INDEX_NAME; - loc_params.loc_data.loc_by_idx.order = H5_ITER_INC; - loc_params.loc_data.loc_by_idx.n = idx; + loc_params.loc_data.loc_by_idx.order = H5_ITER_INC; + loc_params.loc_data.loc_by_idx.n = idx; loc_params.loc_data.loc_by_idx.lapl_id = H5P_LINK_ACCESS_DEFAULT; - loc_params.obj_type = H5I_get_type(loc_id); + loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier") /* Retrieve the object's basic information (which includes its type) */ - if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &oinfo, H5O_INFO_BASIC) < 0) + if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + &oinfo, H5O_INFO_BASIC) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object info") /* Map to group object type */ - if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(oinfo.type))) + if (H5G_UNKNOWN == (ret_value = H5G_map_obj_type(oinfo.type))) HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type") done: FUNC_LEAVE_API(ret_value) } /* end H5Gget_objtype_by_idx() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - |