From 7c921910d079b49107e50bf7dda97c73cb66b19d Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 21 Apr 2011 06:53:45 -0500 Subject: [svn-r20587] Description: Initial commit of John Biddescomb's VFD & MPI tweaks. Tested on: None (yet) (h5committest not required for this branch) --- src/H5AC.c | 2 +- src/H5C.c | 2 +- src/H5Dchunk.c | 2 +- src/H5Dcontig.c | 2 +- src/H5Dint.c | 6 +++--- src/H5Dio.c | 7 ++++--- src/H5F.c | 2 +- src/H5FD.c | 35 ++++------------------------------- src/H5FDcore.c | 1 + src/H5FDfamily.c | 1 + src/H5FDlog.c | 1 + src/H5FDmpi.h | 4 ---- src/H5FDmpio.c | 5 ++++- src/H5FDmpiposix.c | 5 ++++- src/H5FDmulti.c | 1 + src/H5FDpublic.h | 19 +++++++++++++++++-- src/H5FDsec2.c | 1 + src/H5FDstdio.c | 1 + src/H5FDwindows.c | 1 + 19 files changed, 48 insertions(+), 50 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index cfb8a17..011e40f 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -485,7 +485,7 @@ H5AC_create(const H5F_t *f, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad cache configuration") #ifdef H5_HAVE_PARALLEL - if(IS_H5FD_MPI(f)) { + if ( H5F_HAS_FEATURE(f,H5FD_FEAT_HAS_MPI) ) { MPI_Comm mpi_comm; int mpi_rank; int mpi_size; diff --git a/src/H5C.c b/src/H5C.c index aed2b90..7a04005 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -8133,7 +8133,7 @@ H5C_flush_single_entry(H5F_t * f, */ if ( ( ! clear_only ) && ( entry_ptr->is_dirty ) && - ( IS_H5FD_MPI(f) ) ) { + ( H5F_HAS_FEATURE(f,H5FD_FEAT_HAS_MPI) ) ) { H5P_genplist_t *dxpl; /* Dataset transfer property list */ H5FD_mpio_xfer_t xfer_mode; /* I/O xfer mode property value */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 64efc8a..1f09c97 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -3164,7 +3164,7 @@ H5D_chunk_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, #ifdef H5_HAVE_PARALLEL /* Retrieve MPI parameters */ - if(IS_H5FD_MPI(dset->oloc.file)) { + if(H5F_HAS_FEATURE(dset->oloc.file,H5FD_FEAT_HAS_MPI)) { /* Get the MPI communicator */ if(MPI_COMM_NULL == (mpi_comm = H5F_mpi_get_comm(dset->oloc.file))) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI communicator") diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 9a6e08f..ffa275d 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -225,7 +225,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id) #ifdef H5_HAVE_PARALLEL /* Retrieve MPI parameters */ - if(IS_H5FD_MPI(dset->oloc.file)) { + if(H5F_HAS_FEATURE(dset->oloc.file,H5FD_FEAT_HAS_MPI)) { /* Get the MPI communicator */ if(MPI_COMM_NULL == (mpi_comm = H5F_mpi_get_comm(dset->oloc.file))) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI communicator") diff --git a/src/H5Dint.c b/src/H5Dint.c index 8c73888..b0e8827 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1003,7 +1003,7 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "compact dataset must have early space allocation") /* If MPI VFD is used, no filter support yet. */ - if(IS_H5FD_MPI(file) && pline->nused > 0) + if(H5F_HAS_FEATURE(file,H5FD_FEAT_HAS_MPI) && pline->nused > 0) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "Parallel I/O does not support filters yet") /* Get the dataset's external file list information */ @@ -1023,7 +1023,7 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, } /* end if */ /* Check if this dataset is going into a parallel file and set space allocation time */ - if(IS_H5FD_MPI(file)) + if(H5F_HAS_FEATURE(file,H5FD_FEAT_ALLOCATE_EARLY)) new_dset->shared->dcpl_cache.fill.alloc_time = H5D_ALLOC_TIME_EARLY; /* Set the dataset's I/O operations */ @@ -1305,7 +1305,7 @@ H5D_open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id) */ if((H5F_INTENT(dataset->oloc.file) & H5F_ACC_RDWR) && !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage) - && IS_H5FD_MPI(dataset->oloc.file)) { + && H5F_HAS_FEATURE(dataset->oloc.file,H5FD_FEAT_ALLOCATE_EARLY)) { if(H5D_alloc_storage(dataset, dxpl_id, H5D_ALLOC_OPEN, FALSE, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file storage") } /* end if */ diff --git a/src/H5Dio.c b/src/H5Dio.c index b7c2ecb..028f1b0 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -339,7 +339,8 @@ H5D_read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, #ifdef H5_HAVE_PARALLEL /* Collective access is not permissible without a MPI based VFD */ - if(dxpl_cache->xfer_mode == H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPI(dataset->oloc.file)) + if(dxpl_cache->xfer_mode == H5FD_MPIO_COLLECTIVE && + !(H5F_HAS_FEATURE(dataset->oloc.file,H5FD_FEAT_HAS_MPI))) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based drivers only") #endif /*H5_HAVE_PARALLEL*/ @@ -543,7 +544,7 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, /* Various MPI based checks */ #ifdef H5_HAVE_PARALLEL - if(IS_H5FD_MPI(dataset->oloc.file)) { + if H5F_HAS_FEATURE(dataset->oloc.file,H5FD_FEAT_HAS_MPI) { /* If MPI based VFD is used, no VL datatype support yet. */ /* This is because they use the global heap in the file and we don't */ /* support parallel access of that yet */ @@ -768,7 +769,7 @@ H5D_ioinfo_init(H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, #ifdef H5_HAVE_PARALLEL /* Determine if the file was opened with an MPI VFD */ - io_info->using_mpi_vfd = IS_H5FD_MPI(dset->oloc.file); + io_info->using_mpi_vfd = H5F_HAS_FEATURE(dset->oloc.file,H5FD_FEAT_HAS_MPI); #endif /* H5_HAVE_PARALLEL */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5F.c b/src/H5F.c index 5b3c84b..dac276c 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -934,7 +934,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) * merged into the trunk and journaling is enabled, at least until * we make it work. - QAK) */ - f->shared->use_tmp_space = !(IS_H5FD_MPI(f)); + f->shared->use_tmp_space = !H5F_HAS_FEATURE(f,H5FD_FEAT_HAS_MPI); /* * Create a metadata cache with the specified number of elements. diff --git a/src/H5FD.c b/src/H5FD.c index d0683e1..000d267 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -43,17 +43,6 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ #include "H5FDpkg.h" /* File Drivers */ -#include "H5FDcore.h" /* Files stored entirely in memory */ -#include "H5FDfamily.h" /* File families */ -#include "H5FDlog.h" /* sec2 driver with I/O logging (for debugging) */ -#include "H5FDmpi.h" /* MPI-based file drivers */ -#include "H5FDmulti.h" /* Usage-partitioned file family */ -#include "H5FDsec2.h" /* POSIX unbuffered file I/O */ -#include "H5FDstdio.h" /* Standard C buffered I/O */ -#ifdef H5_HAVE_WINDOWS -#include "H5FDwindows.h" /* Windows buffered I/O */ -#endif -#include "H5FDdirect.h" /* Direct file I/O */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ @@ -201,26 +190,6 @@ H5FD_term_interface(void) if(H5_interface_initialize_g) { if((n=H5I_nmembers(H5I_VFL))!=0) { H5I_clear_type(H5I_VFL, FALSE, FALSE); - - /* Reset the VFL drivers, if they've been closed */ - if(H5I_nmembers(H5I_VFL)==0) { - H5FD_sec2_term(); -#ifdef H5_HAVE_DIRECT - H5FD_direct_term(); -#endif - H5FD_log_term(); - H5FD_stdio_term(); -#ifdef H5_HAVE_WINDOWS - H5FD_windows_term(); -#endif - H5FD_family_term(); - H5FD_core_term(); - H5FD_multi_term(); -#ifdef H5_HAVE_PARALLEL - H5FD_mpio_term(); - H5FD_mpiposix_term(); -#endif /* H5_HAVE_PARALLEL */ - } /* end if */ } else { H5I_dec_type_ref(H5I_VFL); H5_interface_initialize_g = 0; @@ -254,6 +223,10 @@ H5FD_free_cls(H5FD_class_t *cls) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_free_cls) + // Give the File driver a chance to free singletons or other objects + // which will become invalid once the class structure is freed + if (cls && cls->terminate) cls->terminate(); + H5MM_xfree(cls); FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5FDcore.c b/src/H5FDcore.c index b3cc84d..68a1e93 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -149,6 +149,7 @@ static const H5FD_class_t H5FD_core_g = { NULL, /*get_type_map */ NULL, /*alloc */ NULL, /*free */ + H5FD_core_term, /*terminate */ H5FD_core_get_eoa, /*get_eoa */ H5FD_core_set_eoa, /*set_eoa */ H5FD_core_get_eof, /*get_eof */ diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 5fd0294..89cb53f 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -136,6 +136,7 @@ static const H5FD_class_t H5FD_family_g = { NULL, /*get_type_map */ NULL, /*alloc */ NULL, /*free */ + H5FD_family_term, /*terminate */ H5FD_family_get_eoa, /*get_eoa */ H5FD_family_set_eoa, /*set_eoa */ H5FD_family_get_eof, /*get_eof */ diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 96df596..a2e8546 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -201,6 +201,7 @@ static const H5FD_class_t H5FD_log_g = { NULL, /*get_type_map */ H5FD_log_alloc, /*alloc */ NULL, /*free */ + H5FD_log_term, /*terminate */ H5FD_log_get_eoa, /*get_eoa */ H5FD_log_set_eoa, /*set_eoa */ H5FD_log_get_eof, /*get_eof */ diff --git a/src/H5FDmpi.h b/src/H5FDmpi.h index b9998dd..2b7ac98 100644 --- a/src/H5FDmpi.h +++ b/src/H5FDmpi.h @@ -73,10 +73,6 @@ typedef struct H5FD_class_mpi_t { /* Macros */ -/* Single macro to check for all file drivers that use MPI */ -#define IS_H5FD_MPI(file) \ - (IS_H5FD_MPIO(file) || IS_H5FD_MPIPOSIX(file)) - #ifdef H5_HAVE_PARALLEL /* ======== Temporary data transfer properties ======== */ /* Definitions for memory MPI type property */ diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index b382fb4..0564d49 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -115,6 +115,7 @@ static const H5FD_class_mpi_t H5FD_mpio_g = { NULL, /*get_type_map */ NULL, /*alloc */ NULL, /*free */ + H5FD_mpio_term, /*terminate */ H5FD_mpio_get_eoa, /*get_eoa */ H5FD_mpio_set_eoa, /*set_eoa */ H5FD_mpio_get_eof, /*get_eof */ @@ -1163,8 +1164,10 @@ H5FD_mpio_query(const H5FD_t UNUSED *_file, unsigned long *flags /* out */) /* Set the VFL feature flags that this driver supports */ if(flags) { *flags=0; - *flags|=H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */ + *flags|=H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */ *flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ + *flags|=H5FD_FEAT_HAS_MPI; /* This driver uses MPI */ + *flags|=H5FD_FEAT_ALLOCATE_EARLY; /* Allocate space early instead of late */ } /* end if */ done: diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c index 7ca38cc..6328ef7 100644 --- a/src/H5FDmpiposix.c +++ b/src/H5FDmpiposix.c @@ -224,6 +224,7 @@ static const H5FD_class_mpi_t H5FD_mpiposix_g = { NULL, /*get_type_map */ NULL, /*alloc */ NULL, /*free */ + H5FD_mpiposix_term, /*terminate */ H5FD_mpiposix_get_eoa, /*get_eoa */ H5FD_mpiposix_set_eoa, /*set_eoa */ H5FD_mpiposix_get_eof, /*get_eof */ @@ -931,8 +932,10 @@ H5FD_mpiposix_query(const H5FD_t UNUSED *_file, unsigned long *flags /* out */) /* Set the VFL feature flags that this driver supports */ if(flags) { *flags=0; - *flags|=H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */ + *flags|=H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */ *flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ + *flags|=H5FD_FEAT_HAS_MPI; /* This driver uses MPI */ + *flags|=H5FD_FEAT_ALLOCATE_EARLY; /* Allocate space early instead of late */ } /* end if */ done: diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 328b530..354f05c 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -167,6 +167,7 @@ static const H5FD_class_t H5FD_multi_g = { H5FD_multi_get_type_map, /*get_type_map */ H5FD_multi_alloc, /*alloc */ H5FD_multi_free, /*free */ + H5FD_multi_term, /*terminate */ H5FD_multi_get_eoa, /*get_eoa */ H5FD_multi_set_eoa, /*set_eoa */ H5FD_multi_get_eof, /*get_eof */ diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index c8ec658..2a22958 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -25,6 +25,7 @@ #define H5_HAVE_VFL 1 /*define a convenient app feature test*/ #define H5FD_VFD_DEFAULT 0 /* Default VFL driver value */ +#define H5_HAVE_VFD_EXTENSIONS 1 /*Extensions to VFD to allow external VFD linking */ /* Types of allocation requests: see H5Fpublic.h */ typedef enum H5F_mem_t H5FD_mem_t; @@ -209,8 +210,19 @@ typedef enum H5F_mem_t H5FD_mem_t; * the handle for the VFD (returned with the 'get_handle' callback) is * of type 'int' and is compatible with POSIX I/O calls. */ -#define H5FD_FEAT_POSIX_COMPAT_HANDLE 0x00000080 - +#define H5FD_FEAT_POSIX_COMPAT_HANDLE 0x00000080 + /* + * Defining the H5FD_FEAT_HAS_MPI for a VFL driver means that + * the driver makes use of MPI communication and code may retrieve + * communicator/rank information from it + */ +#define H5FD_FEAT_HAS_MPI 0x00000100 + /* + * Defining the H5FD_FEAT_ALLOCATE_EARLY for a VFL driver means that + * the library will use the H5D_ALLOC_TIME_EARLY on dataset create + * instead of the default H5D_ALLOC_TIME_LATE + */ +#define H5FD_FEAT_ALLOCATE_EARLY 0x00000200 /* Forward declaration */ typedef struct H5FD_t H5FD_t; @@ -240,6 +252,9 @@ typedef struct H5FD_class_t { haddr_t (*alloc)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); herr_t (*free)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); +#ifdef H5_HAVE_VFD_EXTENSIONS + void (*terminate)(); +#endif haddr_t (*get_eoa)(const H5FD_t *file, H5FD_mem_t type); herr_t (*set_eoa)(H5FD_t *file, H5FD_mem_t type, haddr_t addr); haddr_t (*get_eof)(const H5FD_t *file); diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 1153df7..c37e052 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -163,6 +163,7 @@ static const H5FD_class_t H5FD_sec2_g = { NULL, /*get_type_map */ NULL, /*alloc */ NULL, /*free */ + H5FD_sec2_term, /*terminate */ H5FD_sec2_get_eoa, /*get_eoa */ H5FD_sec2_set_eoa, /*set_eoa */ H5FD_sec2_get_eof, /*get_eof */ diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 9bc4161..a11dfa8 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -208,6 +208,7 @@ static const H5FD_class_t H5FD_stdio_g = { NULL, /*get_type_map */ H5FD_stdio_alloc, /*alloc */ NULL, /*free */ + H5FD_stdio_term, /*terminate */ H5FD_stdio_get_eoa, /*get_eoa */ H5FD_stdio_set_eoa, /*set_eoa */ H5FD_stdio_get_eof, /*get_eof */ diff --git a/src/H5FDwindows.c b/src/H5FDwindows.c index 47c7f2d..864a958 100644 --- a/src/H5FDwindows.c +++ b/src/H5FDwindows.c @@ -166,6 +166,7 @@ static const H5FD_class_t H5FD_windows_g = { NULL, /*get_type_map */ NULL, /*alloc */ NULL, /*free */ + H5FD_windows_term, /*terminate */ H5FD_windows_get_eoa, /*get_eoa */ H5FD_windows_set_eoa, /*set_eoa */ H5FD_windows_get_eof, /*get_eof */ -- cgit v0.12 From 8a5e400fda99c06a930e7acdcbe6afad7f1f57dc Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 21 Apr 2011 08:55:52 -0500 Subject: [svn-r20588] Description: Clean up code a bit, move new "terminate" VFD callback to new position in H5FD_class_t struct. Tested on: Mac OS X/32 10.6.7 (amazon) w/debug & production (h5committest not required on this branch) --- src/H5AC.c | 2 +- src/H5C.c | 2 +- src/H5Dchunk.c | 2 +- src/H5Dcontig.c | 2 +- src/H5Dint.c | 6 +++--- src/H5Dio.c | 6 +++--- src/H5F.c | 15 +-------------- src/H5FD.c | 27 ++++++++++++++++++--------- src/H5FDcore.c | 11 +++++------ src/H5FDcore.h | 4 +--- src/H5FDdirect.c | 12 ++++++------ src/H5FDdirect.h | 4 +--- src/H5FDfamily.c | 23 +++++++++++------------ src/H5FDfamily.h | 4 +--- src/H5FDlog.c | 9 +++++---- src/H5FDlog.h | 3 --- src/H5FDmpio.c | 11 +++++------ src/H5FDmpio.h | 2 +- src/H5FDmpiposix.c | 13 ++++++------- src/H5FDmpiposix.h | 1 - src/H5FDmulti.c | 10 +++++----- src/H5FDmulti.h | 6 +----- src/H5FDpublic.h | 5 +---- src/H5FDsec2.c | 9 +++++---- src/H5FDsec2.h | 3 --- src/H5FDstdio.c | 10 +++++----- src/H5FDstdio.h | 1 - src/H5FDwindows.c | 18 ++++++++---------- src/H5FDwindows.h | 4 +--- src/hdf5.h | 2 +- 30 files changed, 98 insertions(+), 129 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index 011e40f..1c005a8 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -485,7 +485,7 @@ H5AC_create(const H5F_t *f, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad cache configuration") #ifdef H5_HAVE_PARALLEL - if ( H5F_HAS_FEATURE(f,H5FD_FEAT_HAS_MPI) ) { + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { MPI_Comm mpi_comm; int mpi_rank; int mpi_size; diff --git a/src/H5C.c b/src/H5C.c index 7a04005..5a4f5e9 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -8133,7 +8133,7 @@ H5C_flush_single_entry(H5F_t * f, */ if ( ( ! clear_only ) && ( entry_ptr->is_dirty ) && - ( H5F_HAS_FEATURE(f,H5FD_FEAT_HAS_MPI) ) ) { + (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) ) ) { H5P_genplist_t *dxpl; /* Dataset transfer property list */ H5FD_mpio_xfer_t xfer_mode; /* I/O xfer mode property value */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 1f09c97..643e1cb 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -3164,7 +3164,7 @@ H5D_chunk_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, #ifdef H5_HAVE_PARALLEL /* Retrieve MPI parameters */ - if(H5F_HAS_FEATURE(dset->oloc.file,H5FD_FEAT_HAS_MPI)) { + if(H5F_HAS_FEATURE(dset->oloc.file, H5FD_FEAT_HAS_MPI)) { /* Get the MPI communicator */ if(MPI_COMM_NULL == (mpi_comm = H5F_mpi_get_comm(dset->oloc.file))) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI communicator") diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index ffa275d..c578d27 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -225,7 +225,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id) #ifdef H5_HAVE_PARALLEL /* Retrieve MPI parameters */ - if(H5F_HAS_FEATURE(dset->oloc.file,H5FD_FEAT_HAS_MPI)) { + if(H5F_HAS_FEATURE(dset->oloc.file, H5FD_FEAT_HAS_MPI)) { /* Get the MPI communicator */ if(MPI_COMM_NULL == (mpi_comm = H5F_mpi_get_comm(dset->oloc.file))) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI communicator") diff --git a/src/H5Dint.c b/src/H5Dint.c index b0e8827..e51f001 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1003,7 +1003,7 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "compact dataset must have early space allocation") /* If MPI VFD is used, no filter support yet. */ - if(H5F_HAS_FEATURE(file,H5FD_FEAT_HAS_MPI) && pline->nused > 0) + if(H5F_HAS_FEATURE(file, H5FD_FEAT_HAS_MPI) && pline->nused > 0) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "Parallel I/O does not support filters yet") /* Get the dataset's external file list information */ @@ -1023,7 +1023,7 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, } /* end if */ /* Check if this dataset is going into a parallel file and set space allocation time */ - if(H5F_HAS_FEATURE(file,H5FD_FEAT_ALLOCATE_EARLY)) + if(H5F_HAS_FEATURE(file, H5FD_FEAT_ALLOCATE_EARLY)) new_dset->shared->dcpl_cache.fill.alloc_time = H5D_ALLOC_TIME_EARLY; /* Set the dataset's I/O operations */ @@ -1305,7 +1305,7 @@ H5D_open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id) */ if((H5F_INTENT(dataset->oloc.file) & H5F_ACC_RDWR) && !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage) - && H5F_HAS_FEATURE(dataset->oloc.file,H5FD_FEAT_ALLOCATE_EARLY)) { + && H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_ALLOCATE_EARLY)) { if(H5D_alloc_storage(dataset, dxpl_id, H5D_ALLOC_OPEN, FALSE, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file storage") } /* end if */ diff --git a/src/H5Dio.c b/src/H5Dio.c index 028f1b0..7ee304c 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -340,7 +340,7 @@ H5D_read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, #ifdef H5_HAVE_PARALLEL /* Collective access is not permissible without a MPI based VFD */ if(dxpl_cache->xfer_mode == H5FD_MPIO_COLLECTIVE && - !(H5F_HAS_FEATURE(dataset->oloc.file,H5FD_FEAT_HAS_MPI))) + !(H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_HAS_MPI))) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based drivers only") #endif /*H5_HAVE_PARALLEL*/ @@ -544,7 +544,7 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, /* Various MPI based checks */ #ifdef H5_HAVE_PARALLEL - if H5F_HAS_FEATURE(dataset->oloc.file,H5FD_FEAT_HAS_MPI) { + if H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_HAS_MPI) { /* If MPI based VFD is used, no VL datatype support yet. */ /* This is because they use the global heap in the file and we don't */ /* support parallel access of that yet */ @@ -769,7 +769,7 @@ H5D_ioinfo_init(H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, #ifdef H5_HAVE_PARALLEL /* Determine if the file was opened with an MPI VFD */ - io_info->using_mpi_vfd = H5F_HAS_FEATURE(dset->oloc.file,H5FD_FEAT_HAS_MPI); + io_info->using_mpi_vfd = H5F_HAS_FEATURE(dset->oloc.file, H5FD_FEAT_HAS_MPI); #endif /* H5_HAVE_PARALLEL */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5F.c b/src/H5F.c index dac276c..f9941e7 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -35,19 +35,6 @@ #include "H5SMprivate.h" /* Shared Object Header Messages */ #include "H5Tprivate.h" /* Datatypes */ -/* Predefined file drivers */ -#include "H5FDcore.h" /*temporary in-memory files */ -#include "H5FDfamily.h" /*family of files */ -#include "H5FDlog.h" /* sec2 driver with logging, for debugging */ -#include "H5FDmpi.h" /* MPI-based file drivers */ -#include "H5FDmulti.h" /*multiple files partitioned by mem usage */ -#include "H5FDsec2.h" /*Posix unbuffered I/O */ -#include "H5FDstdio.h" /* Standard C buffered I/O */ -#ifdef H5_HAVE_WINDOWS -#include "H5FDwindows.h" /* Windows buffered I/O */ -#endif -#include "H5FDdirect.h" /*Linux direct I/O */ - /* Struct only used by functions H5F_get_objects and H5F_get_objects_cb */ typedef struct H5F_olist_t { H5I_type_t obj_type; /* Type of object to look for */ @@ -934,7 +921,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) * merged into the trunk and journaling is enabled, at least until * we make it work. - QAK) */ - f->shared->use_tmp_space = !H5F_HAS_FEATURE(f,H5FD_FEAT_HAS_MPI); + f->shared->use_tmp_space = !H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI); /* * Create a metadata cache with the specified number of elements. diff --git a/src/H5FD.c b/src/H5FD.c index 000d267..6c2a024 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -97,7 +97,7 @@ static herr_t H5FD_free_cls(H5FD_class_t *cls); * object and the file is closed and re-opened, the 'fileno' value will * be different. */ -static unsigned long file_serial_no; +static unsigned long H5FD_file_serial_no_g; /*------------------------------------------------------------------------- @@ -153,7 +153,7 @@ H5FD_init_interface(void) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface") /* Reset the file serial numbers */ - file_serial_no = 0; + H5FD_file_serial_no_g = 0; done: FUNC_LEAVE_NOAPI(ret_value) @@ -221,15 +221,24 @@ H5FD_term_interface(void) static herr_t H5FD_free_cls(H5FD_class_t *cls) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_free_cls) + herr_t ret_value = SUCCEED; - // Give the File driver a chance to free singletons or other objects - // which will become invalid once the class structure is freed - if (cls && cls->terminate) cls->terminate(); + FUNC_ENTER_NOAPI_NOINIT(H5FD_free_cls) + + /* Sanity check */ + HDassert(cls); + + /* If the file driver has a terminate callback, call it to give the file + * driver a chance to free singletons or other resources which will become + * invalid once the class structure is freed. + */ + if(cls->terminate && cls->terminate() < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEOBJ, FAIL, "virtual file driver '%s' did not terminate cleanly", cls->name) H5MM_xfree(cls); - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_free_cls() */ @@ -1077,11 +1086,11 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to query file driver") /* Increment the global serial number & assign it to this H5FD_t object */ - if(++file_serial_no == 0) { + if(++H5FD_file_serial_no_g == 0) { /* (Just error out if we wrap around for now...) */ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to get file serial number") } /* end if */ - file->fileno = file_serial_no; + file->fileno = H5FD_file_serial_no_g; /* Start with base address set to 0 */ /* (This will be changed later, when the superblock is located) */ diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 68a1e93..9147f84 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -111,6 +111,7 @@ typedef struct H5FD_core_fapl_t { (size_t)((A)+(Z))<(size_t)(A)) /* Prototypes */ +static herr_t H5FD_core_term(void); static void *H5FD_core_fapl_get(H5FD_t *_file); static H5FD_t *H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); @@ -132,6 +133,7 @@ static const H5FD_class_t H5FD_core_g = { "core", /*name */ MAXADDR, /*maxaddr */ H5F_CLOSE_WEAK, /*fc_degree */ + H5FD_core_term, /*terminate */ NULL, /*sb_size */ NULL, /*sb_encode */ NULL, /*sb_decode */ @@ -149,7 +151,6 @@ static const H5FD_class_t H5FD_core_g = { NULL, /*get_type_map */ NULL, /*alloc */ NULL, /*free */ - H5FD_core_term, /*terminate */ H5FD_core_get_eoa, /*get_eoa */ H5FD_core_set_eoa, /*set_eoa */ H5FD_core_get_eof, /*get_eof */ @@ -226,16 +227,14 @@ done: * * Purpose: Shut down the VFD * - * Return: + * Returns: Non-negative on success or negative on failure * * Programmer: Quincey Koziol * Friday, Jan 30, 2004 * - * Modification: - * *--------------------------------------------------------------------------- */ -void +static herr_t H5FD_core_term(void) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_core_term) @@ -243,7 +242,7 @@ H5FD_core_term(void) /* Reset VFL ID */ H5FD_CORE_g=0; - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_core_term() */ diff --git a/src/H5FDcore.h b/src/H5FDcore.h index dca110e..6e071e0 100644 --- a/src/H5FDcore.h +++ b/src/H5FDcore.h @@ -22,15 +22,12 @@ #ifndef H5FDcore_H #define H5FDcore_H -#include "H5Ipublic.h" - #define H5FD_CORE (H5FD_core_init()) #ifdef __cplusplus extern "C" { #endif H5_DLL hid_t H5FD_core_init(void); -H5_DLL void H5FD_core_term(void); H5_DLL herr_t H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store); H5_DLL herr_t H5Pget_fapl_core(hid_t fapl_id, size_t *increment/*out*/, @@ -40,3 +37,4 @@ H5_DLL herr_t H5Pget_fapl_core(hid_t fapl_id, size_t *increment/*out*/, #endif #endif + diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 29fd84f..8ff0653 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -155,6 +155,7 @@ typedef struct H5FD_direct_t { (file_offset_t)((A)+(Z))<(file_offset_t)(A)) /* Prototypes */ +static herr_t H5FD_direct_term(void); static void *H5FD_direct_fapl_get(H5FD_t *file); static void *H5FD_direct_fapl_copy(const void *_old_fa); static H5FD_t *H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, @@ -176,6 +177,7 @@ static const H5FD_class_t H5FD_direct_g = { "direct", /*name */ MAXADDR, /*maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ + H5FD_direct_term, /*terminate */ NULL, /*sb_size */ NULL, /*sb_encode */ NULL, /*sb_decode */ @@ -272,16 +274,14 @@ done: * * Purpose: Shut down the VFD * - * Return: + * Returns: Non-negative on success or negative on failure * * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modification: - * *--------------------------------------------------------------------------- */ -void +static herr_t H5FD_direct_term(void) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_direct_term) @@ -289,7 +289,7 @@ H5FD_direct_term(void) /* Reset VFL ID */ H5FD_DIRECT_g=0; - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_direct_term() */ @@ -677,7 +677,7 @@ H5FD_direct_cmp(const H5FD_t *_f1, const H5FD_t *_f2) const H5FD_direct_t *f2 = (const H5FD_direct_t*)_f2; int ret_value=0; - FUNC_ENTER_NOAPI(H5FD_direct_cmp, H5FD_VFD_DEFAULT) + FUNC_ENTER_NOAPI_NOFUNC_NONIT(H5FD_direct_cmp) #ifdef _WIN32 if (f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) diff --git a/src/H5FDdirect.h b/src/H5FDdirect.h index 26c70f3..5ceb91f 100644 --- a/src/H5FDdirect.h +++ b/src/H5FDdirect.h @@ -22,8 +22,6 @@ #ifndef H5FDdirect_H #define H5FDdirect_H -#include "H5Ipublic.h" - #ifdef H5_HAVE_DIRECT # define H5FD_DIRECT (H5FD_direct_init()) #else @@ -42,7 +40,6 @@ extern "C" { #define CBSIZE_DEF 16*1024*1024 H5_DLL hid_t H5FD_direct_init(void); -H5_DLL void H5FD_direct_term(void); H5_DLL herr_t H5Pset_fapl_direct(hid_t fapl_id, size_t alignment, size_t block_size, size_t cbuf_size); H5_DLL herr_t H5Pget_fapl_direct(hid_t fapl_id, size_t *boundary/*out*/, @@ -55,3 +52,4 @@ H5_DLL herr_t H5Pget_fapl_direct(hid_t fapl_id, size_t *boundary/*out*/, #endif /* H5_HAVE_DIRECT */ #endif + diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 89cb53f..1d8d7c1 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -88,6 +88,7 @@ typedef struct H5FD_family_dxpl_t { } H5FD_family_dxpl_t; /* Callback prototypes */ +static herr_t H5FD_family_term(void); static void *H5FD_family_fapl_get(H5FD_t *_file); static void *H5FD_family_fapl_copy(const void *_old_fa); static herr_t H5FD_family_fapl_free(void *_fa); @@ -119,6 +120,7 @@ static const H5FD_class_t H5FD_family_g = { "family", /*name */ HADDR_MAX, /*maxaddr */ H5F_CLOSE_WEAK, /*fc_degree */ + H5FD_family_term, /*terminate */ H5FD_family_sb_size, /*sb_size */ H5FD_family_sb_encode, /*sb_encode */ H5FD_family_sb_decode, /*sb_decode */ @@ -136,7 +138,6 @@ static const H5FD_class_t H5FD_family_g = { NULL, /*get_type_map */ NULL, /*alloc */ NULL, /*free */ - H5FD_family_term, /*terminate */ H5FD_family_get_eoa, /*get_eoa */ H5FD_family_set_eoa, /*set_eoa */ H5FD_family_get_eof, /*get_eof */ @@ -213,16 +214,14 @@ done: * * Purpose: Shut down the VFD * - * Return: + * Returns: Non-negative on success or negative on failure * * Programmer: Quincey Koziol * Friday, Jan 30, 2004 * - * Modification: - * *--------------------------------------------------------------------------- */ -void +static herr_t H5FD_family_term(void) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_family_term) @@ -230,7 +229,7 @@ H5FD_family_term(void) /* Reset VFL ID */ H5FD_FAMILY_g=0; - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_family_term() */ @@ -958,18 +957,18 @@ H5FD_family_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { const H5FD_family_t *f1 = (const H5FD_family_t*)_f1; const H5FD_family_t *f2 = (const H5FD_family_t*)_f2; - int ret_value=(H5FD_VFD_DEFAULT); + int ret_value = 0; - FUNC_ENTER_NOAPI(H5FD_family_cmp, H5FD_VFD_DEFAULT) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_family_cmp) - assert(f1->nmembs>=1 && f1->memb[0]); - assert(f2->nmembs>=1 && f2->memb[0]); + HDassert(f1->nmembs >= 1 && f1->memb[0]); + HDassert(f2->nmembs >= 1 && f2->memb[0]); - ret_value= H5FDcmp(f1->memb[0], f2->memb[0]); + ret_value = H5FDcmp(f1->memb[0], f2->memb[0]); done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_family_cmp() */ /*------------------------------------------------------------------------- diff --git a/src/H5FDfamily.h b/src/H5FDfamily.h index dcb63e6..80969c3 100644 --- a/src/H5FDfamily.h +++ b/src/H5FDfamily.h @@ -22,8 +22,6 @@ #ifndef H5FDfamily_H #define H5FDfamily_H -#include "H5Ipublic.h" - #define H5FD_FAMILY (H5FD_family_init()) #ifdef __cplusplus @@ -31,7 +29,6 @@ extern "C" { #endif H5_DLL hid_t H5FD_family_init(void); -H5_DLL void H5FD_family_term(void); H5_DLL herr_t H5Pset_fapl_family(hid_t fapl_id, hsize_t memb_size, hid_t memb_fapl_id); H5_DLL herr_t H5Pget_fapl_family(hid_t fapl_id, hsize_t *memb_size/*out*/, @@ -42,3 +39,4 @@ H5_DLL herr_t H5Pget_fapl_family(hid_t fapl_id, hsize_t *memb_size/*out*/, #endif #endif + diff --git a/src/H5FDlog.c b/src/H5FDlog.c index a2e8546..812bc04 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -161,6 +161,7 @@ typedef struct H5FD_log_t { (HDoff_t)((A)+(Z))<(HDoff_t)(A)) /* Prototypes */ +static herr_t H5FD_log_term(void); static void *H5FD_log_fapl_get(H5FD_t *file); static void *H5FD_log_fapl_copy(const void *_old_fa); static herr_t H5FD_log_fapl_free(void *_fa); @@ -184,6 +185,7 @@ static const H5FD_class_t H5FD_log_g = { "log", /*name */ MAXADDR, /*maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ + H5FD_log_term, /*terminate */ NULL, /*sb_size */ NULL, /*sb_encode */ NULL, /*sb_decode */ @@ -201,7 +203,6 @@ static const H5FD_class_t H5FD_log_g = { NULL, /*get_type_map */ H5FD_log_alloc, /*alloc */ NULL, /*free */ - H5FD_log_term, /*terminate */ H5FD_log_get_eoa, /*get_eoa */ H5FD_log_set_eoa, /*set_eoa */ H5FD_log_get_eof, /*get_eof */ @@ -278,14 +279,14 @@ done: * * Purpose: Shut down the VFD * - * Return: + * Returns: Non-negative on success or negative on failure * * Programmer: Quincey Koziol * Friday, Jan 30, 2004 * *--------------------------------------------------------------------------- */ -void +static herr_t H5FD_log_term(void) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_log_term) @@ -293,7 +294,7 @@ H5FD_log_term(void) /* Reset VFL ID */ H5FD_LOG_g = 0; - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_log_term() */ diff --git a/src/H5FDlog.h b/src/H5FDlog.h index ffc4df1..2f1544e 100644 --- a/src/H5FDlog.h +++ b/src/H5FDlog.h @@ -22,8 +22,6 @@ #ifndef H5FDlog_H #define H5FDlog_H -#include "H5Ipublic.h" - #define H5FD_LOG (H5FD_log_init()) /* Flags for H5Pset_fapl_log() */ @@ -61,7 +59,6 @@ extern "C" { #endif H5_DLL hid_t H5FD_log_init(void); -H5_DLL void H5FD_log_term(void); H5_DLL herr_t H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, size_t buf_size); #ifdef __cplusplus diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 0564d49..480334b 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -65,6 +65,7 @@ typedef struct H5FD_mpio_t { /* Private Prototypes */ /* Callbacks */ +static herr_t H5FD_mpio_term(void); static void *H5FD_mpio_fapl_get(H5FD_t *_file); static void *H5FD_mpio_fapl_copy(const void *_old_fa); static herr_t H5FD_mpio_fapl_free(void *_fa); @@ -98,6 +99,7 @@ static const H5FD_class_mpi_t H5FD_mpio_g = { "mpio", /*name */ HADDR_MAX, /*maxaddr */ H5F_CLOSE_SEMI, /* fc_degree */ + H5FD_mpio_term, /*terminate */ NULL, /*sb_size */ NULL, /*sb_encode */ NULL, /*sb_decode */ @@ -115,7 +117,6 @@ static const H5FD_class_mpi_t H5FD_mpio_g = { NULL, /*get_type_map */ NULL, /*alloc */ NULL, /*free */ - H5FD_mpio_term, /*terminate */ H5FD_mpio_get_eoa, /*get_eoa */ H5FD_mpio_set_eoa, /*set_eoa */ H5FD_mpio_get_eof, /*get_eof */ @@ -235,16 +236,14 @@ done: * * Purpose: Shut down the VFD * - * Return: + * Returns: Non-negative on success or negative on failure * * Programmer: Quincey Koziol * Friday, Jan 30, 2004 * - * Modification: - * *--------------------------------------------------------------------------- */ -void +static herr_t H5FD_mpio_term(void) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_mpio_term) @@ -252,7 +251,7 @@ H5FD_mpio_term(void) /* Reset VFL ID */ H5FD_MPIO_g=0; - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_mpio_term() */ diff --git a/src/H5FDmpio.h b/src/H5FDmpio.h index 41baf8d..fe2d11f 100644 --- a/src/H5FDmpio.h +++ b/src/H5FDmpio.h @@ -46,7 +46,6 @@ extern "C" { #endif H5_DLL hid_t H5FD_mpio_init(void); -H5_DLL void H5FD_mpio_term(void); H5_DLL herr_t H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info); H5_DLL herr_t H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/); @@ -63,3 +62,4 @@ H5_DLL herr_t H5Pset_dxpl_mpio_chunk_opt_ratio(hid_t dxpl_id, unsigned percent_n #endif /* H5_HAVE_PARALLEL */ #endif + diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c index 6328ef7..3c40bd0 100644 --- a/src/H5FDmpiposix.c +++ b/src/H5FDmpiposix.c @@ -174,6 +174,7 @@ typedef struct H5FD_mpiposix_t { (file_offset_t)((A)+(Z))<(file_offset_t)(A)) /* Callbacks */ +static herr_t H5FD_mpiposix_term(void); static void *H5FD_mpiposix_fapl_get(H5FD_t *_file); static void *H5FD_mpiposix_fapl_copy(const void *_old_fa); static herr_t H5FD_mpiposix_fapl_free(void *_fa); @@ -207,6 +208,7 @@ static const H5FD_class_mpi_t H5FD_mpiposix_g = { "mpiposix", /*name */ MAXADDR, /*maxaddr */ H5F_CLOSE_SEMI, /* fc_degree */ + H5FD_mpiposix_term, /*terminate */ NULL, /*sb_size */ NULL, /*sb_encode */ NULL, /*sb_decode */ @@ -224,7 +226,6 @@ static const H5FD_class_mpi_t H5FD_mpiposix_g = { NULL, /*get_type_map */ NULL, /*alloc */ NULL, /*free */ - H5FD_mpiposix_term, /*terminate */ H5FD_mpiposix_get_eoa, /*get_eoa */ H5FD_mpiposix_set_eoa, /*set_eoa */ H5FD_mpiposix_get_eof, /*get_eof */ @@ -305,16 +306,14 @@ done: * * Purpose: Shut down the VFD * - * Return: + * Returns: Non-negative on success or negative on failure * * Programmer: Quincey Koziol * Friday, Jan 30, 2004 * - * Modification: - * *--------------------------------------------------------------------------- */ -void +static herr_t H5FD_mpiposix_term(void) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_mpiposix_term) @@ -322,7 +321,7 @@ H5FD_mpiposix_term(void) /* Reset VFL ID */ H5FD_MPIPOSIX_g=0; - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_mpiposix_term() */ @@ -869,7 +868,7 @@ H5FD_mpiposix_cmp(const H5FD_t *_f1, const H5FD_t *_f2) const H5FD_mpiposix_t *f2 = (const H5FD_mpiposix_t*)_f2; int ret_value=0; - FUNC_ENTER_NOAPI(H5FD_mpiposix_cmp, H5FD_VFD_DEFAULT) + FUNC_ENTER_NOAPI_NOFUNC_NOINIT(H5FD_mpiposix_cmp) #ifdef _WIN32 if (f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) diff --git a/src/H5FDmpiposix.h b/src/H5FDmpiposix.h index 832839e..af13fad 100644 --- a/src/H5FDmpiposix.h +++ b/src/H5FDmpiposix.h @@ -42,7 +42,6 @@ extern "C" { #endif H5_DLL hid_t H5FD_mpiposix_init(void); -H5_DLL void H5FD_mpiposix_term(void); H5_DLL herr_t H5Pset_fapl_mpiposix(hid_t fapl_id, MPI_Comm comm, hbool_t use_gpfs); H5_DLL herr_t H5Pget_fapl_mpiposix(hid_t fapl_id, MPI_Comm *comm/*out*/, hbool_t *use_gpfs/*out*/); diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 354f05c..9c30104 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -115,6 +115,7 @@ static int compute_next(H5FD_multi_t *file); static int open_members(H5FD_multi_t *file); /* Callback prototypes */ +static herr_t H5FD_multi_term(void); static hsize_t H5FD_multi_sb_size(H5FD_t *file); static herr_t H5FD_multi_sb_encode(H5FD_t *file, char *name/*out*/, unsigned char *buf/*out*/); @@ -150,6 +151,7 @@ static const H5FD_class_t H5FD_multi_g = { "multi", /*name */ HADDR_MAX, /*maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ + H5FD_multi_term, /*terminate */ H5FD_multi_sb_size, /*sb_size */ H5FD_multi_sb_encode, /*sb_encode */ H5FD_multi_sb_decode, /*sb_decode */ @@ -167,7 +169,6 @@ static const H5FD_class_t H5FD_multi_g = { H5FD_multi_get_type_map, /*get_type_map */ H5FD_multi_alloc, /*alloc */ H5FD_multi_free, /*free */ - H5FD_multi_term, /*terminate */ H5FD_multi_get_eoa, /*get_eoa */ H5FD_multi_set_eoa, /*set_eoa */ H5FD_multi_get_eof, /*get_eof */ @@ -248,21 +249,20 @@ H5FD_multi_init(void) * * Purpose: Shut down the VFD * - * Return: + * Returns: Non-negative on success or negative on failure * * Programmer: Quincey Koziol * Friday, Jan 30, 2004 * - * Modification: - * *--------------------------------------------------------------------------- */ -void +static herr_t H5FD_multi_term(void) { /* Reset VFL ID */ H5FD_MULTI_g=0; + return 0; } /* end H5FD_multi_term() */ diff --git a/src/H5FDmulti.h b/src/H5FDmulti.h index c7e54ce..da16b0c 100644 --- a/src/H5FDmulti.h +++ b/src/H5FDmulti.h @@ -22,17 +22,12 @@ #ifndef H5FDmulti_H #define H5FDmulti_H -#include "H5Ipublic.h" -#include "H5Ppublic.h" /* Property lists */ -#include "H5Fpublic.h" - #define H5FD_MULTI (H5FD_multi_init()) #ifdef __cplusplus extern "C" { #endif H5_DLL hid_t H5FD_multi_init(void); -H5_DLL void H5FD_multi_term(void); H5_DLL herr_t H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, const hid_t *memb_fapl, const char * const *memb_name, const haddr_t *memb_addr, hbool_t relax); @@ -50,3 +45,4 @@ H5_DLL herr_t H5Pset_fapl_split(hid_t fapl, const char *meta_ext, #endif #endif + diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index 2a22958..f495e2d 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -25,7 +25,6 @@ #define H5_HAVE_VFL 1 /*define a convenient app feature test*/ #define H5FD_VFD_DEFAULT 0 /* Default VFL driver value */ -#define H5_HAVE_VFD_EXTENSIONS 1 /*Extensions to VFD to allow external VFD linking */ /* Types of allocation requests: see H5Fpublic.h */ typedef enum H5F_mem_t H5FD_mem_t; @@ -232,6 +231,7 @@ typedef struct H5FD_class_t { const char *name; haddr_t maxaddr; H5F_close_degree_t fc_degree; + herr_t (*terminate)(void); hsize_t (*sb_size)(H5FD_t *file); herr_t (*sb_encode)(H5FD_t *file, char *name/*out*/, unsigned char *p/*out*/); @@ -252,9 +252,6 @@ typedef struct H5FD_class_t { haddr_t (*alloc)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); herr_t (*free)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); -#ifdef H5_HAVE_VFD_EXTENSIONS - void (*terminate)(); -#endif haddr_t (*get_eoa)(const H5FD_t *file, H5FD_mem_t type); herr_t (*set_eoa)(H5FD_t *file, H5FD_mem_t type, haddr_t addr); haddr_t (*get_eof)(const H5FD_t *file); diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index c37e052..bb5dc15 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -127,6 +127,7 @@ typedef struct H5FD_sec2_t { (HDoff_t)((A)+(Z))<(HDoff_t)(A)) /* Prototypes */ +static herr_t H5FD_sec2_term(void); static H5FD_t *H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); static herr_t H5FD_sec2_close(H5FD_t *_file); @@ -146,6 +147,7 @@ static const H5FD_class_t H5FD_sec2_g = { "sec2", /*name */ MAXADDR, /*maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ + H5FD_sec2_term, /*terminate */ NULL, /*sb_size */ NULL, /*sb_encode */ NULL, /*sb_decode */ @@ -163,7 +165,6 @@ static const H5FD_class_t H5FD_sec2_g = { NULL, /*get_type_map */ NULL, /*alloc */ NULL, /*free */ - H5FD_sec2_term, /*terminate */ H5FD_sec2_get_eoa, /*get_eoa */ H5FD_sec2_set_eoa, /*set_eoa */ H5FD_sec2_get_eof, /*get_eof */ @@ -240,14 +241,14 @@ done: * * Purpose: Shut down the VFD * - * Return: + * Returns: Non-negative on success or negative on failure * * Programmer: Quincey Koziol * Friday, Jan 30, 2004 * *--------------------------------------------------------------------------- */ -void +static herr_t H5FD_sec2_term(void) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_sec2_term) @@ -255,7 +256,7 @@ H5FD_sec2_term(void) /* Reset VFL ID */ H5FD_SEC2_g = 0; - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_sec2_term() */ diff --git a/src/H5FDsec2.h b/src/H5FDsec2.h index b7db0d5..0c62597 100644 --- a/src/H5FDsec2.h +++ b/src/H5FDsec2.h @@ -22,8 +22,6 @@ #ifndef H5FDsec2_H #define H5FDsec2_H -#include "H5Ipublic.h" - #define H5FD_SEC2 (H5FD_sec2_init()) #ifdef __cplusplus @@ -31,7 +29,6 @@ extern "C" { #endif H5_DLL hid_t H5FD_sec2_init(void); -H5_DLL void H5FD_sec2_term(void); H5_DLL herr_t H5Pset_fapl_sec2(hid_t fapl_id); #ifdef __cplusplus diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index a11dfa8..4c53769 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -170,6 +170,7 @@ typedef struct H5FD_stdio_t { HADDR_UNDEF==(A)+(Z) || (file_offset_t)((A)+(Z))<(file_offset_t)(A)) /* Prototypes */ +static herr_t H5FD_stdio_term(void); static H5FD_t *H5FD_stdio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); static herr_t H5FD_stdio_close(H5FD_t *lf); @@ -191,6 +192,7 @@ static const H5FD_class_t H5FD_stdio_g = { "stdio", /*name */ MAXADDR, /*maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ + H5FD_stdio_term, /*terminate */ NULL, /*sb_size */ NULL, /*sb_encode */ NULL, /*sb_decode */ @@ -208,7 +210,6 @@ static const H5FD_class_t H5FD_stdio_g = { NULL, /*get_type_map */ H5FD_stdio_alloc, /*alloc */ NULL, /*free */ - H5FD_stdio_term, /*terminate */ H5FD_stdio_get_eoa, /*get_eoa */ H5FD_stdio_set_eoa, /*set_eoa */ H5FD_stdio_get_eof, /*get_eof */ @@ -258,21 +259,20 @@ H5FD_stdio_init(void) * * Purpose: Shut down the VFD * - * Return: + * Returns: Non-negative on success or negative on failure * * Programmer: Quincey Koziol * Friday, Jan 30, 2004 * - * Modification: - * *--------------------------------------------------------------------------- */ -void +static herr_t H5FD_stdio_term(void) { /* Reset VFL ID */ H5FD_STDIO_g=0; + return 0; } /* end H5FD_stdio_term() */ diff --git a/src/H5FDstdio.h b/src/H5FDstdio.h index 80443d8..8281705 100644 --- a/src/H5FDstdio.h +++ b/src/H5FDstdio.h @@ -31,7 +31,6 @@ extern "C" { #endif H5_DLL hid_t H5FD_stdio_init(void); -H5_DLL void H5FD_stdio_term(void); H5_DLL herr_t H5Pset_fapl_stdio(hid_t fapl_id); #ifdef __cplusplus diff --git a/src/H5FDwindows.c b/src/H5FDwindows.c index 864a958..de3fe33 100644 --- a/src/H5FDwindows.c +++ b/src/H5FDwindows.c @@ -127,6 +127,7 @@ typedef struct H5FD_windows_t { (fseek_offset_t)((A)+(Z))<(fseek_offset_t)(A)) /* Prototypes */ +static herr_t H5FD_windows_term(void); static H5FD_t *H5FD_windows_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); static herr_t H5FD_windows_close(H5FD_t *_file); @@ -149,6 +150,7 @@ static const H5FD_class_t H5FD_windows_g = { "windows", /*name */ MAXADDR, /*maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ + H5FD_windows_term, /*terminate */ NULL, /*sb_size */ NULL, /*sb_encode */ NULL, /*sb_decode */ @@ -166,7 +168,6 @@ static const H5FD_class_t H5FD_windows_g = { NULL, /*get_type_map */ NULL, /*alloc */ NULL, /*free */ - H5FD_windows_term, /*terminate */ H5FD_windows_get_eoa, /*get_eoa */ H5FD_windows_set_eoa, /*set_eoa */ H5FD_windows_get_eof, /*get_eof */ @@ -241,17 +242,14 @@ done: * * Purpose: Shut down the VFD * - * Return: + * Returns: Non-negative on success or negative on failure * * Programmer: Scott Wegner - * Based on code by Quincey Koziol * Thursday, May 24 2007 * - * Modification: - * *--------------------------------------------------------------------------- */ -void +static herr_t H5FD_windows_term(void) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_windows_term) @@ -259,7 +257,7 @@ H5FD_windows_term(void) /* Reset VFL ID */ H5FD_WINDOWS_g=0; - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_windows_term() */ /*------------------------------------------------------------------------- @@ -513,10 +511,10 @@ H5FD_windows_cmp(const H5FD_t *_f1, const H5FD_t *_f2) const H5FD_windows_t *f2 = (const H5FD_windows_t*)_f2; int ret_value=0; - FUNC_ENTER_NOAPI(H5FD_windows_cmp, H5FD_VFD_DEFAULT) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_windows_cmp) - if (f1->volumeserialnumber < f2->volumeserialnumber) HGOTO_DONE(-1) - if (f1->volumeserialnumber > f2->volumeserialnumber) HGOTO_DONE(1) + if (f1->volumeserialnumber < f2->volumeserialnumber) HGOTO_DONE(-1) + if (f1->volumeserialnumber > f2->volumeserialnumber) HGOTO_DONE(1) if (f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) if (f1->fileindexhi > f2->fileindexhi) HGOTO_DONE(1) diff --git a/src/H5FDwindows.h b/src/H5FDwindows.h index 8277f149..16d501e 100644 --- a/src/H5FDwindows.h +++ b/src/H5FDwindows.h @@ -23,8 +23,6 @@ #ifndef H5FDwindows_H #define H5FDwindows_H -#include "H5Ipublic.h" - #define H5FD_WINDOWS (H5FD_windows_init()) #ifdef __cplusplus @@ -32,7 +30,6 @@ extern "C" { #endif H5_DLL hid_t H5FD_windows_init(void); -H5_DLL void H5FD_windows_term(void); H5_DLL herr_t H5Pset_fapl_windows(hid_t fapl_id); #ifdef __cplusplus @@ -40,3 +37,4 @@ H5_DLL herr_t H5Pset_fapl_windows(hid_t fapl_id); #endif #endif + diff --git a/src/hdf5.h b/src/hdf5.h index ef15063..a37329d 100644 --- a/src/hdf5.h +++ b/src/hdf5.h @@ -41,6 +41,7 @@ /* Predefined file drivers */ #include "H5FDcore.h" /* Files stored entirely in memory */ +#include "H5FDdirect.h" /* Linux direct I/O */ #include "H5FDfamily.h" /* File families */ #include "H5FDlog.h" /* sec2 driver with I/O logging (for debugging) */ #include "H5FDmpi.h" /* MPI-based file drivers */ @@ -50,6 +51,5 @@ #ifdef H5_HAVE_WINDOWS #include "H5FDwindows.h" /* Windows buffered I/O */ #endif -#include "H5FDdirect.h" /* Linux direct I/O */ #endif -- cgit v0.12 From af1d83e5cf4dddbf7c6b1147eceec0c2cd94802b Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 26 Apr 2011 15:26:44 -0500 Subject: [svn-r20648] Description: Correct spelling error in macro. (FUNC_ENTER_NOAPI_NOFUNC_NOINIT -> FUNC_ENTER_NOAPI_NOINIT_NOFUNC) Tested on: Eyeballed only. (h5committest not required for this branch) --- src/H5FDmpiposix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c index 3c40bd0..bcedaed 100644 --- a/src/H5FDmpiposix.c +++ b/src/H5FDmpiposix.c @@ -868,7 +868,7 @@ H5FD_mpiposix_cmp(const H5FD_t *_f1, const H5FD_t *_f2) const H5FD_mpiposix_t *f2 = (const H5FD_mpiposix_t*)_f2; int ret_value=0; - FUNC_ENTER_NOAPI_NOFUNC_NOINIT(H5FD_mpiposix_cmp) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_mpiposix_cmp) #ifdef _WIN32 if (f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) -- cgit v0.12 From 0ef7cabc633e303f61305362e07b86375aa0753f Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 26 Apr 2011 16:18:03 -0500 Subject: [svn-r20650] Description: Fix spelling error: FUNC_ENTER_NOAPI_NOFUNC_NONIT -> FUNC_ENTER_NOAPI_NOINIT_NOFUNC Tested on: FreeBSD/32 8.2 (loyalty) FreeBSD/64 8.2 (loyalty) --- src/H5FDdirect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 8ff0653..469fe9d 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -677,7 +677,7 @@ H5FD_direct_cmp(const H5FD_t *_f1, const H5FD_t *_f2) const H5FD_direct_t *f2 = (const H5FD_direct_t*)_f2; int ret_value=0; - FUNC_ENTER_NOAPI_NOFUNC_NONIT(H5FD_direct_cmp) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_direct_cmp) #ifdef _WIN32 if (f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) -- cgit v0.12