diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2022-04-13 21:17:29 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2022-04-13 21:17:29 (GMT) |
commit | cabc39c3e197e2591449d2604bfee26465fb60e1 (patch) | |
tree | d5f39f5f5965584bf9bf49646a2af617adfd3e4e /src/H5Fquery.c | |
parent | 7355f4c505092a7a85474b47f18d5206028e2c95 (diff) | |
parent | ab69f5df770ee3cc6cd6c81d905a5317b894a002 (diff) | |
download | hdf5-feature/coding_standards.zip hdf5-feature/coding_standards.tar.gz hdf5-feature/coding_standards.tar.bz2 |
Merge branch 'develop' into feature/coding_standardsfeature/coding_standards
Diffstat (limited to 'src/H5Fquery.c')
-rw-r--r-- | src/H5Fquery.c | 223 |
1 files changed, 143 insertions, 80 deletions
diff --git a/src/H5Fquery.c b/src/H5Fquery.c index f36f348..a625897 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -6,7 +6,7 @@ * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * distribution tree, or in https://www.hdfgroup.org/licenses. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -15,7 +15,7 @@ * * Created: H5Fquery.c * Jan 10 2008 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: File structure query routines. * @@ -26,54 +26,44 @@ /* Module Setup */ /****************/ -#include "H5Fmodule.h" /* This source code file is part of the H5F module */ - +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ - +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ /****************/ /* Local Macros */ /****************/ - /******************/ /* Local Typedefs */ /******************/ - /********************/ /* Package Typedefs */ /********************/ - /********************/ /* Local Prototypes */ /********************/ - /*********************/ /* Package Variables */ /*********************/ - /*****************************/ /* Library Private Variables */ /*****************************/ - /*******************/ /* Local Variables */ /*******************/ - - /*------------------------------------------------------------------------- * Function: H5F_shared_get_intent * @@ -95,7 +85,6 @@ H5F_shared_get_intent(const H5F_shared_t *f_sh) FUNC_LEAVE_NOAPI(f_sh->flags) } /* end H5F_shared_get_intent() */ - /*------------------------------------------------------------------------- * Function: H5F_get_intent * @@ -117,7 +106,6 @@ H5F_get_intent(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->flags) } /* end H5F_get_intent() */ - /*------------------------------------------------------------------------- * Function: H5F_get_low_bound * @@ -142,7 +130,6 @@ H5F_get_low_bound(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->low_bound) } /* end H5F_get_low_bound() */ - /*------------------------------------------------------------------------- * Function: H5F_get_high_bound * @@ -167,7 +154,6 @@ H5F_get_high_bound(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->high_bound) } /* end H5F_get_high_bound() */ - /*------------------------------------------------------------------------- * Function: H5F_get_open_name * @@ -189,7 +175,6 @@ H5F_get_open_name(const H5F_t *f) FUNC_LEAVE_NOAPI(f->open_name) } /* end H5F_get_open_name() */ - /*------------------------------------------------------------------------- * Function: H5F_get_actual_name * @@ -211,13 +196,12 @@ H5F_get_actual_name(const H5F_t *f) FUNC_LEAVE_NOAPI(f->actual_name) } /* end H5F_get_actual_name() */ - /*------------------------------------------------------------------------- * Function: H5F_get_extpath * * Purpose: Retrieve the file's 'extpath' flags - * This is used by H5L_extern_traverse() and H5D_build_file_prefix() to retrieve the main file's location - * when searching the target file. + * This is used by H5L_extern_traverse() and H5D_build_file_prefix() + * to retrieve the main file's location when searching the target file. * * Return: 'extpath' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- @@ -229,12 +213,12 @@ H5F_get_extpath(const H5F_t *f) FUNC_ENTER_NOAPI_NOINIT_NOERR HDassert(f); + HDassert(f->shared); HDassert(f->shared->extpath); FUNC_LEAVE_NOAPI(f->shared->extpath) } /* end H5F_get_extpath() */ - /*------------------------------------------------------------------------- * Function: H5F_get_shared * @@ -254,7 +238,6 @@ H5F_get_shared(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared) } /* end H5F_get_shared() */ - /*------------------------------------------------------------------------- * Function: H5F_same_shared * @@ -277,7 +260,6 @@ H5F_same_shared(const H5F_t *f1, const H5F_t *f2) FUNC_LEAVE_NOAPI(f1->shared == f2->shared) } /* end H5F_same_shared() */ - /*------------------------------------------------------------------------- * Function: H5F_get_nopen_objs * @@ -297,7 +279,6 @@ H5F_get_nopen_objs(const H5F_t *f) FUNC_LEAVE_NOAPI(f->nopen_objs) } /* end H5F_get_nopen_objs() */ - /*------------------------------------------------------------------------- * Function: H5F_file_id_exists * @@ -317,7 +298,6 @@ H5F_file_id_exists(const H5F_t *f) FUNC_LEAVE_NOAPI(f->id_exists) } /* end H5F_file_id_exists() */ - /*------------------------------------------------------------------------- * Function: H5F_get_parent * @@ -337,7 +317,6 @@ H5F_get_parent(const H5F_t *f) FUNC_LEAVE_NOAPI(f->parent) } /* end H5F_get_parent() */ - /*------------------------------------------------------------------------- * Function: H5F_get_nmounts * @@ -357,7 +336,6 @@ H5F_get_nmounts(const H5F_t *f) FUNC_LEAVE_NOAPI(f->nmounts) } /* end H5F_get_nmounts() */ - /*------------------------------------------------------------------------- * Function: H5F_get_read_attempts * @@ -377,7 +355,6 @@ H5F_get_read_attempts(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->read_attempts) } /* end H5F_get_read_attempts() */ - /*------------------------------------------------------------------------- * Function: H5F_get_fcpl * @@ -399,7 +376,6 @@ H5F_get_fcpl(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->fcpl_id) } /* end H5F_get_fcpl() */ - /*------------------------------------------------------------------------- * Function: H5F_sizeof_addr * @@ -422,7 +398,6 @@ H5F_sizeof_addr(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->sizeof_addr) } /* end H5F_sizeof_addr() */ - /*------------------------------------------------------------------------- * Function: H5F_sizeof_size * @@ -445,7 +420,6 @@ H5F_sizeof_size(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->sizeof_size) } /* H5F_sizeof_size() */ - /*------------------------------------------------------------------------- * Function: H5F_get_sohm_addr * @@ -466,7 +440,6 @@ H5F_get_sohm_addr(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->sohm_addr) } /* end H5F_get_sohm_addr() */ - /*------------------------------------------------------------------------- * Function: H5F_get_sohm_vers * @@ -487,7 +460,6 @@ H5F_get_sohm_vers(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->sohm_vers) } /* end H5F_get_sohm_vers() */ - /*------------------------------------------------------------------------- * Function: H5F_get_sohm_nindexes * @@ -508,7 +480,6 @@ H5F_get_sohm_nindexes(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->sohm_nindexes) } /* end H5F_get_sohm_nindexes() */ - /*------------------------------------------------------------------------- * Function: H5F_sym_leaf_k * @@ -534,7 +505,6 @@ H5F_sym_leaf_k(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->sblock->sym_leaf_k) } /* end H5F_sym_leaf_k() */ - /*------------------------------------------------------------------------- * Function: H5F_get_min_dset_ohdr * @@ -553,7 +523,6 @@ H5F_get_min_dset_ohdr(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->crt_dset_min_ohdr_flag) } /* end H5F_get_min_dset_ohdr */ - /*------------------------------------------------------------------------- * Function: H5F_Kvalue * @@ -580,7 +549,6 @@ H5F_Kvalue(const H5F_t *f, const H5B_class_t *type) FUNC_LEAVE_NOAPI(f->shared->sblock->btree_k[type->id]) } /* end H5F_Kvalue() */ - /*------------------------------------------------------------------------- * Function: H5F_get_nrefs * @@ -601,7 +569,6 @@ H5F_get_nrefs(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->nrefs) } /* end H5F_get_nrefs() */ - /*------------------------------------------------------------------------- * Function: H5F_rdcc_nslots * @@ -626,7 +593,6 @@ H5F_rdcc_nslots(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->rdcc_nslots) } /* end H5F_rdcc_nelmts() */ - /*------------------------------------------------------------------------- * Function: H5F_rdcc_nbytes * @@ -651,7 +617,6 @@ H5F_rdcc_nbytes(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->rdcc_nbytes) } /* end H5F_rdcc_nbytes() */ - /*------------------------------------------------------------------------- * Function: H5F_rdcc_w0 * @@ -676,7 +641,6 @@ H5F_rdcc_w0(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->rdcc_w0) } /* end H5F_rdcc_w0() */ - /*------------------------------------------------------------------------- * Function: H5F_get_base_addr * @@ -700,7 +664,6 @@ H5F_get_base_addr(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->sblock->base_addr) } /* end H5F_get_base_addr() */ - /*------------------------------------------------------------------------- * Function: H5F_grp_btree_shared * @@ -725,7 +688,6 @@ H5F_grp_btree_shared(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->grp_btree_shared) } /* end H5F_grp_btree_shared() */ - /*------------------------------------------------------------------------- * Function: H5F_sieve_buf_size * @@ -750,7 +712,6 @@ H5F_sieve_buf_size(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->sieve_buf_size) } /* end H5F_sieve_buf_size() */ - /*------------------------------------------------------------------------- * Function: H5F_gc_ref * @@ -762,7 +723,6 @@ H5F_sieve_buf_size(const H5F_t *f) * Failure: (should not happen) * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jul 8 2005 * *------------------------------------------------------------------------- @@ -779,7 +739,6 @@ H5F_gc_ref(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->gc_ref) } /* end H5F_gc_ref() */ - /*------------------------------------------------------------------------- * Function: H5F_get_fc_degree * @@ -801,7 +760,6 @@ H5F_get_fc_degree(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->fc_degree) } /* end H5F_get_fc_degree() */ - /*------------------------------------------------------------------------- * Function: H5F_get_evict_on_close * @@ -825,7 +783,6 @@ H5F_get_evict_on_close(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->evict_on_close) } /* end H5F_get_evict_on_close() */ - /*------------------------------------------------------------------------- * Function: H5F_store_msg_crt_idx * @@ -847,7 +804,6 @@ H5F_store_msg_crt_idx(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->store_msg_crt_idx) } /* end H5F_store_msg_crt_idx() */ - /*------------------------------------------------------------------------- * Function: H5F_shared_has_feature * @@ -868,7 +824,6 @@ H5F_shared_has_feature(const H5F_shared_t *f_sh, unsigned feature) FUNC_LEAVE_NOAPI((hbool_t)(f_sh->lf->feature_flags & feature)) } /* end H5F_shared_has_feature() */ - /*------------------------------------------------------------------------- * Function: H5F_has_feature * @@ -887,10 +842,9 @@ H5F_has_feature(const H5F_t *f, unsigned feature) HDassert(f); HDassert(f->shared); - FUNC_LEAVE_NOAPI((hbool_t)(f->shared->lf->feature_flags&feature)) + FUNC_LEAVE_NOAPI((hbool_t)(f->shared->lf->feature_flags & feature)) } /* end H5F_has_feature() */ - /*------------------------------------------------------------------------- * Function: H5F_get_driver_id * @@ -914,7 +868,6 @@ H5F_get_driver_id(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->lf->driver_id) } /* end H5F_get_driver_id() */ - /*------------------------------------------------------------------------- * Function: H5F_get_fileno * @@ -928,7 +881,7 @@ H5F_get_driver_id(const H5F_t *f) herr_t H5F_get_fileno(const H5F_t *f, unsigned long *filenum) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) @@ -938,14 +891,13 @@ H5F_get_fileno(const H5F_t *f, unsigned long *filenum) HDassert(filenum); /* Retrieve the file's serial number */ - if(H5FD_get_fileno(f->shared->lf, filenum) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "can't retrieve fileno") + if (H5FD_get_fileno(f->shared->lf, filenum) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "can't retrieve fileno") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_fileno() */ - /*------------------------------------------------------------------------- * Function: H5F_shared_get_eoa * @@ -957,21 +909,20 @@ done: haddr_t H5F_shared_get_eoa(const H5F_shared_t *f_sh, H5FD_mem_t type) { - haddr_t ret_value = HADDR_UNDEF; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) HDassert(f_sh); /* Dispatch to driver */ - if(HADDR_UNDEF == (ret_value = H5FD_get_eoa(f_sh->lf, type))) + if (HADDR_UNDEF == (ret_value = H5FD_get_eoa(f_sh->lf, type))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_shared_get_eoa() */ - /*------------------------------------------------------------------------- * Function: H5F_get_eoa * @@ -983,7 +934,7 @@ done: haddr_t H5F_get_eoa(const H5F_t *f, H5FD_mem_t type) { - haddr_t ret_value = HADDR_UNDEF; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) @@ -991,14 +942,36 @@ H5F_get_eoa(const H5F_t *f, H5FD_mem_t type) HDassert(f->shared); /* Dispatch to driver */ - if(HADDR_UNDEF == (ret_value = H5FD_get_eoa(f->shared->lf, type))) + if (HADDR_UNDEF == (ret_value = H5FD_get_eoa(f->shared->lf, type))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_eoa() */ - +/*------------------------------------------------------------------------- + * Function: H5F_shared_get_file_driver + * + * Purpose: Returns a pointer to the file driver structure of the + * file's 'shared' structure. + * + * Return: file handle on success/abort on failure (shouldn't fail) + *------------------------------------------------------------------------- + */ +herr_t +H5F_shared_get_file_driver(const H5F_shared_t *f_sh, H5FD_t **file_handle) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(f_sh); + HDassert(file_handle); + + *file_handle = f_sh->lf; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5F_shared_get_file_driver() */ + /*------------------------------------------------------------------------- * Function: H5F_get_vfd_handle * @@ -1012,7 +985,7 @@ done: herr_t H5F_get_vfd_handle(const H5F_t *file, hid_t fapl, void **file_handle) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1021,14 +994,13 @@ H5F_get_vfd_handle(const H5F_t *file, hid_t fapl, void **file_handle) HDassert(file_handle); /* Get the VFD handle */ - if(H5FD_get_vfd_handle(file->shared->lf, fapl, file_handle) < 0) + if (H5FD_get_vfd_handle(file->shared->lf, fapl, file_handle) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_vfd_handle() */ - /*------------------------------------------------------------------------- * Function: H5F_is_tmp_addr * @@ -1052,7 +1024,6 @@ H5F_is_tmp_addr(const H5F_t *f, haddr_t addr) FUNC_LEAVE_NOAPI(H5F_addr_le(f->shared->tmp_addr, addr)) } /* end H5F_is_tmp_addr() */ - /*------------------------------------------------------------------------- * Function: H5F_use_tmp_space * @@ -1077,7 +1048,7 @@ H5F_use_tmp_space(const H5F_t *f) } /* end H5F_use_tmp_space() */ #ifdef H5_HAVE_PARALLEL - + /*------------------------------------------------------------------------- * Function: H5F_coll_md_read * @@ -1099,7 +1070,6 @@ H5F_coll_md_read(const H5F_t *f) } /* end H5F_coll_md_read() */ #endif /* H5_HAVE_PARALLEL */ - /*------------------------------------------------------------------------- * Function: H5F_use_mdc_logging * @@ -1123,7 +1093,6 @@ H5F_use_mdc_logging(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->use_mdc_logging) } /* end H5F_use_mdc_logging() */ - /*------------------------------------------------------------------------- * Function: H5F_start_mdc_log_on_access * @@ -1147,7 +1116,6 @@ H5F_start_mdc_log_on_access(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->start_mdc_log_on_access) } /* end H5F_start_mdc_log_on_access() */ - /*------------------------------------------------------------------------- * Function: H5F_mdc_log_location * @@ -1171,7 +1139,6 @@ H5F_mdc_log_location(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->mdc_log_location) } /* end H5F_mdc_log_location() */ - /*------------------------------------------------------------------------- * Function: H5F_get_alignment * @@ -1193,7 +1160,6 @@ H5F_get_alignment(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->alignment) } /* end H5F_get_alignment() */ - /*------------------------------------------------------------------------- * Function: H5F_get_threshold * @@ -1215,7 +1181,6 @@ H5F_get_threshold(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->threshold) } /* end H5F_get_threshold() */ - /*------------------------------------------------------------------------- * Function: H5F_get_pgend_meta_thres * @@ -1237,7 +1202,6 @@ H5F_get_pgend_meta_thres(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->pgend_meta_thres) } /* end H5F_get_pgend_meta_thres() */ - /*------------------------------------------------------------------------- * Function: H5F_get_point_of_no_return * @@ -1279,3 +1243,102 @@ H5F_get_null_fsm_addr(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->null_fsm_addr) } /* end H5F_get_null_fsm_addr() */ + +/*------------------------------------------------------------------------- + * Function: H5F_get_vol_cls + * + * Purpose: Get the VOL class for the file + * + * Return: VOL class pointer for file, can't fail + * + * Programmer: Quincey Koziol + * Saturday, August 17, 2019 + * + *------------------------------------------------------------------------- + */ +const H5VL_class_t * +H5F_get_vol_cls(const H5F_t *f) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(f); + HDassert(f->shared); + + FUNC_LEAVE_NOAPI(f->shared->vol_cls) +} /* end H5F_get_vol_cls */ + +/*------------------------------------------------------------------------- + * Function: H5F_get_vol_obj + * + * Purpose: Get the VOL object for the file + * + * Return: VOL object pointer for file, can't fail + * + *------------------------------------------------------------------------- + */ +H5VL_object_t * +H5F_get_vol_obj(const H5F_t *f) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(f); + + FUNC_LEAVE_NOAPI(f->vol_obj) +} /* end H5F_get_vol_obj */ + +/*------------------------------------------------------------------------- + * Function: H5F_get_cont_info + * + * Purpose: Get the VOL container info for the file + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Saturday, August 17, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5F__get_cont_info(const H5F_t *f, H5VL_file_cont_info_t *info) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity checks */ + HDassert(f); + HDassert(f->shared); + + /* Verify structure version */ + if (info->version != H5VL_CONTAINER_INFO_VERSION) + HGOTO_ERROR(H5E_FILE, H5E_VERSION, FAIL, "wrong container info version #") + + /* Set the container info fields */ + info->feature_flags = 0; /* None currently defined */ + info->token_size = H5F_SIZEOF_ADDR(f); + info->blob_id_size = H5HG_HEAP_ID_SIZE(f); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_get_cont_info */ + +/*------------------------------------------------------------------------- + * Function: H5F_get_file_locking + * + * Purpose: Get the file locking flag for the file + * + * Return: TRUE/FALSE + * + *------------------------------------------------------------------------- + */ +hbool_t +H5F_get_file_locking(const H5F_t *f) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(f); + HDassert(f->shared); + + FUNC_LEAVE_NOAPI(f->shared->use_file_locking) +} /* end H5F_get_file_locking */ |