diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
commit | b2d661b508a7fc7a2592c13bc6bdc175551f075d (patch) | |
tree | 13baeb0d83a7c2a4c6299993c182b1227c2f6114 /src/H5VLnative_group.c | |
parent | 29ab58b58dce556639ea3154e262895773a8a8df (diff) | |
download | hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2 |
Clang-format of source files
Diffstat (limited to 'src/H5VLnative_group.c')
-rw-r--r-- | src/H5VLnative_group.c | 296 |
1 files changed, 143 insertions, 153 deletions
diff --git a/src/H5VLnative_group.c b/src/H5VLnative_group.c index cca5c55..10dfaaa 100644 --- a/src/H5VLnative_group.c +++ b/src/H5VLnative_group.c @@ -15,20 +15,18 @@ * */ -#define H5G_FRIEND /* Suppress error about including H5Gpkg */ +#define H5G_FRIEND /* Suppress error about including H5Gpkg */ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5VLprivate.h" /* Virtual Object Layer */ #include "H5VLnative_private.h" /* Native VOL connector */ - - /*------------------------------------------------------------------------- * Function: H5VL__native_group_create * @@ -40,62 +38,62 @@ *------------------------------------------------------------------------- */ void * -H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, - hid_t lcpl_id, hid_t gcpl_id, hid_t H5_ATTR_UNUSED gapl_id, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id, + hid_t gcpl_id, hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { - H5G_loc_t loc; /* Location to create group */ - H5G_t *grp = NULL; /* New group created */ - void *ret_value; + H5G_loc_t loc; /* Location to create group */ + H5G_t * grp = NULL; /* New group created */ + void * ret_value; FUNC_ENTER_PACKAGE /* Set up the location */ - if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") /* if name is NULL then this is from H5Gcreate_anon */ - if(name == NULL) { - H5G_obj_create_t gcrt_info; /* Information for group creation */ + if (name == NULL) { + H5G_obj_create_t gcrt_info; /* Information for group creation */ /* Set up group creation info */ - gcrt_info.gcpl_id = gcpl_id; + gcrt_info.gcpl_id = gcpl_id; gcrt_info.cache_type = H5G_NOTHING_CACHED; HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); /* Create the new group & get its ID */ - if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info))) + if (NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group") } /* end if */ /* otherwise it's from H5Gcreate */ else { /* Create the new group & get its ID */ - if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id))) + if (NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group") } /* end else */ ret_value = (void *)grp; done: - if(name == NULL) { + if (name == NULL) { /* Release the group's object header, if it was created */ - if(grp) { - H5O_loc_t *oloc; /* Object location for group */ + if (grp) { + H5O_loc_t *oloc; /* Object location for group */ /* Get the new group's object location */ - if(NULL == (oloc = H5G_oloc(grp))) + if (NULL == (oloc = H5G_oloc(grp))) HDONE_ERROR(H5E_SYM, H5E_CANTGET, NULL, "unable to get object location of group") /* Decrement refcount on group's object header in memory */ - if(H5O_dec_rc_by_loc(oloc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object") - } /* end if */ - } /* end if */ + if (H5O_dec_rc_by_loc(oloc) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, + "unable to decrement refcount on newly created object") + } /* end if */ + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__native_group_create() */ - /*------------------------------------------------------------------------- * Function: H5VL__native_group_open * @@ -108,20 +106,20 @@ done: */ void * H5VL__native_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, - hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) + hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { - H5G_loc_t loc; /* Location to open group */ - H5G_t *grp = NULL; /* New group opend */ - void *ret_value; + H5G_loc_t loc; /* Location to open group */ + H5G_t * grp = NULL; /* New group opend */ + void * ret_value; FUNC_ENTER_PACKAGE /* Set up the location */ - if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") /* Open the group */ - if((grp = H5G__open_name(&loc, name)) == NULL) + if ((grp = H5G__open_name(&loc, name)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group") ret_value = (void *)grp; @@ -130,7 +128,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__native_group_open() */ - /*------------------------------------------------------------------------- * Function: H5VL__native_group_get * @@ -141,61 +138,61 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req, va_list arguments) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - switch(get_type) { + switch (get_type) { /* H5Gget_create_plist */ - case H5VL_GROUP_GET_GCPL: - { - hid_t *new_gcpl_id = HDva_arg(arguments, hid_t *); - H5G_t *grp = (H5G_t *)obj; + case H5VL_GROUP_GET_GCPL: { + hid_t *new_gcpl_id = HDva_arg(arguments, hid_t *); + H5G_t *grp = (H5G_t *)obj; - 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; - } + 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; + } /* H5Gget_info */ - case H5VL_GROUP_GET_INFO: - { - const H5VL_loc_params_t *loc_params = HDva_arg(arguments, const H5VL_loc_params_t *); - H5G_info_t *group_info = HDva_arg(arguments, H5G_info_t *); - H5G_loc_t loc; - - 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) { - /* H5Gget_info */ - - /* Retrieve the group's information */ - if(H5G__obj_info(loc.oloc, group_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") - } /* end if */ - else if(loc_params->type == H5VL_OBJECT_BY_NAME) { - /* H5Gget_info_by_name */ - - /* Retrieve the group's information */ - if(H5G__get_info_by_name(&loc, loc_params->loc_data.loc_by_name.name, group_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") - } /* end else-if */ - else if(loc_params->type == H5VL_OBJECT_BY_IDX) { - /* H5Gget_info_by_idx */ - - /* Retrieve the group's information */ - if(H5G__get_info_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, - loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, group_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") - } /* end else-if */ - else - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") - break; - } + case H5VL_GROUP_GET_INFO: { + const H5VL_loc_params_t *loc_params = HDva_arg(arguments, const H5VL_loc_params_t *); + H5G_info_t * group_info = HDva_arg(arguments, H5G_info_t *); + H5G_loc_t loc; + + 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) { + /* H5Gget_info */ + + /* Retrieve the group's information */ + if (H5G__obj_info(loc.oloc, group_info) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") + } /* end if */ + else if (loc_params->type == H5VL_OBJECT_BY_NAME) { + /* H5Gget_info_by_name */ + + /* Retrieve the group's information */ + if (H5G__get_info_by_name(&loc, loc_params->loc_data.loc_by_name.name, group_info) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") + } /* end else-if */ + else if (loc_params->type == H5VL_OBJECT_BY_IDX) { + /* H5Gget_info_by_idx */ + + /* Retrieve the group's information */ + if (H5G__get_info_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, + loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, + loc_params->loc_data.loc_by_idx.n, group_info) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") + } /* end else-if */ + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") + break; + } default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from group") @@ -205,7 +202,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__native_group_get() */ - /*------------------------------------------------------------------------- * Function: H5VL__native_group_specific * @@ -216,36 +212,34 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req, va_list arguments) { - H5G_t *grp = (H5G_t *)obj; - herr_t ret_value = SUCCEED; /* Return value */ + H5G_t *grp = (H5G_t *)obj; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - switch(specific_type) { - case H5VL_GROUP_FLUSH: - { - hid_t group_id = HDva_arg(arguments, hid_t); + switch (specific_type) { + case H5VL_GROUP_FLUSH: { + hid_t group_id = HDva_arg(arguments, hid_t); - /* Flush object's metadata to file */ - if(H5O_flush_common(&grp->oloc, group_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group") + /* Flush object's metadata to file */ + if (H5O_flush_common(&grp->oloc, group_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group") - break; - } + break; + } - case H5VL_GROUP_REFRESH: - { - hid_t group_id = HDva_arg(arguments, hid_t); + case H5VL_GROUP_REFRESH: { + hid_t group_id = HDva_arg(arguments, hid_t); - /* Call private function to refresh group object */ - if((H5O_refresh_metadata(group_id, grp->oloc)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") + /* Call private function to refresh group object */ + if ((H5O_refresh_metadata(group_id, grp->oloc)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") - break; - } + break; + } default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") @@ -255,7 +249,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__native_group_specific() */ - /*------------------------------------------------------------------------- * Function: H5VL__native_group_optional * @@ -266,55 +259,54 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL__native_group_optional(void H5_ATTR_UNUSED *obj, - H5VL_group_optional_t optional_type, hid_t H5_ATTR_UNUSED dxpl_id, - void H5_ATTR_UNUSED **req, va_list H5_ATTR_DEPRECATED_USED arguments) +H5VL__native_group_optional(void H5_ATTR_UNUSED *obj, H5VL_group_optional_t optional_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, + va_list H5_ATTR_DEPRECATED_USED arguments) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - switch(optional_type) { + switch (optional_type) { #ifndef H5_NO_DEPRECATED_SYMBOLS /* H5Giterate (deprecated) */ - case H5VL_NATIVE_GROUP_ITERATE_OLD: - { - const H5VL_loc_params_t *loc_params = HDva_arg(arguments, const H5VL_loc_params_t *); - hsize_t idx = HDva_arg(arguments, hsize_t); - hsize_t *last_obj = HDva_arg(arguments, hsize_t *); - const H5G_link_iterate_t *lnk_op = HDva_arg(arguments, const H5G_link_iterate_t *); - void *op_data = HDva_arg(arguments, void *); - H5G_loc_t grp_loc; - - /* Get the location struct for the object */ - if(H5G_loc_real(obj, loc_params->obj_type, &grp_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - - /* Call the actual iteration routine */ - if((ret_value = H5G_iterate(&grp_loc, loc_params->loc_data.loc_by_name.name, H5_INDEX_NAME, H5_ITER_INC, idx, last_obj, lnk_op, op_data)) < 0) - HERROR(H5E_VOL, H5E_BADITER, "error iterating over group's links"); - - break; - } + case H5VL_NATIVE_GROUP_ITERATE_OLD: { + const H5VL_loc_params_t * loc_params = HDva_arg(arguments, const H5VL_loc_params_t *); + hsize_t idx = HDva_arg(arguments, hsize_t); + hsize_t * last_obj = HDva_arg(arguments, hsize_t *); + const H5G_link_iterate_t *lnk_op = HDva_arg(arguments, const H5G_link_iterate_t *); + void * op_data = HDva_arg(arguments, void *); + H5G_loc_t grp_loc; + + /* Get the location struct for the object */ + if (H5G_loc_real(obj, loc_params->obj_type, &grp_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Call the actual iteration routine */ + if ((ret_value = H5G_iterate(&grp_loc, loc_params->loc_data.loc_by_name.name, H5_INDEX_NAME, + H5_ITER_INC, idx, last_obj, lnk_op, op_data)) < 0) + HERROR(H5E_VOL, H5E_BADITER, "error iterating over group's links"); + + break; + } /* H5Gget_objinfo (deprecated) */ - case H5VL_NATIVE_GROUP_GET_OBJINFO: - { - const H5VL_loc_params_t *loc_params = HDva_arg(arguments, const H5VL_loc_params_t *); - hbool_t follow_link = (hbool_t)HDva_arg(arguments, unsigned); - H5G_stat_t *statbuf = HDva_arg(arguments, H5G_stat_t *); - H5G_loc_t grp_loc; - - /* Get the location struct for the object */ - if(H5G_loc_real(obj, loc_params->obj_type, &grp_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - - /* Call the actual group objinfo routine */ - if(H5G__get_objinfo(&grp_loc, loc_params->loc_data.loc_by_name.name, follow_link, statbuf) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object") - - break; - } + case H5VL_NATIVE_GROUP_GET_OBJINFO: { + const H5VL_loc_params_t *loc_params = HDva_arg(arguments, const H5VL_loc_params_t *); + hbool_t follow_link = (hbool_t)HDva_arg(arguments, unsigned); + H5G_stat_t * statbuf = HDva_arg(arguments, H5G_stat_t *); + H5G_loc_t grp_loc; + + /* Get the location struct for the object */ + if (H5G_loc_real(obj, loc_params->obj_type, &grp_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Call the actual group objinfo routine */ + if (H5G__get_objinfo(&grp_loc, loc_params->loc_data.loc_by_name.name, follow_link, statbuf) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object") + + break; + } #endif /* H5_NO_DEPRECATED_SYMBOLS */ default: @@ -325,7 +317,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__native_group_optional() */ - /*------------------------------------------------------------------------- * Function: H5VL__native_group_close * @@ -339,14 +330,13 @@ done: herr_t H5VL__native_group_close(void *grp, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - if(H5G_close((H5G_t *)grp) < 0) + if (H5G_close((H5G_t *)grp) < 0) HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close group") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__native_group_close() */ - |