From 91089de53ffe2b950ed309ee486590ed6d2272c2 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 6 Jun 2018 21:34:11 -0700 Subject: Normalization with vol_integration branch. --- src/H5F.c | 2 +- src/H5Fefc.c | 25 +++--- src/H5Fint.c | 111 +++++++++++------------ src/H5Fmount.c | 270 +++++++++++++++++++++++++++---------------------------- src/H5Fpkg.h | 62 ++++++------- src/H5Fprivate.h | 14 ++- test/efc.c | 42 +++++---- 7 files changed, 256 insertions(+), 270 deletions(-) diff --git a/src/H5F.c b/src/H5F.c index 6d62c08..01fd7db 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -700,7 +700,7 @@ H5Freopen(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Get a new "top level" file struct, sharing the same "low level" file struct */ - if(NULL == (new_file = H5F_new(old_file->shared, 0, H5P_FILE_CREATE_DEFAULT, H5P_FILE_ACCESS_DEFAULT, NULL))) + if(NULL == (new_file = H5F__new(old_file->shared, 0, H5P_FILE_CREATE_DEFAULT, H5P_FILE_ACCESS_DEFAULT, NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") /* Duplicate old file's names */ diff --git a/src/H5Fefc.c b/src/H5Fefc.c index 487ed2f..07bb644 100644 --- a/src/H5Fefc.c +++ b/src/H5Fefc.c @@ -73,7 +73,7 @@ H5FL_DEFINE_STATIC(H5F_efc_t); /*------------------------------------------------------------------------- - * Function: H5F_efc_create + * Function: H5F__efc_create * * Purpose: Allocate and initialize a new external file cache object, * which can the be used to cache open external files. @@ -88,12 +88,12 @@ H5FL_DEFINE_STATIC(H5F_efc_t); *------------------------------------------------------------------------- */ H5F_efc_t * -H5F_efc_create(unsigned max_nfiles) +H5F__efc_create(unsigned max_nfiles) { H5F_efc_t *efc = NULL; /* EFC object */ H5F_efc_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(max_nfiles > 0); @@ -116,7 +116,7 @@ done: efc = H5FL_FREE(H5F_efc_t, efc); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_efc_create() */ +} /* end H5F__efc_create() */ /*------------------------------------------------------------------------- @@ -139,8 +139,7 @@ done: *------------------------------------------------------------------------- */ H5F_t * -H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, - hid_t fapl_id) +H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { H5F_efc_t *efc = NULL; /* External file cache for parent file */ H5F_efc_ent_t *ent = NULL; /* Entry for target file in efc */ @@ -376,7 +375,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_efc_max_nfiles + * Function: H5F__efc_max_nfiles * * Purpose: Returns the maximum number of files in the provided * external file cache. @@ -389,15 +388,15 @@ done: *------------------------------------------------------------------------- */ unsigned -H5F_efc_max_nfiles(H5F_efc_t *efc) +H5F__efc_max_nfiles(H5F_efc_t *efc) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(efc); HDassert(efc->max_nfiles > 0); FUNC_LEAVE_NOAPI(efc->max_nfiles) -} /* end H5F_efc_max_nfiles */ +} /* end H5F__efc_max_nfiles */ /*------------------------------------------------------------------------- @@ -793,7 +792,7 @@ H5F__efc_try_close_tag2(H5F_file_t *sf, H5F_file_t **tail) * uncloseable file would be closed. * * The final pass exploits the H5F__efc_release_real()-> - * H5F_efc_remove_ent()->H5F_try_close()->H5F__efc_try_close() + * H5F__efc_remove_ent()->H5F_try_close()->H5F__efc_try_close() * calling chain to recursively close the tree, but only the * files that are still marked as closeable. All files * marked as closeable have their EFCs released, and will @@ -819,7 +818,7 @@ H5F__efc_try_close(H5F_t *f) H5F_file_t *next; /* Temporary file pointer */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(f); @@ -852,7 +851,7 @@ H5F__efc_try_close(H5F_t *f) /* If there are references that are not from an EFC or f, it will never * be possible to close the file. Just return. Note that this holds true * for the case that this file is being closed through H5F__efc_release_real() - * because that function (through H5F_efc_remove_ent()) decrements the EFC + * because that function (through H5F__efc_remove_ent()) decrements the EFC * reference count before it calls H5F_try_close(). This may occur if this * function is reentered. */ /* If the tag is H5F_EFC_TAG_DONTCLOSE, then we have definitely reentered diff --git a/src/H5Fint.c b/src/H5Fint.c index 7d71fbc..abc638a 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -21,22 +21,22 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Aprivate.h" /* Attributes */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5SMprivate.h" /* Shared Object Header Messages */ -#include "H5Tprivate.h" /* Datatypes */ +#include "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5Tprivate.h" /* Datatypes */ /****************/ @@ -74,11 +74,9 @@ typedef struct H5F_olist_t { /********************/ static int H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key); -static herr_t H5F__build_name(const char *prefix, const char *file_name, - char **full_name/*out*/); +static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/); static char *H5F__getenv_prefix_name(char **env_prefix/*in,out*/); -static herr_t H5F_build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, - const char *name, char ** /*out*/ actual_name);/* Declare a free list to manage the H5F_t struct */ +static herr_t H5F_build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char ** /*out*/ actual_name); static herr_t H5F__flush_phase1(H5F_t *f); static herr_t H5F__flush_phase2(H5F_t *f, hbool_t closing); @@ -175,7 +173,7 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set object flush callback") if(f->shared->efc) - efc_size = H5F_efc_max_nfiles(f->shared->efc); + efc_size = H5F__efc_max_nfiles(f->shared->efc); if(H5P_set(new_plist, H5F_ACS_EFC_SIZE_NAME, &efc_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set elink file cache size") if(f->shared->page_buf != NULL) { @@ -486,11 +484,12 @@ done: /*-------------------------------------------------------------------------- - * Function: H5F__build_name + * Function: H5F__build_name * - * Purpose: Prepend PREFIX to FILE_NAME and store in FULL_NAME + * Purpose: Prepend PREFIX to FILE_NAME and store in FULL_NAME + * + * Return: SUCCEED/FAIL * - * Return: Non-negative on success/Negative on failure *--------------------------------------------------------------------------*/ static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/) @@ -818,34 +817,37 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_new + * Function: H5F__new * - * Purpose: Creates a new file object and initializes it. The - * H5Fopen and H5Fcreate functions then fill in various fields. - * If SHARED is a non-null pointer then the shared info - * to which it points has the reference count incremented. - * Otherwise a new, empty shared info struct is created and - * initialized with the specified file access property list. + * Purpose: Creates a new file object and initializes it. The + * H5Fopen and H5Fcreate functions then fill in various fields. + * If SHARED is a non-null pointer then the shared info + * to which it points has the reference count incremented. + * Otherwise a new, empty shared info struct is created and + * initialized with the specified file access property list. + * + * Return: Success: Pointer to a new file struct + * + * Failure: NULL * - * Return: Success: Ptr to a new file struct. - * Failure: NULL *------------------------------------------------------------------------- */ H5F_t * -H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) +H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) { - H5F_t *f = NULL, *ret_value = NULL; + H5F_t *f = NULL; + H5F_t *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE if(NULL == (f = H5FL_CALLOC(H5F_t))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate top file structure") - f->file_id = -1; + f->file_id = H5I_INVALID_HID; if(shared) { HDassert(lf == NULL); f->shared = shared; - } /* end if */ + } else { H5P_genplist_t *plist; /* Property list */ unsigned efc_size; /* External file cache size */ @@ -866,7 +868,7 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t f->shared->fs_state[u] = H5F_FS_STATE_CLOSED; f->shared->fs_addr[u] = HADDR_UNDEF; f->shared->fs_man[u] = NULL; - } /* end for */ + } f->shared->first_alloc_dealloc = FALSE; f->shared->eoa_pre_fsm_fsalloc = HADDR_UNDEF; f->shared->eoa_post_fsm_fsalloc = HADDR_UNDEF; @@ -878,9 +880,8 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t /* intialize point of no return */ f->shared->point_of_no_return = FALSE; - /* - * Copy the file creation and file access property lists into the - * new file handle. We do this early because some values might need + /* Copy the file creation and file access property lists into the + * new file handle. We do this early because some values might need * to change as the file is being opened. */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fcpl_id))) @@ -906,7 +907,8 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t HDassert(f->shared->fs_page_size >= H5F_FILE_SPACE_PAGE_SIZE_MIN); /* Temporary for multi/split drivers: fail file creation - when persisting free-space or using paged aggregation strategy */ + * when persisting free-space or using paged aggregation strategy. + */ if(H5F_HAS_FEATURE(f, H5FD_FEAT_PAGED_AGGR)) if(f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE || f->shared->fs_persist) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't open with this strategy or persistent fs") @@ -947,7 +949,7 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t if(H5P_get(plist, H5F_ACS_EFC_SIZE_NAME, &efc_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get elink file cache size") if(efc_size > 0) - if(NULL == (f->shared->efc = H5F_efc_create(efc_size))) + if(NULL == (f->shared->efc = H5F__efc_create(efc_size))) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't create external file cache") #ifdef H5_HAVE_PARALLEL if(H5P_get(plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0) @@ -1000,12 +1002,12 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t f->shared->feature_flags &= ~(unsigned)H5FD_FEAT_ACCUMULATE_METADATA; if(H5FD_set_feature_flags(f->shared->lf, f->shared->feature_flags) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't set feature_flags in VFD") - } /* end if */ + } else { /* If no value for read attempts has been set, use the default */ if(!f->shared->read_attempts) f->shared->read_attempts = H5F_METADATA_READ_ATTEMPTS; - } /* end else */ + } /* Determine the # of bins for metdata read retries */ if(H5F_set_retries(f) < 0) @@ -1031,8 +1033,7 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t if(H5P_get(plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &(f->shared->object_flush)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get object flush cb info") - /* - * Create a metadata cache with the specified number of elements. + /* Create a metadata cache with the specified number of elements. * The cache might be created with a different number of elements and * the access property list should be updated to reflect that. */ @@ -1069,12 +1070,12 @@ done: HDONE_ERROR(H5E_FILE, H5E_CANTDEC, NULL, "can't close property list") f->shared = H5FL_FREE(H5F_file_t, f->shared); - } /* end if */ + } f = H5FL_FREE(H5F_t, f); - } /* end if */ + } FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_new() */ +} /* end H5F__new() */ /*------------------------------------------------------------------------- @@ -1587,7 +1588,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "SWMR read access flag not the same for file that is already open") /* Allocate new "high-level" file struct */ - if((file = H5F_new(shared, flags, fcpl_id, fapl_id, NULL)) == NULL) + if((file = H5F__new(shared, flags, fcpl_id, fapl_id, NULL)) == NULL) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create new file object") } /* end if */ else { @@ -1615,7 +1616,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) } /* end if */ /* Create the 'top' file structure */ - if(NULL == (file = H5F_new(NULL, flags, fcpl_id, fapl_id, lf))) { + if(NULL == (file = H5F__new(NULL, flags, fcpl_id, fapl_id, lf))) { /* If this is the only time the file has been opened and the struct * returned is NULL, H5FD_close() will never be called via H5F_dest() * so we have to close lf here before heading to the error handling. @@ -2085,7 +2086,7 @@ H5F__close_cb(H5F_t *f) unsigned nopen_objs = 0; /* Number of open objects in file/mount hierarchy */ /* Get the number of open objects and open files on this file/mount hierarchy */ - if(H5F_mount_count_ids(f, &nopen_files, &nopen_objs) < 0) + if(H5F__mount_count_ids(f, &nopen_files, &nopen_objs) < 0) HGOTO_ERROR(H5E_SYM, H5E_MOUNT, FAIL, "problem checking mount hierarchy") /* If there are no other file IDs open on this file/mount hier., but @@ -2150,7 +2151,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) } /* end if */ /* Get the number of open objects and open files on this file/mount hierarchy */ - if(H5F_mount_count_ids(f, &nopen_files, &nopen_objs) < 0) + if(H5F__mount_count_ids(f, &nopen_files, &nopen_objs) < 0) HGOTO_ERROR(H5E_SYM, H5E_MOUNT, FAIL, "problem checking mount hierarchy") /* diff --git a/src/H5Fmount.c b/src/H5Fmount.c index e3a92fd..e01ad55 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -15,21 +15,18 @@ /* Packages needed by this file... */ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ /* PRIVATE PROTOTYPES */ -static herr_t H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, - hid_t plist_id); -static herr_t H5F__unmount(H5G_loc_t *loc, const char *name); -static void H5F_mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs); +static void H5F__mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs); /*------------------------------------------------------------------------- @@ -47,16 +44,17 @@ static void H5F_mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigne herr_t H5F__close_mounts(H5F_t *f) { - unsigned u; /* Local index */ - herr_t ret_value=SUCCEED; /* Return value */ + unsigned u; /* Local index */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE HDassert(f); /* Unmount all child files. Loop backwards to avoid having to adjust u when * a file is unmounted. Note that we rely on unsigned u "wrapping around" - * to terminate the loop. */ + * to terminate the loop. + */ for (u = f->shared->mtab.nmounts - 1; u < f->shared->mtab.nmounts; u--) { /* Only unmount children mounted to this top level file structure */ if(f->shared->mtab.child[u].file->parent == f) { @@ -77,7 +75,7 @@ H5F__close_mounts(H5F_t *f) f->shared->mtab.nmounts--; f->nmounts--; } - } /* end if */ + } HDassert(f->nmounts == 0); @@ -100,7 +98,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED plist_id) { H5G_t *mount_point = NULL; /*mount point group */ @@ -112,9 +110,9 @@ H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED H5G_name_t mp_path; /* Mount point group hier. path */ H5O_loc_t mp_oloc; /* Mount point object location */ H5G_loc_t root_loc; /* Group location of root of file to mount */ - herr_t ret_value = SUCCEED; /*return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_PACKAGE_VOL HDassert(loc); HDassert(name && *name); @@ -162,9 +160,9 @@ H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED mp_loc.path = H5G_nameof(mount_point); HDassert(mp_loc.path); for(ancestor = parent; ancestor; ancestor = ancestor->parent) { - if(ancestor->shared == child->shared) - HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount would introduce a cycle") - } /* end for */ + if(ancestor->shared == child->shared) + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount would introduce a cycle") + } /* Make certain that the parent & child files have the same "file close degree" */ if(parent->shared->fc_degree != child->shared->fc_degree) @@ -181,29 +179,29 @@ H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED while(lt < rt && cmp) { H5O_loc_t *oloc; /*temporary symbol table entry */ - md = (lt + rt) / 2; - oloc = H5G_oloc(parent->shared->mtab.child[md].group); - cmp = H5F_addr_cmp(mp_loc.oloc->addr, oloc->addr); - if(cmp < 0) - rt = md; - else if(cmp > 0) - lt = md + 1; - } /* end while */ + md = (lt + rt) / 2; + oloc = H5G_oloc(parent->shared->mtab.child[md].group); + cmp = H5F_addr_cmp(mp_loc.oloc->addr, oloc->addr); + if(cmp < 0) + rt = md; + else if(cmp > 0) + lt = md + 1; + } if(cmp > 0) md++; if(!cmp) - HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point is already in use") + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point is already in use") /* Make room in the table */ if(parent->shared->mtab.nmounts >= parent->shared->mtab.nalloc) { - unsigned n = MAX(16, 2 * parent->shared->mtab.nalloc); - H5F_mount_t *x = (H5F_mount_t *)H5MM_realloc(parent->shared->mtab.child, n * sizeof(parent->shared->mtab.child[0])); + unsigned n = MAX(16, 2 * parent->shared->mtab.nalloc); + H5F_mount_t *x = (H5F_mount_t *)H5MM_realloc(parent->shared->mtab.child, n * sizeof(parent->shared->mtab.child[0])); - if(!x) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for mount table") - parent->shared->mtab.child = x; - parent->shared->mtab.nalloc = n; - } /* end if */ + if(!x) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for mount table") + parent->shared->mtab.child = x; + parent->shared->mtab.nalloc = n; + } /* Insert into table */ HDmemmove(parent->shared->mtab.child + md + 1, parent->shared->mtab.child + md, @@ -228,19 +226,19 @@ H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED /* We pass H5G_UNKNOWN as object type; search all IDs */ if(H5G_name_replace(NULL, H5G_NAME_MOUNT, mp_loc.oloc->file, mp_loc.path->full_path_r, root_loc.oloc->file, root_loc.path->full_path_r) < 0) - HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to replace name") + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to replace name") done: if(ret_value < 0) { if(mount_point) { if(H5G_close(mount_point) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close mounted group") - } /* end if */ + } else { if(H5G_loc_free(&mp_loc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to free mount location") - } /* end else */ - } /* end if */ + } + } FUNC_LEAVE_NOAPI_VOL(ret_value) } /* end H5F__mount() */ @@ -264,7 +262,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5F__unmount(H5G_loc_t *loc, const char *name) { H5G_t *child_group = NULL; /* Child's group in parent mtab */ @@ -279,7 +277,7 @@ H5F__unmount(H5G_loc_t *loc, const char *name) int child_idx; /* Index of child in parent's mtab */ herr_t ret_value = SUCCEED; /*return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_PACKAGE_VOL HDassert(loc); HDassert(name && *name); @@ -304,41 +302,43 @@ H5F__unmount(H5G_loc_t *loc, const char *name) if(child->parent && H5F_addr_eq(mp_oloc.addr, mnt_oloc->addr)) { unsigned u; /*counters */ - /* - * We've been given the root group of the child. We do a reverse - * lookup in the parent's mount table to find the correct entry. - */ - parent = child->parent; - for(u = 0; u < parent->shared->mtab.nmounts; u++) { - if(parent->shared->mtab.child[u].file->shared == child->shared) { + /* + * We've been given the root group of the child. We do a reverse + * lookup in the parent's mount table to find the correct entry. + */ + parent = child->parent; + for(u = 0; u < parent->shared->mtab.nmounts; u++) { + if(parent->shared->mtab.child[u].file->shared == child->shared) { /* Found the correct index */ child_idx = (int)u; break; - } /* end if */ - } /* end for */ - } else { + } + } + } + else { unsigned lt, rt, md = 0; /*binary search indices */ int cmp; /*binary search comparison value*/ - /* - * We've been given the mount point in the parent. We use a binary - * search in the parent to locate the mounted file, if any. - */ - parent = child; /*we guessed wrong*/ - lt = 0; - rt = parent->shared->mtab.nmounts; - cmp = -1; - while(lt < rt && cmp) { - md = (lt + rt) / 2; - mnt_oloc = H5G_oloc(parent->shared->mtab.child[md].group); - cmp = H5F_addr_cmp(mp_oloc.addr, mnt_oloc->addr); - if (cmp<0) - rt = md; - else - lt = md + 1; - } /* end while */ - if(cmp) - HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "not a mount point") + /* We've been given the mount point in the parent. We use a binary + * search in the parent to locate the mounted file, if any. + */ + parent = child; /*we guessed wrong*/ + lt = 0; + rt = parent->shared->mtab.nmounts; + cmp = -1; + + while(lt < rt && cmp) { + md = (lt + rt) / 2; + mnt_oloc = H5G_oloc(parent->shared->mtab.child[md].group); + cmp = H5F_addr_cmp(mp_oloc.addr, mnt_oloc->addr); + if (cmp<0) + rt = md; + else + lt = md + 1; + } + + if(cmp) + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "not a mount point") /* Found the correct index, set the info about the child */ child_idx = (int)md; @@ -426,15 +426,12 @@ H5F_is_mount(const H5F_t *file) /*------------------------------------------------------------------------- - * Function: H5Fmount + * Function: H5Fmount * - * Purpose: Mount file CHILD_ID onto the group specified by LOC_ID and - * NAME using mount properties PLIST_ID. + * Purpose: Mount file CHILD_ID onto the group specified by LOC_ID and + * NAME using mount properties PLIST_ID. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Tuesday, October 6, 1998 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -443,18 +440,18 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) { H5G_loc_t loc; H5F_t *child = NULL; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*sii", loc_id, name, child_id, plist_id); /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") if(NULL == (child = (H5F_t *)H5I_object_verify(child_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") if(H5P_DEFAULT == plist_id) plist_id = H5P_FILE_MOUNT_DEFAULT; else @@ -465,9 +462,9 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Do the mount */ + /* Perform the mount operation */ if(H5F__mount(&loc, name, child, plist_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file") + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file") done: FUNC_LEAVE_API(ret_value) @@ -475,21 +472,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Funmount - * - * Purpose: Given a mount point, dissassociate the mount point's file - * from the file mounted there. Do not close either file. + * Function: H5Funmount * - * The mount point can either be the group in the parent or the - * root group of the mounted file (both groups have the same - * name). If the mount point was opened before the mount then - * it's the group in the parent, but if it was opened after the - * mount then it's the root group of the child. + * Purpose: Given a mount point, dissassociate the mount point's file + * from the file mounted there. Do not close either file. * - * Return: Non-negative on success/Negative on failure + * The mount point can either be the group in the parent or the + * root group of the mounted file (both groups have the same + * name). If the mount point was opened before the mount then + * it's the group in the parent, but if it was opened after the + * mount then it's the root group of the child. * - * Programmer: Robb Matzke - * Tuesday, October 6, 1998 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -497,16 +491,16 @@ herr_t H5Funmount(hid_t loc_id, const char *name) { H5G_loc_t loc; - 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 args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) @@ -514,7 +508,7 @@ H5Funmount(hid_t loc_id, const char *name) /* Unmount */ if(H5F__unmount(&loc, name) < 0) - HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file") + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file") done: FUNC_LEAVE_API(ret_value) @@ -522,12 +516,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_mount_count_ids_recurse + * Function: H5F__mount_count_ids_recurse * - * Purpose: Helper routine for counting number of open IDs in mount + * Purpose: Helper routine for counting number of open IDs in mount * hierarchy. * - * Return: + * Return: void * * Programmer: Quincey Koziol * Tuesday, July 19, 2005 @@ -535,11 +529,11 @@ done: *------------------------------------------------------------------------- */ static void -H5F_mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs) +H5F__mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs) { unsigned u; /* Local index value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(f); @@ -564,20 +558,20 @@ H5F_mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigned *nopen_obj if(H5G_get_shared_count(f->shared->mtab.child[u].group) > 1) *nopen_objs += 1; - H5F_mount_count_ids_recurse(f->shared->mtab.child[u].file, nopen_files, nopen_objs); + H5F__mount_count_ids_recurse(f->shared->mtab.child[u].file, nopen_files, nopen_objs); } - } /* end for */ + } FUNC_LEAVE_NOAPI_VOID -} /* end H5F_mount_count_ids_recurse() */ +} /* end H5F__mount_count_ids_recurse() */ /*------------------------------------------------------------------------- - * Function: H5F_mount_count_ids + * Function: H5F__mount_count_ids * - * Purpose: Count the number of open file & object IDs in a mount hierarchy + * Purpose: Count the number of open file & object IDs in a mount hierarchy * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tues, July 19, 2005 @@ -585,9 +579,9 @@ H5F_mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigned *nopen_obj *------------------------------------------------------------------------- */ herr_t -H5F_mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs) +H5F__mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(f); @@ -599,10 +593,10 @@ H5F_mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs) f = f->parent; /* Count open IDs in the hierarchy */ - H5F_mount_count_ids_recurse(f, nopen_files, nopen_objs); + H5F__mount_count_ids_recurse(f, nopen_files, nopen_objs); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5F_mount_count_ids() */ +} /* end H5F__mount_count_ids() */ /*------------------------------------------------------------------------- @@ -648,11 +642,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_flush_mounts + * Function: H5F_flush_mounts * - * Purpose: Flush a mount hierarchy + * Purpose: Flush a mount hierarchy * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Fri, August 21, 2009 @@ -715,22 +709,22 @@ H5F_traverse_mount(H5O_loc_t *oloc/*in,out*/) * of file2, which is mounted somewhere in file3. */ do { - /* - * Use a binary search to find the potential mount point in the mount - * table for the parent - */ - lt = 0; - rt = parent->shared->mtab.nmounts; - cmp = -1; - while(lt < rt && cmp) { - md = (lt + rt) / 2; - mnt_oloc = H5G_oloc(parent->shared->mtab.child[md].group); - cmp = H5F_addr_cmp(oloc->addr, mnt_oloc->addr); - if(cmp < 0) - rt = md; - else - lt = md + 1; - } /* end while */ + /* + * Use a binary search to find the potential mount point in the mount + * table for the parent + */ + lt = 0; + rt = parent->shared->mtab.nmounts; + cmp = -1; + while(lt < rt && cmp) { + md = (lt + rt) / 2; + mnt_oloc = H5G_oloc(parent->shared->mtab.child[md].group); + cmp = H5F_addr_cmp(oloc->addr, mnt_oloc->addr); + if(cmp < 0) + rt = md; + else + lt = md + 1; + } /* Copy root info over to ENT */ if(0 == cmp) { diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 050e426..f815005 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -30,18 +30,18 @@ #include "H5Fprivate.h" /* Other public headers needed by this file */ -#include "H5Bpublic.h" /* B-tree header, for H5B_NUM_BTREE_ID */ +#include "H5Bpublic.h" /* B-tree header, for H5B_NUM_BTREE_ID */ /* Other private headers needed by this file */ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5FOprivate.h" /* File objects */ -#include "H5FSprivate.h" /* File free space */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Oprivate.h" /* Object header messages */ -#include "H5PBprivate.h" /* Page buffer */ -#include "H5UCprivate.h" /* Reference counted object functions */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5FOprivate.h" /* File objects */ +#include "H5FSprivate.h" /* File free space */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Oprivate.h" /* Object header messages */ +#include "H5PBprivate.h" /* Page buffer */ +#include "H5UCprivate.h" /* Reference counted object functions */ /* @@ -394,13 +394,10 @@ H5FL_EXTERN(H5F_file_t); /******************************/ /* General routines */ -H5F_t *H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, - hid_t fapl_id, H5FD_t *lf); +H5_DLL H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush); -H5_DLL H5F_t *H5F__create(const char *filename, unsigned flags, hid_t fcpl_id, - hid_t fapl_id); -H5_DLL H5F_t * H5F__open(const char *filename, unsigned flags, hid_t fcpl_id, - hid_t fapl_id); +H5_DLL H5F_t *H5F__create(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id); +H5_DLL H5F_t *H5F__open(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id); H5_DLL herr_t H5F__flush(H5F_t *f, H5F_scope_t scope); H5_DLL herr_t H5F__flush_real(H5F_t *f); H5_DLL htri_t H5F__is_hdf5(const char *name); @@ -408,8 +405,7 @@ H5_DLL herr_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, H5_DLL herr_t H5F__get_freespace(H5F_t *f, hsize_t *tot_space); H5_DLL ssize_t H5F__get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len); H5_DLL herr_t H5F__get_info(H5F_t *f, H5F_info2_t *finfo); -H5_DLL ssize_t H5F__get_free_sections(H5F_t *f, H5FD_mem_t type, - size_t nsects, H5F_sect_info_t *sect_info); +H5_DLL ssize_t H5F__get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info); H5_DLL herr_t H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info); H5_DLL herr_t H5F__format_convert(H5F_t *f); H5_DLL herr_t H5F__start_swmr_write(H5F_t *f); @@ -418,9 +414,10 @@ H5_DLL herr_t H5F__close_cb(H5F_t *f); H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high); /* File mount related routines */ +H5_DLL herr_t H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id); +H5_DLL herr_t H5F__unmount(H5G_loc_t *loc, const char *name); H5_DLL herr_t H5F__close_mounts(H5F_t *f); -H5_DLL int H5F_term_unmount_cb(void *obj_ptr, hid_t obj_id, void *key); -H5_DLL herr_t H5F_mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs); +H5_DLL herr_t H5F__mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs); /* Superblock related routines */ H5_DLL herr_t H5F__super_init(H5F_t *f); @@ -430,18 +427,14 @@ H5_DLL herr_t H5F__super_free(H5F_super_t *sblock); /* Superblock extension related routines */ H5_DLL herr_t H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr); -H5_DLL herr_t H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, - hbool_t may_create, unsigned mesg_flags); +H5_DLL herr_t H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, hbool_t may_create, unsigned mesg_flags); H5_DLL herr_t H5F__super_ext_remove_msg(H5F_t *f, unsigned id); H5_DLL herr_t H5F__super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hbool_t was_created); /* Metadata accumulator routines */ -H5_DLL herr_t H5F__accum_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, - size_t size, void *buf); -H5_DLL herr_t H5F__accum_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, - size_t size, const void *buf); -H5_DLL herr_t H5F__accum_free(H5F_t *f, H5FD_mem_t type, haddr_t addr, - hsize_t size); +H5_DLL herr_t H5F__accum_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf); +H5_DLL herr_t H5F__accum_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); +H5_DLL herr_t H5F__accum_free(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size); H5_DLL herr_t H5F__accum_flush(H5F_t *f); H5_DLL herr_t H5F__accum_reset(H5F_t *f, hbool_t flush); @@ -451,10 +444,9 @@ H5_DLL H5F_file_t * H5F_sfile_search(H5FD_t *lf); H5_DLL herr_t H5F_sfile_remove(H5F_file_t *shared); /* External file cache routines */ -H5_DLL H5F_efc_t *H5F_efc_create(unsigned max_nfiles); -H5_DLL H5F_t *H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, - hid_t fcpl_id, hid_t fapl_id); -H5_DLL unsigned H5F_efc_max_nfiles(H5F_efc_t *efc); +H5_DLL H5F_efc_t *H5F__efc_create(unsigned max_nfiles); +H5_DLL H5F_t *H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); +H5_DLL unsigned H5F__efc_max_nfiles(H5F_efc_t *efc); H5_DLL herr_t H5F__efc_release(H5F_efc_t *efc); H5_DLL herr_t H5F__efc_destroy(H5F_efc_t *efc); H5_DLL herr_t H5F__efc_try_close(H5F_t *f); @@ -462,8 +454,7 @@ H5_DLL herr_t H5F__efc_try_close(H5F_t *f); /* Space allocation routines */ H5_DLL haddr_t H5F__alloc(H5F_t *f, H5F_mem_t type, hsize_t size, haddr_t *frag_addr, hsize_t *frag_size); H5_DLL herr_t H5F__free(H5F_t *f, H5F_mem_t type, haddr_t addr, hsize_t size); -H5_DLL htri_t H5F__try_extend(H5F_t *f, H5FD_mem_t type, haddr_t blk_end, - hsize_t extra_requested); +H5_DLL htri_t H5F__try_extend(H5F_t *f, H5FD_mem_t type, haddr_t blk_end, hsize_t extra_requested); /* Functions that get/retrieve values from VFD layer */ H5_DLL herr_t H5F__set_eoa(const H5F_t *f, H5F_mem_t type, haddr_t addr); @@ -476,8 +467,7 @@ H5_DLL herr_t H5F__evict_cache_entries(H5F_t *f); /* Testing functions */ #ifdef H5F_TESTING -H5_DLL herr_t H5F_get_sohm_mesg_count_test(hid_t fid, unsigned type_id, - size_t *mesg_count); +H5_DLL herr_t H5F_get_sohm_mesg_count_test(hid_t fid, unsigned type_id, size_t *mesg_count); H5_DLL herr_t H5F_check_cached_stab_test(hid_t file_id); H5_DLL herr_t H5F_get_maxaddr_test(hid_t file_id, haddr_t *maxaddr); H5_DLL herr_t H5F_get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 3e77700..f06d4d0 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -296,7 +296,7 @@ typedef struct H5F_t H5F_t; #define H5F_BASE_ADDR(F) ((F)->shared->sblock->base_addr) #define H5F_SYM_LEAF_K(F) ((F)->shared->sblock->sym_leaf_k) #define H5F_KVALUE(F,T) ((F)->shared->sblock->btree_k[(T)->id]) -#define H5F_NREFS(F) ((F)->shared->nrefs) +#define H5F_NREFS(F) ((F)->shared->nrefs) #define H5F_SIZEOF_ADDR(F) ((F)->shared->sizeof_addr) #define H5F_SIZEOF_SIZE(F) ((F)->shared->sizeof_size) #define H5F_SOHM_ADDR(F) ((F)->shared->sohm_addr) @@ -713,8 +713,7 @@ typedef enum H5F_prefix_open_t { /***************************************/ /* Private functions */ -H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, - hid_t fapl_id); +H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/); H5_DLL herr_t H5F_start_swmr_write(H5F_t *file); @@ -795,10 +794,8 @@ H5_DLL herr_t H5F_traverse_mount(struct H5O_loc_t *oloc/*in,out*/); H5_DLL herr_t H5F_flush_mounts(H5F_t *f); /* Functions that operate on blocks of bytes wrt super block */ -H5_DLL herr_t H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, - size_t size, void *buf/*out*/); -H5_DLL herr_t H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, - size_t size, const void *buf); +H5_DLL herr_t H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); +H5_DLL herr_t H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); /* Functions that flush or evict */ H5_DLL herr_t H5F_flush_tagged_metadata(H5F_t *f, haddr_t tag); @@ -851,8 +848,7 @@ H5_DLL H5F_t *H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix /* Global heap CWFS routines */ H5_DLL herr_t H5F_cwfs_add(H5F_t *f, struct H5HG_heap_t *heap); H5_DLL herr_t H5F_cwfs_find_free_heap(H5F_t *f, size_t need, haddr_t *addr); -H5_DLL herr_t H5F_cwfs_advance_heap(H5F_t *f, struct H5HG_heap_t *heap, - hbool_t add_heap); +H5_DLL herr_t H5F_cwfs_advance_heap(H5F_t *f, struct H5HG_heap_t *heap, hbool_t add_heap); H5_DLL herr_t H5F_cwfs_remove_heap(H5F_file_t *shared, struct H5HG_heap_t *heap); /* Debugging functions */ diff --git a/test/efc.c b/test/efc.c index d40d4a2..5a946bb 100644 --- a/test/efc.c +++ b/test/efc.c @@ -36,8 +36,8 @@ static char filename[6][1024]; /* Global property lists - just copies of the defaults (necessary to use * internal functions */ -hid_t fcpl_id = -1; -hid_t fapl_id = -1; +hid_t fcpl_id = H5I_INVALID_HID; +hid_t fapl_id = H5I_INVALID_HID; /*------------------------------------------------------------------------- @@ -68,8 +68,9 @@ test_single(void) TESTING("single EFC"); - /* Set EFC size to 3. Do this instead of H5F_efc_create() so we can pass - * a file pointer to H5F__efc_open containing the EFC. */ + /* Set EFC size to 3. Do this instead of H5F__efc_create() so we can pass + * a file pointer to H5F__efc_open containing the EFC. + */ if(H5Pset_elink_file_cache_size(fapl_id, 3) < 0) TEST_ERROR @@ -84,8 +85,9 @@ test_single(void) /* Test 1: Open file 1 through EFC, close, then open normally, verify ref - * count = 2, release EFC, verify ref count = 1. Verifies a file can be - * held open by the EFC. */ + * count = 2, release EFC, verify ref count = 1. Verifies a file can be + * held open by the EFC. + */ if(NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR @@ -502,17 +504,19 @@ test_graph_nocycle(void) TESTING("graph of EFCs without cycles"); - /* Set EFC size to 8. Do this instead of H5F_efc_create() so we can pass - * a file pointer to H5F__efc_open containing the EFC. Set to a high number - * because we don't test the EFC becoming too large in this test. */ + /* Set EFC size to 8. Do this instead of H5F__efc_create() so we can pass + * a file pointer to H5F__efc_open containing the EFC. Set to a high number + * because we don't test the EFC becoming too large in this test. + */ if(H5Pset_elink_file_cache_size(fapl_id, 8) < 0) TEST_ERROR - /* Test 1: Simple 3 file chain. Open file 1 through file 0, then open file - * 2 through file 1. Release file 0's EFC and verify that file 2 gets its - * ref count reduced (implying file 1 was closed). Do the same with the - * opening order reversed. */ + /* Test 1: Simple 3 file chain. Open file 1 through file 0, then open file + * 2 through file 1. Release file 0's EFC and verify that file 2 gets its + * ref count reduced (implying file 1 was closed). Do the same with the + * opening order reversed. + */ if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR @@ -847,15 +851,17 @@ test_graph_cycle(void) TESTING("graph of EFCs with cycles"); - /* Set EFC size to 8. Do this instead of H5F_efc_create() so we can pass - * a file pointer to H5F__efc_open containing the EFC. Set to a high number - * because we don't test the EFC becoming too large in this test. */ + /* Set EFC size to 8. Do this instead of H5F__efc_create() so we can pass + * a file pointer to H5F__efc_open containing the EFC. Set to a high number + * because we don't test the EFC becoming too large in this test. + */ if(H5Pset_elink_file_cache_size(fapl_id, 8) < 0) TEST_ERROR - /* Test 1: File caches itself. Verify that closing the file causes it to be - * actually closed, and there is no other unexpected behavior. */ + /* Test 1: File caches itself. Verify that closing the file causes it to be + * actually closed, and there is no other unexpected behavior. + */ if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR -- cgit v0.12