From dffe5efbb09930cc7daa26f7fbf311558491bb95 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 4 Jun 2020 12:52:31 -0700 Subject: H5F normalizations with develop. --- src/H5F.c | 36 ++++++++++++++++++------------------ src/H5Fint.c | 6 +++--- src/H5Fpkg.h | 12 ++++++------ src/H5Fsfile.c | 26 +++++++++++++------------- test/mount.c | 54 ++++++++++++++++++++++++++++++------------------------ 5 files changed, 70 insertions(+), 64 deletions(-) diff --git a/src/H5F.c b/src/H5F.c index b04db89..60e4897 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -21,20 +21,20 @@ /***********/ /* 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 "H5MFprivate.h" /* File memory management */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ -#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 "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5Tprivate.h" /* Datatypes */ /****************/ @@ -76,10 +76,10 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /* File ID class */ static const H5I_class_t H5I_FILE_CLS[1] = {{ - H5I_FILE, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ - (H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */ + H5I_FILE, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */ }}; diff --git a/src/H5Fint.c b/src/H5Fint.c index 73776ff..fbb1e2e 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1069,7 +1069,7 @@ H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create open object data structure") /* Add new "shared" struct to list of open files */ - if(H5F_sfile_add(f->shared) < 0) + if(H5F__sfile_add(f->shared) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to append to list of open files") } /* end else */ @@ -1264,7 +1264,7 @@ H5F__dest(H5F_t *f, hbool_t flush) HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); /* Remove shared file struct from list of open files */ - if(H5F_sfile_remove(f->shared) < 0) + if(H5F__sfile_remove(f->shared) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") @@ -1514,7 +1514,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) } /* end if */ /* Is the file already open? */ - if((shared = H5F_sfile_search(lf)) != NULL) { + if((shared = H5F__sfile_search(lf)) != NULL) { /* * The file is already open, so use that one instead of the one we * just opened. We only one one H5FD_t* per file so one doesn't diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 5aff3a6..1af5995 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -326,7 +326,7 @@ struct H5F_shared_t { /* been used accessed for either */ /* allocation or deallocation */ /* since file open. */ - haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */ + haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */ /* for self referential FSMs */ haddr_t eoa_post_fsm_fsalloc; /* eoa post file space allocation */ /* for self referential FSMs */ @@ -354,7 +354,7 @@ struct H5F_shared_t { /* Object flush info */ H5F_object_flush_t object_flush; /* Information for object flush callback */ - hbool_t crt_dset_min_ohdr_flag; /* flag to create minimized dataset object headers */ + hbool_t crt_dset_min_ohdr_flag; /* flag to minimize created dataset object header */ }; /* @@ -366,7 +366,7 @@ struct H5F_t { char *open_name; /* Name used to open file */ char *actual_name; /* Actual name of the file, after resolving symlinks, etc. */ char *extpath; /* Path for searching target external link file */ - H5F_shared_t *shared; /* The shared file info */ + H5F_shared_t *shared; /* The shared file info */ unsigned nopen_objs; /* Number of open object headers */ H5FO_t *obj_count; /* # of time each object is opened through top file structure */ hid_t file_id; /* ID of this file */ @@ -435,9 +435,9 @@ H5_DLL herr_t H5F__accum_flush(H5F_t *f); H5_DLL herr_t H5F__accum_reset(H5F_t *f, hbool_t flush); /* Shared file list related routines */ -H5_DLL herr_t H5F_sfile_add(H5F_shared_t *shared); -H5_DLL H5F_shared_t * H5F_sfile_search(H5FD_t *lf); -H5_DLL herr_t H5F_sfile_remove(H5F_shared_t *shared); +H5_DLL herr_t H5F__sfile_add(H5F_shared_t *shared); +H5_DLL H5F_shared_t *H5F__sfile_search(H5FD_t *lf); +H5_DLL herr_t H5F__sfile_remove(H5F_shared_t *shared); /* External file cache routines */ H5_DLL H5F_efc_t *H5F__efc_create(unsigned max_nfiles); diff --git a/src/H5Fsfile.c b/src/H5Fsfile.c index 1678f49..9a9bbab 100644 --- a/src/H5Fsfile.c +++ b/src/H5Fsfile.c @@ -84,7 +84,7 @@ H5F_sfile_assert_num(unsigned n) /*------------------------------------------------------------------------- - * Function: H5F_sfile_add + * Function: H5F__sfile_add * * Purpose: Add a "shared" file struct to the list of open files * @@ -96,12 +96,12 @@ H5F_sfile_assert_num(unsigned n) *------------------------------------------------------------------------- */ herr_t -H5F_sfile_add(H5F_shared_t *shared) +H5F__sfile_add(H5F_shared_t *shared) { H5F_sfile_node_t *new_shared; /* New shared file node */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(shared); @@ -119,11 +119,11 @@ H5F_sfile_add(H5F_shared_t *shared) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_sfile_add() */ +} /* end H5F__sfile_add() */ /*------------------------------------------------------------------------- - * Function: H5F_sfile_search + * Function: H5F__sfile_search * * Purpose: Search for a "shared" file with low-level file info that * matches @@ -136,12 +136,12 @@ done: *------------------------------------------------------------------------- */ H5F_shared_t * -H5F_sfile_search(H5FD_t *lf) +H5F__sfile_search(H5FD_t *lf) { H5F_sfile_node_t *curr; /* Current shared file node */ - H5F_shared_t *ret_value = NULL; /* Return value */ + H5F_shared_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(lf); @@ -159,11 +159,11 @@ H5F_sfile_search(H5FD_t *lf) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_sfile_search() */ +} /* end H5F__sfile_search() */ /*------------------------------------------------------------------------- - * Function: H5F_sfile_remove + * Function: H5F__sfile_remove * * Purpose: Remove a "shared" file struct from the list of open files * @@ -175,13 +175,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_sfile_remove(H5F_shared_t *shared) +H5F__sfile_remove(H5F_shared_t *shared) { H5F_sfile_node_t *curr; /* Current shared file node */ H5F_sfile_node_t *last; /* Last shared file node */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(shared); @@ -213,5 +213,5 @@ H5F_sfile_remove(H5F_shared_t *shared) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_sfile_remove() */ +} /* end H5F__sfile_remove() */ diff --git a/test/mount.c b/test/mount.c index b7d2858..181b8cb 100644 --- a/test/mount.c +++ b/test/mount.c @@ -404,39 +404,42 @@ test_hide(hid_t fapl) char filename1[1024], filename2[1024]; TESTING("name hiding under mount point"); - h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); - h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); + h5_fixname(FILENAME[0], fapl, filename1, sizeof(filename1)); + h5_fixname(FILENAME[1], fapl, filename2, sizeof(filename2)); if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 || (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Get information about file1:/mnt1/file1 for later */ - if(H5Oget_info_by_name2(file1, "/mnt1/file1", &oi1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/mnt1/file1", &oi1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR /* Build the virtual file */ - if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR /* Original names under file1:/mnt1 should not be accessible */ H5E_BEGIN_TRY { - grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT); + grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT); } H5E_END_TRY; if(grp >= 0) { - H5_FAILED(); - HDputs(" Name is still accessible under mount point."); - TEST_ERROR - } /* end if */ + H5_FAILED(); + HDputs(" Name is still accessible under mount point."); + TEST_ERROR + } /* * The original objects under file1:/mnt1 are still accessible by their * other names. This is a rather stupid test but demonstrates a point. */ - if(H5Oget_info_by_name2(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { - H5_FAILED(); - HDputs(" Hard link failed for hidden object."); - TEST_ERROR - } /* end if */ + H5_FAILED(); + HDputs(" Hard link failed for hidden object."); + TEST_ERROR + } /* Unmount and close objects */ if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR @@ -448,9 +451,9 @@ test_hide(hid_t fapl) error: H5E_BEGIN_TRY { - H5Gclose(grp); - H5Fclose(file1); - H5Fclose(file2); + H5Gclose(grp); + H5Fclose(file1); + H5Fclose(file2); } H5E_END_TRY; return 1; } /* end test_hide() */ @@ -490,20 +493,23 @@ test_assoc(hid_t fapl) FAIL_STACK_ERROR /* Get information about the root of file2 */ - if(H5Oget_info2(file2, &oi1, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR + if(H5Oget_info2(file2, &oi1, H5O_INFO_BASIC) < 0) + FAIL_STACK_ERROR /* Create the virtual file */ - if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR /* * Get info about the mount point -- should be the same as the root group * of file2. */ - if(H5Oget_info_by_name2(file1, "/mnt1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/mnt1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { - H5_FAILED(); - HDputs(" Association failed."); + H5_FAILED(); + HDputs(" Association failed."); TEST_ERROR } /* end if */ @@ -517,8 +523,8 @@ test_assoc(hid_t fapl) error: H5E_BEGIN_TRY { - H5Fclose(file2); - H5Fclose(file1); + H5Fclose(file2); + H5Fclose(file1); } H5E_END_TRY; return 1; } /* end test_assoc() */ -- cgit v0.12