diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-08-23 15:55:06 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-08-23 15:55:06 (GMT) |
commit | 2eee483e9badddec9f182e7be848ce4b343b05da (patch) | |
tree | 2edffc77106e39eaf5d5aba9815a10c0f56e8869 | |
parent | 57993b61d374ae5cb9a956d9ee28bb7cdc7064ea (diff) | |
download | hdf5-2eee483e9badddec9f182e7be848ce4b343b05da.zip hdf5-2eee483e9badddec9f182e7be848ce4b343b05da.tar.gz hdf5-2eee483e9badddec9f182e7be848ce4b343b05da.tar.bz2 |
[svn-r7393] Purpose:
Code cleanup
Description:
De-linted more code
Platforms tested:
FreeBSD 4.8 (sleipnir) w/parallel
too minor to require h5committest
-rw-r--r-- | src/H5FDmpio.c | 308 | ||||
-rw-r--r-- | src/H5FDmpiposix.c | 208 | ||||
-rw-r--r-- | src/H5FDmulti.c | 181 | ||||
-rw-r--r-- | src/H5FDmulti.h | 2 | ||||
-rw-r--r-- | src/H5G.c | 2 | ||||
-rw-r--r-- | src/H5Smpio.c | 3 | ||||
-rwxr-xr-x | src/hdf5.lnt | 11 |
7 files changed, 365 insertions, 350 deletions
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 7a32a2b..503641a 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -26,16 +26,21 @@ * bytes read is always equal to the number requested. This * kluge is activated by #ifdef MPI_KLUGE0202. */ -#include "H5private.h" /*library functions */ -#include "H5ACprivate.h" /* Metadata cache */ + +/* Pablo information */ +/* (Put before include files to avoid problems with inline functions) */ +#define PABLO_MASK H5FD_mpio_mask + +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ #include "H5Dprivate.h" /* Dataset functions */ -#include "H5Eprivate.h" /*error handling */ -#include "H5Fprivate.h" /*files */ -#include "H5FDprivate.h" /*file driver */ -#include "H5FDmpio.h" /* MPI I/O file driver */ -#include "H5Iprivate.h" /*object IDs */ -#include "H5MMprivate.h" /* Memory allocation */ -#include "H5Pprivate.h" /*property lists */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FDmpio.h" /* MPI I/O file driver */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ #ifdef H5_HAVE_PARALLEL @@ -159,7 +164,6 @@ hbool_t H5_mpi_1_metawrite_g = FALSE; #endif /* Interface initialization */ -#define PABLO_MASK H5FD_mpio_mask #define INTERFACE_INIT H5FD_mpio_init static int interface_initialize_g = 0; @@ -200,7 +204,7 @@ H5FD_mpio_init(void) #endif /* H5FDmpio_DEBUG */ hid_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpio_init, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpio_init, FAIL) if (H5I_VFL!=H5Iget_type(H5FD_MPIO_g)) H5FD_MPIO_g = H5FDregister(&H5FD_mpio_g); @@ -225,7 +229,7 @@ H5FD_mpio_init(void) ret_value=H5FD_MPIO_g; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -295,17 +299,17 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info) H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value; - FUNC_ENTER_API(H5Pset_fapl_mpio, FAIL); + FUNC_ENTER_API(H5Pset_fapl_mpio, FAIL) H5TRACE3("e","iMcMi",fapl_id,comm,info); if(fapl_id==H5P_DEFAULT) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list"); + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") /* Check arguments */ if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list"); + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list") if (MPI_COMM_NULL == comm) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid communicator"); + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid communicator") /* Initialize driver specific properties */ fa.comm = comm; @@ -315,7 +319,7 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info) ret_value= H5P_set_driver(plist, H5FD_MPIO, &fa); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } @@ -366,15 +370,15 @@ H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/) int mpi_code; /* mpi return code */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Pget_fapl_mpio, FAIL); + FUNC_ENTER_API(H5Pget_fapl_mpio, FAIL) H5TRACE3("e","ixx",fapl_id,comm,info); if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list"); + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list") if (H5FD_MPIO!=H5P_get_driver(plist)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") if (NULL==(fa=H5P_get_driver_info(plist))) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") /* Store the duplicated communicator in a temporary variable for error */ /* recovery in case the INFO duplication fails. We cannot attempt to */ @@ -382,13 +386,13 @@ H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/) /* up freeing whatever *comm holds and that could be invalid. */ if (comm){ if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(fa->comm, &comm_tmp))) - HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code) } if (info){ if (MPI_INFO_NULL != fa->info){ if (MPI_SUCCESS != (mpi_code=MPI_Info_dup(fa->info, info))) - HMPI_GOTO_ERROR(FAIL, "MPI_Info_dup failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_Info_dup failed", mpi_code) }else{ /* do not dup it */ *info = MPI_INFO_NULL; @@ -404,7 +408,7 @@ done: if (comm_tmp != MPI_COMM_NULL) MPI_Comm_free(&comm_tmp); } - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } @@ -440,27 +444,27 @@ H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode) H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value; - FUNC_ENTER_API(H5Pset_dxpl_mpio, FAIL); + FUNC_ENTER_API(H5Pset_dxpl_mpio, FAIL) H5TRACE2("e","iDt",dxpl_id,xfer_mode); if(dxpl_id==H5P_DEFAULT) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list"); + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") /* Check arguments */ if(NULL == (plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl"); + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") if (H5FD_MPIO_INDEPENDENT!=xfer_mode && H5FD_MPIO_COLLECTIVE!=xfer_mode) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "incorrect xfer_mode"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "incorrect xfer_mode") /* Set the transfer mode */ if (H5P_set(plist,H5D_XFER_IO_XFER_MODE_NAME,&xfer_mode)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") /* Initialize driver-specific properties */ ret_value= H5P_set_driver(plist, H5FD_MPIO, NULL); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } @@ -490,21 +494,21 @@ H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode/*out*/) H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Pget_dxpl_mpio, FAIL); + FUNC_ENTER_API(H5Pget_dxpl_mpio, FAIL) H5TRACE2("e","ix",dxpl_id,xfer_mode); if(NULL == (plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl"); + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") if (H5FD_MPIO!=H5P_get_driver(plist)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") /* Get the transfer mode */ if (xfer_mode) if (H5P_get(plist,H5D_XFER_IO_XFER_MODE_NAME,xfer_mode)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value") done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } @@ -530,7 +534,7 @@ H5FD_mpio_communicator(H5FD_t *_file) H5FD_mpio_t *file = (H5FD_mpio_t*)_file; MPI_Comm ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpio_communicator, MPI_COMM_NULL); + FUNC_ENTER_NOAPI(H5FD_mpio_communicator, MPI_COMM_NULL) assert(file); assert(H5FD_MPIO==file->pub.driver_id); @@ -539,7 +543,7 @@ H5FD_mpio_communicator(H5FD_t *_file) ret_value=file->comm; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -564,7 +568,7 @@ H5FD_mpio_mpi_rank(H5FD_t *_file) H5FD_mpio_t *file = (H5FD_mpio_t*)_file; int ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpio_mpi_rank, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpio_mpi_rank, FAIL) assert(file); assert(H5FD_MPIO==file->pub.driver_id); @@ -573,7 +577,7 @@ H5FD_mpio_mpi_rank(H5FD_t *_file) ret_value=file->mpi_rank; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpio_mpi_rank() */ @@ -598,7 +602,7 @@ H5FD_mpio_mpi_size(H5FD_t *_file) H5FD_mpio_t *file = (H5FD_mpio_t*)_file; int ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpio_mpi_size, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpio_mpi_size, FAIL) assert(file); assert(H5FD_MPIO==file->pub.driver_id); @@ -607,7 +611,7 @@ H5FD_mpio_mpi_size(H5FD_t *_file) ret_value=file->mpi_size; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpio_mpi_size() */ @@ -642,26 +646,26 @@ H5FD_mpio_setup(hid_t dxpl_id, MPI_Datatype btype, MPI_Datatype ftype, unsigned H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpio_setup, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpio_setup, FAIL) /* Check arguments */ if(NULL == (plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dataset transfer list"); + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dataset transfer list") /* Set buffer MPI type */ if(H5P_insert(plist,H5FD_MPIO_XFER_MEM_MPI_TYPE_NAME,H5FD_MPIO_XFER_MEM_MPI_TYPE_SIZE,&btype,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert MPI-I/O property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert MPI-I/O property") /* Set file MPI type */ if(H5P_insert(plist,H5FD_MPIO_XFER_FILE_MPI_TYPE_NAME,H5FD_MPIO_XFER_FILE_MPI_TYPE_SIZE,&ftype,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert MPI-I/O property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert MPI-I/O property") /* Set 'use view' property */ if(H5P_insert(plist,H5FD_MPIO_XFER_USE_VIEW_NAME,H5FD_MPIO_XFER_USE_VIEW_SIZE,&use_view,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert MPI-I/O property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert MPI-I/O property") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -686,26 +690,26 @@ H5FD_mpio_teardown(hid_t dxpl_id) H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpio_teardown, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpio_teardown, FAIL) /* Check arguments */ if(NULL == (plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dataset transfer list"); + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dataset transfer list") /* Remove buffer MPI type */ if(H5P_remove(dxpl_id,plist,H5FD_MPIO_XFER_MEM_MPI_TYPE_NAME)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "can't remove MPI-I/O property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "can't remove MPI-I/O property") /* Remove file MPI type */ if(H5P_remove(dxpl_id,plist,H5FD_MPIO_XFER_FILE_MPI_TYPE_NAME)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "can't remove MPI-I/O property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "can't remove MPI-I/O property") /* Remove 'use view' property */ if(H5P_remove(dxpl_id,plist,H5FD_MPIO_XFER_USE_VIEW_NAME)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "can't remove MPI-I/O property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "can't remove MPI-I/O property") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -744,7 +748,7 @@ H5FD_mpio_wait_for_left_neighbor(H5FD_t *_file) int mpi_code; /* mpi return code */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpio_wait_for_left_neighbor, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpio_wait_for_left_neighbor, FAIL) assert(file); assert(H5FD_MPIO==file->pub.driver_id); @@ -756,11 +760,11 @@ H5FD_mpio_wait_for_left_neighbor(H5FD_t *_file) if (file->mpi_rank != 0) { if (MPI_SUCCESS != (mpi_code=MPI_Recv( &msgbuf, 1, MPI_CHAR, file->mpi_rank-1, MPI_ANY_TAG, file->comm, &rcvstat ))) - HMPI_GOTO_ERROR(FAIL, "MPI_Recv failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_Recv failed", mpi_code) } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -798,7 +802,7 @@ H5FD_mpio_signal_right_neighbor(H5FD_t *_file) int mpi_code; /* mpi return code */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpio_signal_right_neighbor, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpio_signal_right_neighbor, FAIL) assert(file); assert(H5FD_MPIO==file->pub.driver_id); @@ -806,11 +810,11 @@ H5FD_mpio_signal_right_neighbor(H5FD_t *_file) if (file->mpi_rank != (file->mpi_size-1)) { if (MPI_SUCCESS != (mpi_code=MPI_Send(&msgbuf, 0/*empty msg*/, MPI_CHAR, file->mpi_rank+1, 0, file->comm))) - HMPI_GOTO_ERROR(FAIL, "MPI_Send failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_Send failed", mpi_code) } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -841,25 +845,24 @@ H5FD_mpio_fapl_get(H5FD_t *_file) H5FD_mpio_fapl_t *fa = NULL; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpio_fapl_get, NULL); + FUNC_ENTER_NOAPI(H5FD_mpio_fapl_get, NULL) assert(file); assert(H5FD_MPIO==file->pub.driver_id); if (NULL==(fa=H5MM_calloc(sizeof(H5FD_mpio_fapl_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Duplicate communicator and Info object. */ if (FAIL==H5FD_mpio_comm_info_dup(file->comm, file->info, &fa->comm, &fa->info)) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, - "Communicator/Info duplicate failed"); + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "Communicator/Info duplicate failed") /* Set return value */ ret_value=fa; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -886,14 +889,14 @@ H5FD_mpio_fapl_copy(const void *_old_fa) const H5FD_mpio_fapl_t *old_fa = (const H5FD_mpio_fapl_t*)_old_fa; H5FD_mpio_fapl_t *new_fa = NULL; - FUNC_ENTER_NOAPI(H5FD_mpio_fapl_copy, NULL); + FUNC_ENTER_NOAPI(H5FD_mpio_fapl_copy, NULL) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) fprintf(stderr, "enter H5FD_mpio_fapl_copy\n"); #endif if (NULL==(new_fa=H5MM_malloc(sizeof(H5FD_mpio_fapl_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy the general information */ HDmemcpy(new_fa, old_fa, sizeof(H5FD_mpio_fapl_t)); @@ -901,8 +904,7 @@ fprintf(stderr, "enter H5FD_mpio_fapl_copy\n"); /* Duplicate communicator and Info object. */ if (FAIL==H5FD_mpio_comm_info_dup(old_fa->comm, old_fa->info, &new_fa->comm, &new_fa->info)) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, - "Communicator/Info duplicate failed"); + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "Communicator/Info duplicate failed") ret_value = new_fa; done: @@ -916,7 +918,7 @@ done: if (H5FD_mpio_Debug[(int)'t']) fprintf(stderr, "leaving H5FD_mpio_fapl_copy\n"); #endif - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpio_fapl_copy() */ @@ -942,7 +944,7 @@ H5FD_mpio_fapl_free(void *_fa) herr_t ret_value = SUCCEED; H5FD_mpio_fapl_t *fa = (H5FD_mpio_fapl_t*)_fa; - FUNC_ENTER_NOAPI(H5FD_mpio_fapl_free, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpio_fapl_free, FAIL) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) fprintf(stderr, "in H5FD_mpio_fapl_free\n"); @@ -959,7 +961,7 @@ done: if (H5FD_mpio_Debug[(int)'t']) fprintf(stderr, "leaving H5FD_mpio_fapl_free\n"); #endif - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpio_fapl_free() */ @@ -1028,7 +1030,7 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, MPI_Info info_dup=MPI_INFO_NULL; - FUNC_ENTER_NOAPI(H5FD_mpio_open, NULL); + FUNC_ENTER_NOAPI(H5FD_mpio_open, NULL) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) { @@ -1039,7 +1041,7 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, /* Obtain a pointer to mpio-specific file access properties */ if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") if (H5P_FILE_ACCESS_DEFAULT==fapl_id || H5FD_MPIO!=H5P_get_driver(plist)) { _fa.comm = MPI_COMM_SELF; /*default*/ _fa.info = MPI_INFO_NULL; /*default*/ @@ -1051,8 +1053,7 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, /* Duplicate communicator and Info object for use by this file. */ if (FAIL==H5FD_mpio_comm_info_dup(fa->comm, fa->info, &comm_dup, &info_dup)) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, - "Communicator/Info duplicate failed"); + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "Communicator/Info duplicate failed") /* convert HDF5 flags to MPI-IO flags */ /* some combinations are illegal; let MPI-IO figure it out */ @@ -1066,7 +1067,8 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, char debug_str[128]; int flag, i; if (MPI_INFO_NULL != info_dup) { - MPI_Info_get(fa->info, H5F_MPIO_DEBUG_KEY, 127, debug_str, &flag); + /*OKAY: CAST DISCARDS CONST*/ + MPI_Info_get(fa->info, (char *)H5F_MPIO_DEBUG_KEY, 127, debug_str, &flag); if (flag) { fprintf(stdout, "H5FD_mpio debug flags=%s\n", debug_str ); for (i=0; @@ -1082,14 +1084,14 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, /*OKAY: CAST DISCARDS CONST*/ mpi_code=MPI_File_open(comm_dup, (char*)name, mpi_amode, info_dup, &fh); if (MPI_SUCCESS != mpi_code) - HMPI_GOTO_ERROR(NULL, "MPI_File_open failed", mpi_code); + HMPI_GOTO_ERROR(NULL, "MPI_File_open failed", mpi_code) file_opened=1; /* Get the MPI rank of this process and the total number of processes */ if (MPI_SUCCESS != (mpi_code=MPI_Comm_rank (comm_dup, &mpi_rank))) - HMPI_GOTO_ERROR(NULL, "MPI_Comm_rank failed", mpi_code); + HMPI_GOTO_ERROR(NULL, "MPI_Comm_rank failed", mpi_code) if (MPI_SUCCESS != (mpi_code=MPI_Comm_size (comm_dup, &mpi_size))) - HMPI_GOTO_ERROR(NULL, "MPI_Comm_size failed", mpi_code); + HMPI_GOTO_ERROR(NULL, "MPI_Comm_size failed", mpi_code) /* Following changes in handling file-truncation made be rkyates and ppweidhaas, sep 99 */ @@ -1097,27 +1099,27 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, if (mpi_rank == 0) { /* Get current file size */ if (MPI_SUCCESS != (mpi_code=MPI_File_get_size(fh, &size))) - HMPI_GOTO_ERROR(NULL, "MPI_File_get_size failed", mpi_code); + HMPI_GOTO_ERROR(NULL, "MPI_File_get_size failed", mpi_code) } /* Broadcast file-size */ if (MPI_SUCCESS != (mpi_code=MPI_Bcast(&size, sizeof(MPI_Offset), MPI_BYTE, 0, comm_dup))) - HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code); + HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) /* Only if size > 0, truncate the file - if requested */ if (size && (flags & H5F_ACC_TRUNC)) { if (MPI_SUCCESS != (mpi_code=MPI_File_set_size(fh, (MPI_Offset)0))) - HMPI_GOTO_ERROR(NULL, "MPI_File_set_size failed", mpi_code); + HMPI_GOTO_ERROR(NULL, "MPI_File_set_size failed", mpi_code) /* Don't let any proc return until all have truncated the file. */ if (MPI_SUCCESS!= (mpi_code=MPI_Barrier(comm_dup))) - HMPI_GOTO_ERROR(NULL, "MPI_Barrier failed", mpi_code); + HMPI_GOTO_ERROR(NULL, "MPI_Barrier failed", mpi_code) size = 0; } /* Build the return value and initialize it */ if (NULL==(file=H5MM_calloc(sizeof(H5FD_mpio_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") file->f = fh; file->comm = comm_dup; @@ -1145,7 +1147,7 @@ done: if (H5FD_mpio_Debug[(int)'t']) fprintf(stdout, "Leaving H5FD_mpio_open\n" ); #endif - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -1179,7 +1181,7 @@ H5FD_mpio_close(H5FD_t *_file) int mpi_code; /* mpi return code */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpio_close, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpio_close, FAIL) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) @@ -1190,7 +1192,7 @@ H5FD_mpio_close(H5FD_t *_file) /* MPI_File_close sets argument to MPI_FILE_NULL */ if (MPI_SUCCESS != (mpi_code=MPI_File_close(&(file->f)/*in,out*/))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_close failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_File_close failed", mpi_code) /* Clean up other stuff */ H5FD_mpio_comm_info_free(&file->comm, &file->info); @@ -1201,7 +1203,7 @@ done: if (H5FD_mpio_Debug[(int)'t']) fprintf(stdout, "Leaving H5FD_mpio_close\n"); #endif - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -1227,7 +1229,7 @@ H5FD_mpio_query(const H5FD_t UNUSED *_file, unsigned long *flags /* out */) { herr_t ret_value=SUCCEED; - FUNC_ENTER_NOAPI(H5FD_mpio_query, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpio_query, FAIL) /* Set the VFL feature flags that this driver supports */ if(flags) { @@ -1246,7 +1248,7 @@ H5FD_mpio_query(const H5FD_t UNUSED *_file, unsigned long *flags /* out */) } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -1274,7 +1276,7 @@ H5FD_mpio_get_eoa(H5FD_t *_file) H5FD_mpio_t *file = (H5FD_mpio_t*)_file; haddr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpio_get_eoa, HADDR_UNDEF); + FUNC_ENTER_NOAPI(H5FD_mpio_get_eoa, HADDR_UNDEF) assert(file); assert(H5FD_MPIO==file->pub.driver_id); @@ -1283,7 +1285,7 @@ H5FD_mpio_get_eoa(H5FD_t *_file) ret_value=file->eoa; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -1311,7 +1313,7 @@ H5FD_mpio_set_eoa(H5FD_t *_file, haddr_t addr) H5FD_mpio_t *file = (H5FD_mpio_t*)_file; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpio_set_eoa, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpio_set_eoa, FAIL) assert(file); assert(H5FD_MPIO==file->pub.driver_id); @@ -1319,7 +1321,7 @@ H5FD_mpio_set_eoa(H5FD_t *_file, haddr_t addr) file->eoa = addr; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -1354,7 +1356,7 @@ H5FD_mpio_get_eof(H5FD_t *_file) H5FD_mpio_t *file = (H5FD_mpio_t*)_file; haddr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpio_get_eof, HADDR_UNDEF); + FUNC_ENTER_NOAPI(H5FD_mpio_get_eof, HADDR_UNDEF) assert(file); assert(H5FD_MPIO==file->pub.driver_id); @@ -1363,7 +1365,7 @@ H5FD_mpio_get_eof(H5FD_t *_file) ret_value=file->eof; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -1387,15 +1389,15 @@ H5FD_mpio_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void** file_handle) H5FD_mpio_t *file = (H5FD_mpio_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(H5FD_mpio_get_handle, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpio_get_handle, FAIL) if(!file_handle) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") *file_handle = &(file->f); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -1478,7 +1480,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT; /* I/O tranfer mode */ herr_t ret_value=SUCCEED; - FUNC_ENTER_NOAPI(H5FD_mpio_read, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpio_read, FAIL) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) @@ -1496,10 +1498,10 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add /* some numeric conversions */ if (H5FD_mpio_haddr_to_MPIOff(addr, &mpi_off/*out*/)<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off"); + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off") size_i = (int)size; if ((hsize_t)size_i != size) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from size to size_i"); + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from size to size_i") #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'r']) @@ -1509,7 +1511,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add /* Obtain the data transfer properties */ if(NULL == (plist = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") if (H5FD_MPIO==H5P_get_driver(plist)) { /* Get the transfer mode */ xfer_mode=(H5FD_mpio_xfer_t)H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); @@ -1523,14 +1525,14 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add */ if(H5P_exist_plist(plist,H5FD_MPIO_XFER_USE_VIEW_NAME)>0) if(H5P_get(plist,H5FD_MPIO_XFER_USE_VIEW_NAME,&use_view_this_time)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") if (use_view_this_time) { /* prepare for a full-blown xfer using btype, ftype, and disp */ if(H5P_get(plist,H5FD_MPIO_XFER_MEM_MPI_TYPE_NAME,&buf_type)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") if(H5P_get(plist,H5FD_MPIO_XFER_FILE_MPI_TYPE_NAME,&file_type)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") /* When using types, use the address as the displacement for * MPI_File_set_view and reset the address for the read to zero @@ -1554,21 +1556,21 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add if (use_view_this_time) { /*OKAY: CAST DISCARDS CONST QUALIFIER*/ if (MPI_SUCCESS != (mpi_code=MPI_File_set_view(file->f, mpi_disp, MPI_BYTE, file_type, (char*)"native", file->info))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) } /* end if */ /* Read the data. */ assert(H5FD_MPIO_INDEPENDENT==xfer_mode || H5FD_MPIO_COLLECTIVE==xfer_mode); if (H5FD_MPIO_INDEPENDENT==xfer_mode) { if (MPI_SUCCESS!= (mpi_code=MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code) } else { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) fprintf(stdout, "H5FD_mpio_read: using MPIO collective mode\n"); #endif if (MPI_SUCCESS!= (mpi_code=MPI_File_read_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat ))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at_all failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at_all failed", mpi_code) } /* KLUDGE, Robb Matzke, 2000-12-29 @@ -1596,7 +1598,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add else { /* How many bytes were actually read? */ if (MPI_SUCCESS != (mpi_code=MPI_Get_count(&mpi_stat, MPI_BYTE, &bytes_read))) - HMPI_GOTO_ERROR(FAIL, "MPI_Get_count failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_Get_count failed", mpi_code) } /* end else */ #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'c']) @@ -1615,7 +1617,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add /* Check for read failure */ if (bytes_read<0 || bytes_read>size_i) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed"); + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") /* * Reset the file view when we used MPI derived types @@ -1623,7 +1625,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add if (use_view_this_time) { /*OKAY: CAST DISCARDS CONST QUALIFIER*/ if (MPI_SUCCESS != (mpi_code=MPI_File_set_view(file->f, 0, MPI_BYTE, MPI_BYTE, (char*)"native", file->info))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) } /* end if */ /* @@ -1636,7 +1638,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add * INCOMPLETE rky 1998-09-18 * Haven't implemented reading zeros beyond EOF. What to do??? */ - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "eof file read failed"); + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "eof file read failed") } else { memset((char*)buf+bytes_read, 0, (size_t)n); } @@ -1648,7 +1650,7 @@ done: fprintf(stdout, "Leaving H5FD_mpio_read\n" ); #endif - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -1785,7 +1787,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT; /* I/O tranfer mode */ herr_t ret_value=SUCCEED; - FUNC_ENTER_NOAPI(H5FD_mpio_write, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpio_write, FAIL) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) @@ -1803,10 +1805,10 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, /* some numeric conversions */ if (H5FD_mpio_haddr_to_MPIOff(addr, &mpi_off)<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off"); + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off") size_i = (int)size; if ((hsize_t)size_i != size) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from size to size_i"); + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from size to size_i") #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'w']) @@ -1816,7 +1818,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, /* Obtain the data transfer properties */ if(NULL == (plist = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") if (H5FD_MPIO==H5P_get_driver(plist)) { /* Get the transfer mode */ xfer_mode=(H5FD_mpio_xfer_t)H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); @@ -1830,14 +1832,14 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, */ if(H5P_exist_plist(plist,H5FD_MPIO_XFER_USE_VIEW_NAME)>0) if(H5P_get(plist,H5FD_MPIO_XFER_USE_VIEW_NAME,&use_view_this_time)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") if (use_view_this_time) { /* prepare for a full-blown xfer using btype, ftype, and disp */ if(H5P_get(plist,H5FD_MPIO_XFER_MEM_MPI_TYPE_NAME,&buf_type)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") if(H5P_get(plist,H5FD_MPIO_XFER_FILE_MPI_TYPE_NAME,&file_type)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") /* When using types, use the address as the displacement for * MPI_File_set_view and reset the address for the read to zero @@ -1861,7 +1863,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, if (use_view_this_time) { /*OKAY: CAST DISCARDS CONST QUALIFIER*/ if (MPI_SUCCESS != (mpi_code=MPI_File_set_view(file->f, mpi_disp, MPI_BYTE, file_type, (char*)"native", file->info))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) } /* end if */ /* Metadata specific actions */ @@ -1874,11 +1876,11 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, */ if(H5P_exist_plist(plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME)>0) if(H5P_get(plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,&block_before_meta_write)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get H5AC property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get H5AC property") if(block_before_meta_write) if (MPI_SUCCESS!= (mpi_code=MPI_Barrier(file->comm))) - HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code) /* Only p<round> will do the actual write if all procs in comm write same metadata */ if (H5_mpi_1_metawrite_g) { @@ -1900,7 +1902,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, if (H5FD_MPIO_INDEPENDENT==xfer_mode) { /*OKAY: CAST DISCARDS CONST QUALIFIER*/ if (MPI_SUCCESS != (mpi_code=MPI_File_write_at(file->f, mpi_off, (void*)buf, size_i, buf_type, &mpi_stat))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code) } else { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) @@ -1908,7 +1910,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, #endif /*OKAY: CAST DISCARDS CONST QUALIFIER*/ if (MPI_SUCCESS != (mpi_code=MPI_File_write_at_all(file->f, mpi_off, (void*)buf, size_i, buf_type, &mpi_stat))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code) } /* KLUDGE, Robb Matzke, 2000-12-29 @@ -1936,7 +1938,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, else { /* How many bytes were actually written? */ if (MPI_SUCCESS!= (mpi_code=MPI_Get_count(&mpi_stat, MPI_BYTE, &bytes_written))) - HMPI_GOTO_ERROR(FAIL, "MPI_Get_count failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_Get_count failed", mpi_code) } /* end else */ #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'c']) @@ -1955,7 +1957,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, /* Check for write failure */ if (bytes_written<0 || bytes_written>size_i) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file write failed"); + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file write failed") /* * Reset the file view when we used MPI derived types @@ -1963,7 +1965,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, if (use_view_this_time) { /*OKAY: CAST DISCARDS CONST QUALIFIER*/ if (MPI_SUCCESS != (mpi_code=MPI_File_set_view(file->f, 0, MPI_BYTE, MPI_BYTE, (char*)"native", file->info))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) } /* end if */ /* Forget the EOF value (see H5FD_mpio_get_eof()) --rpm 1999-08-06 */ @@ -1975,7 +1977,7 @@ done: /* if only p<round> writes, need to broadcast the ret_value to other processes */ if ((type!=H5FD_MEM_DRAW) && H5_mpi_1_metawrite_g) { if (MPI_SUCCESS != (mpi_code=MPI_Bcast(&ret_value, sizeof(ret_value), MPI_BYTE, H5_PAR_META_WRITE, file->comm))) - HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_code) } /* end if */ } /* end if */ @@ -1984,7 +1986,7 @@ done: fprintf(stdout, "proc %d: Leaving H5FD_mpio_write with ret_value=%d\n", file->mpi_rank, ret_value ); #endif - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -2029,7 +2031,7 @@ H5FD_mpio_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned closing) MPI_Status mpi_stat; #endif /* OLD_WAY */ - FUNC_ENTER_NOAPI(H5FD_mpio_flush, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpio_flush, FAIL) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) @@ -2051,19 +2053,19 @@ H5FD_mpio_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned closing) #ifdef OLD_WAY if (0==file->mpi_rank) { if (H5FD_mpio_haddr_to_MPIOff(file->eoa-1, &mpi_off)<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "cannot convert from haddr_t to MPI_Offset"); + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "cannot convert from haddr_t to MPI_Offset") if (MPI_SUCCESS != (mpi_code=MPI_File_read_at(file->f, mpi_off, &byte, 1, MPI_BYTE, &mpi_stat))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code) if (MPI_SUCCESS != (mpi_code=MPI_File_write_at(file->f, mpi_off, &byte, 1, MPI_BYTE, &mpi_stat))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code) } /* end if */ #else /* OLD_WAY */ if (H5FD_mpio_haddr_to_MPIOff(file->eoa, &mpi_off)<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "cannot convert from haddr_t to MPI_Offset"); + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "cannot convert from haddr_t to MPI_Offset") /* Extend the file's size */ if (MPI_SUCCESS != (mpi_code=MPI_File_set_size(file->f, mpi_off))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_set_size failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_File_set_size failed", mpi_code) /* Don't let any proc return until all have extended the file. * (Prevents race condition where some processes go ahead and write @@ -2072,7 +2074,7 @@ H5FD_mpio_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned closing) * the new data written) */ if (MPI_SUCCESS!= (mpi_code=MPI_Barrier(file->comm))) - HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code) #endif /* OLD_WAY */ /* Update the 'last' eoa value */ @@ -2082,7 +2084,7 @@ H5FD_mpio_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned closing) /* Only sync the file if we are not going to immediately close it */ if(!closing) { if (MPI_SUCCESS != (mpi_code=MPI_File_sync(file->f))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_sync failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_File_sync failed", mpi_code) } /* end if */ done: @@ -2091,7 +2093,7 @@ done: fprintf(stdout, "Leaving H5FD_mpio_flush\n" ); #endif - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -2122,14 +2124,14 @@ H5FD_mpio_MPIOff_to_haddr(MPI_Offset mpi_off) { haddr_t ret_value=HADDR_UNDEF; - FUNC_ENTER_NOINIT(H5FD_mpio_MPIOff_to_haddr); + FUNC_ENTER_NOINIT(H5FD_mpio_MPIOff_to_haddr) if (mpi_off != (MPI_Offset)(haddr_t)mpi_off) ret_value=HADDR_UNDEF; else ret_value=(haddr_t)mpi_off; - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -2163,7 +2165,7 @@ H5FD_mpio_haddr_to_MPIOff(haddr_t addr, MPI_Offset *mpi_off/*out*/) { herr_t ret_value=FAIL; - FUNC_ENTER_NOINIT(H5FD_mpio_haddr_to_MPIOff); + FUNC_ENTER_NOINIT(H5FD_mpio_haddr_to_MPIOff) if (mpi_off) *mpi_off = (MPI_Offset)addr; @@ -2172,7 +2174,7 @@ H5FD_mpio_haddr_to_MPIOff(haddr_t addr, MPI_Offset *mpi_off/*out*/) else ret_value=SUCCEED; - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -2204,7 +2206,7 @@ H5FD_mpio_comm_info_dup(MPI_Comm comm, MPI_Info info, MPI_Comm *comm_new, MPI_In MPI_Info info_dup=MPI_INFO_NULL; int mpi_code; - FUNC_ENTER_NOAPI(H5FD_mpio_comm_info_dup, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpio_comm_info_dup, FAIL) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) @@ -2212,16 +2214,16 @@ fprintf(stderr, "In H5FD_mpio_comm_info_dup: argument comm/info = %d/%ld\n", com #endif /* Check arguments */ if (MPI_COMM_NULL == comm) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "not a valid argument"); + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "not a valid argument") if (!comm_new || !info_new) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "bad pointers"); + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "bad pointers") /* Dup them. Using temporary variables for error recovery cleanup. */ if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(comm, &comm_dup))) - HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code) if (MPI_INFO_NULL != info){ if (MPI_SUCCESS != (mpi_code=MPI_Info_dup(info, &info_dup))) - HMPI_GOTO_ERROR(FAIL, "MPI_Info_dup failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_Info_dup failed", mpi_code) }else{ /* No dup, just copy it. */ info_dup = info; @@ -2244,7 +2246,7 @@ done: if (H5FD_mpio_Debug[(int)'t']) fprintf(stderr, "Leaving H5FD_mpio_comm_info_dup\n"); #endif - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -2271,7 +2273,7 @@ static herr_t H5FD_mpio_comm_info_free(MPI_Comm *comm, MPI_Info *info) { herr_t ret_value=SUCCEED; - FUNC_ENTER_NOAPI(H5FD_mpio_comm_info_free, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpio_comm_info_free, FAIL) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) @@ -2279,7 +2281,7 @@ fprintf(stderr, "in H5FD_mpio_comm_info_free\n"); #endif /* Check arguments */ if (!comm || !info) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "not a valid argument"); + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "not a valid argument") if (MPI_COMM_NULL != *comm) MPI_Comm_free(comm); @@ -2291,6 +2293,6 @@ done: if (H5FD_mpio_Debug[(int)'t']) fprintf(stderr, "Leaving H5FD_mpio_comm_info_free\n"); #endif - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c index 7a17016..735ea5f 100644 --- a/src/H5FDmpiposix.c +++ b/src/H5FDmpiposix.c @@ -31,15 +31,20 @@ * on a non-parallel filesystem. * */ -#include "H5private.h" /*library functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Eprivate.h" /*error handling */ -#include "H5Fprivate.h" /*files */ -#include "H5FDprivate.h" /*file driver */ + +/* Pablo information */ +/* (Put before include files to avoid problems with inline functions) */ +#define PABLO_MASK H5FD_mpiposix_mask + +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ #include "H5FDmpiposix.h" /* MPI/posix I/O file driver */ #include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /*memory allocation */ -#include "H5Pprivate.h" /*property lists */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ /* Features: * H5_HAVE_GPFS -- issue gpfs_fcntl() calls to hopefully improve @@ -234,7 +239,6 @@ hbool_t H5_mpiposix_1_metawrite_g = FALSE; #endif /* Interface initialization */ -#define PABLO_MASK H5FD_mpiposix_mask #define INTERFACE_INIT H5FD_mpiposix_init static int interface_initialize_g = 0; @@ -261,7 +265,7 @@ H5FD_mpiposix_init(void) { hid_t ret_value=H5FD_MPIPOSIX_g; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpiposix_init, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpiposix_init, FAIL) if (H5I_VFL!=H5Iget_type(H5FD_MPIPOSIX_g)) H5FD_MPIPOSIX_g = H5FDregister(&H5FD_mpiposix_g); @@ -270,7 +274,7 @@ H5FD_mpiposix_init(void) ret_value=H5FD_MPIPOSIX_g; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpiposix_init() */ @@ -315,14 +319,14 @@ H5Pset_fapl_mpiposix(hid_t fapl_id, MPI_Comm comm, hbool_t use_gpfs) H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value; - FUNC_ENTER_API(H5Pset_fapl_mpiposix, FAIL); + FUNC_ENTER_API(H5Pset_fapl_mpiposix, FAIL) H5TRACE3("e","iMcb",fapl_id,comm,use_gpfs); /* Check arguments */ if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list"); + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list") if (MPI_COMM_NULL == comm) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid communicator"); + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid communicator") /* Initialize driver specific properties */ fa.comm = comm; @@ -332,7 +336,7 @@ H5Pset_fapl_mpiposix(hid_t fapl_id, MPI_Comm comm, hbool_t use_gpfs) ret_value= H5P_set_driver(plist, H5FD_MPIPOSIX, &fa); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Pset_fapl_mpiposix() */ @@ -374,27 +378,27 @@ H5Pget_fapl_mpiposix(hid_t fapl_id, MPI_Comm *comm/*out*/, hbool_t *use_gpfs/*ou int mpi_code; /* mpi return code */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Pget_fapl_mpiposix, FAIL); + FUNC_ENTER_API(H5Pget_fapl_mpiposix, FAIL) H5TRACE3("e","ixx",fapl_id,comm,use_gpfs); if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list"); + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list") if (H5FD_MPIPOSIX!=H5P_get_driver(plist)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") if (NULL==(fa=H5P_get_driver_info(plist))) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") /* Get MPI Communicator */ if (comm){ if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(fa->comm, comm))) - HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code) } if (use_gpfs) *use_gpfs = fa->use_gpfs; done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Pget_fapl_mpiposix() */ @@ -420,7 +424,7 @@ H5FD_mpiposix_communicator(H5FD_t *_file) H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; MPI_Comm ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpiposix_communicator, MPI_COMM_NULL); + FUNC_ENTER_NOAPI(H5FD_mpiposix_communicator, MPI_COMM_NULL) assert(file); assert(H5FD_MPIPOSIX==file->pub.driver_id); @@ -429,7 +433,7 @@ H5FD_mpiposix_communicator(H5FD_t *_file) ret_value=file->comm; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpi_posix_communicator() */ @@ -454,7 +458,7 @@ H5FD_mpiposix_mpi_rank(H5FD_t *_file) H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; int ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpiposix_mpi_rank, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpiposix_mpi_rank, FAIL) assert(file); assert(H5FD_MPIPOSIX==file->pub.driver_id); @@ -463,7 +467,7 @@ H5FD_mpiposix_mpi_rank(H5FD_t *_file) ret_value=file->mpi_rank; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpiposix_mpi_rank() */ @@ -488,7 +492,7 @@ H5FD_mpiposix_mpi_size(H5FD_t *_file) H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; int ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpiposix_mpi_rank, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpiposix_mpi_rank, FAIL) assert(file); assert(H5FD_MPIPOSIX==file->pub.driver_id); @@ -497,7 +501,7 @@ H5FD_mpiposix_mpi_size(H5FD_t *_file) ret_value=file->mpi_size; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpiposix_mpi_size() */ @@ -530,17 +534,17 @@ H5FD_mpiposix_fapl_get(H5FD_t *_file) int mpi_code; /* MPI return code */ void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpiposix_fapl_get, NULL); + FUNC_ENTER_NOAPI(H5FD_mpiposix_fapl_get, NULL) assert(file); assert(H5FD_MPIPOSIX==file->pub.driver_id); if (NULL==(fa=H5MM_calloc(sizeof(H5FD_mpiposix_fapl_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Duplicate the communicator. */ if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(file->comm, &fa->comm))) - HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code); + HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code) fa->use_gpfs = file->use_gpfs; @@ -548,7 +552,7 @@ H5FD_mpiposix_fapl_get(H5FD_t *_file) ret_value=fa; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpiposix_fapl_get() */ @@ -576,17 +580,17 @@ H5FD_mpiposix_fapl_copy(const void *_old_fa) H5FD_mpiposix_fapl_t *new_fa = NULL; int mpi_code; /* MPI return code */ - FUNC_ENTER_NOAPI(H5FD_mpiposix_fapl_copy, NULL); + FUNC_ENTER_NOAPI(H5FD_mpiposix_fapl_copy, NULL) if (NULL==(new_fa=H5MM_malloc(sizeof(H5FD_mpiposix_fapl_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy the general information */ HDmemcpy(new_fa, old_fa, sizeof(H5FD_mpiposix_fapl_t)); /* Duplicate communicator. */ if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(old_fa->comm, &new_fa->comm))) - HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code); + HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code) new_fa->use_gpfs = old_fa->use_gpfs; ret_value = new_fa; @@ -598,7 +602,7 @@ done: H5MM_xfree(new_fa); } - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpiposix_fapl_copy() */ @@ -624,7 +628,7 @@ H5FD_mpiposix_fapl_free(void *_fa) herr_t ret_value = SUCCEED; H5FD_mpiposix_fapl_t *fa = (H5FD_mpiposix_fapl_t*)_fa; - FUNC_ENTER_NOAPI(H5FD_mpiposix_fapl_free, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpiposix_fapl_free, FAIL) assert(fa); /* Free the internal communicator */ @@ -633,7 +637,7 @@ H5FD_mpiposix_fapl_free(void *_fa) H5MM_xfree(fa); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpiposix_fapl_free() */ @@ -682,19 +686,19 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id, H5FD_t *ret_value=NULL; /* Return value */ MPI_Comm comm_dup=MPI_COMM_NULL; - FUNC_ENTER_NOAPI(H5FD_mpiposix_open, NULL); + FUNC_ENTER_NOAPI(H5FD_mpiposix_open, NULL) /* Check arguments */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name") if (0==maxaddr || HADDR_UNDEF==maxaddr) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr"); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") if (ADDR_OVERFLOW(maxaddr)) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr"); + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr") /* Obtain a pointer to mpiposix-specific file access properties */ if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") if (H5P_FILE_ACCESS_DEFAULT==fapl_id || H5FD_MPIPOSIX!=H5P_get_driver(plist)) { _fa.comm = MPI_COMM_SELF; /*default*/ _fa.use_gpfs = FALSE; @@ -707,13 +711,13 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id, /* Duplicate the communicator for use by this file. */ if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(fa->comm, &comm_dup))) - HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code); + HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code) /* Get the MPI rank of this process and the total number of processes */ if (MPI_SUCCESS != (mpi_code=MPI_Comm_rank (comm_dup, &mpi_rank))) - HMPI_GOTO_ERROR(NULL, "MPI_Comm_rank failed", mpi_code); + HMPI_GOTO_ERROR(NULL, "MPI_Comm_rank failed", mpi_code) if (MPI_SUCCESS != (mpi_code=MPI_Comm_size (comm_dup, &mpi_size))) - HMPI_GOTO_ERROR(NULL, "MPI_Comm_size failed", mpi_code); + HMPI_GOTO_ERROR(NULL, "MPI_Comm_size failed", mpi_code) /* Build the open flags */ o_flags = (H5F_ACC_RDWR & flags) ? O_RDWR : O_RDONLY; @@ -748,29 +752,29 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id, * to check for that situation and bail out now also. - QAK */ if (MPI_SUCCESS != (mpi_code= MPI_Bcast(&fd, sizeof(int), MPI_BYTE, 0, comm_dup))) - HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code); + HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) /* If the file open on process 0 failed, bail out on all processes now */ if(fd<0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file"); + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") /* Other processes (non 0) wait for broadcast result from process 0 and then open file */ if(mpi_rank!=0) { /* Open the file */ if ((fd=HDopen(name, o_flags, 0666))<0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file"); + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") } /* end if */ /* Process 0 fstat()s the file and broadcasts the results to the other processes */ if(mpi_rank==0) { /* Get the stat information */ if (HDfstat(fd, &sb)<0) - HGOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file"); + HGOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file") } /* end if */ /* Broadcast the results of the fstat() from process 0 */ if (MPI_SUCCESS != (mpi_code= MPI_Bcast(&sb, sizeof(h5_stat_t), MPI_BYTE, 0, comm_dup))) - HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code); + HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) #ifdef H5_HAVE_GPFS if (fa->use_gpfs) { @@ -792,13 +796,13 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id, hint.fr.length = 0; if (gpfs_fcntl(fd, &hint)<0) - HGOTO_ERROR(H5E_FILE, H5E_FCNTL, NULL, "failed to send hints to GPFS"); + HGOTO_ERROR(H5E_FILE, H5E_FCNTL, NULL, "failed to send hints to GPFS") } #endif /* H5_HAVE_GPFS */ /* Build the file struct and initialize it */ if (NULL==(file=H5MM_calloc(sizeof(H5FD_mpiposix_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") #ifdef REPORT_IO HDfprintf(stderr, "open: rank=%d name=%s file=0x%08lx\n", mpi_rank, name, (unsigned long)file); @@ -845,7 +849,7 @@ done: MPI_Comm_free(&comm_dup); } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpiposix_open() */ @@ -871,21 +875,21 @@ H5FD_mpiposix_close(H5FD_t *_file) H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpiposix_close, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpiposix_close, FAIL) assert(file); assert(H5FD_MPIPOSIX==file->pub.driver_id); /* Close the unix file */ if (HDclose(file->fd)<0) - HGOTO_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file"); + HGOTO_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file") /* Clean up other stuff */ MPI_Comm_free(&file->comm); H5MM_xfree(file); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpiposix_close() */ @@ -913,34 +917,34 @@ 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(H5FD_mpiposix_cmp, H5FD_VFD_DEFAULT) #ifdef WIN32 - if (f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1); - if (f1->fileindexhi > f2->fileindexhi) HGOTO_DONE(1); + if (f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) + if (f1->fileindexhi > f2->fileindexhi) HGOTO_DONE(1) - if (f1->fileindexlo < f2->fileindexlo) HGOTO_DONE(-1); - if (f1->fileindexlo > f2->fileindexlo) HGOTO_DONE(1); + if (f1->fileindexlo < f2->fileindexlo) HGOTO_DONE(-1) + if (f1->fileindexlo > f2->fileindexlo) HGOTO_DONE(1) #else #ifdef H5_DEV_T_IS_SCALAR - if (f1->device < f2->device) HGOTO_DONE(-1); - if (f1->device > f2->device) HGOTO_DONE(1); + if (f1->device < f2->device) HGOTO_DONE(-1) + if (f1->device > f2->device) HGOTO_DONE(1) #else /* H5_DEV_T_IS_SCALAR */ /* If dev_t isn't a scalar value on this system, just use memcmp to * determine if the values are the same or not. The actual return value * shouldn't really matter... */ - if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t))<0) HGOTO_DONE(-1); - if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t))>0) HGOTO_DONE(1); + if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t))<0) HGOTO_DONE(-1) + if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t))>0) HGOTO_DONE(1) #endif /* H5_DEV_T_IS_SCALAR */ - if (f1->inode < f2->inode) HGOTO_DONE(-1); - if (f1->inode > f2->inode) HGOTO_DONE(1); + if (f1->inode < f2->inode) HGOTO_DONE(-1) + if (f1->inode > f2->inode) HGOTO_DONE(1) #endif done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpiposix_cmp() */ @@ -965,7 +969,7 @@ H5FD_mpiposix_query(const H5FD_t UNUSED *_file, unsigned long *flags /* out */) { herr_t ret_value=SUCCEED; - FUNC_ENTER_NOAPI(H5FD_mpiposix_query, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpiposix_query, FAIL) /* Set the VFL feature flags that this driver supports */ if(flags) { @@ -984,7 +988,7 @@ H5FD_mpiposix_query(const H5FD_t UNUSED *_file, unsigned long *flags /* out */) } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpiposix_query() */ @@ -1011,7 +1015,7 @@ H5FD_mpiposix_get_eoa(H5FD_t *_file) H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; haddr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpiposix_get_eoa, HADDR_UNDEF); + FUNC_ENTER_NOAPI(H5FD_mpiposix_get_eoa, HADDR_UNDEF) assert(file); assert(H5FD_MPIPOSIX==file->pub.driver_id); @@ -1020,7 +1024,7 @@ H5FD_mpiposix_get_eoa(H5FD_t *_file) ret_value=file->eoa; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpiposix_get_eoa() */ @@ -1047,7 +1051,7 @@ H5FD_mpiposix_set_eoa(H5FD_t *_file, haddr_t addr) H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpiposix_set_eoa, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpiposix_set_eoa, FAIL) assert(file); assert(H5FD_MPIPOSIX==file->pub.driver_id); @@ -1055,7 +1059,7 @@ H5FD_mpiposix_set_eoa(H5FD_t *_file, haddr_t addr) file->eoa = addr; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpi_posix_set_eoa() */ @@ -1087,7 +1091,7 @@ H5FD_mpiposix_get_eof(H5FD_t *_file) H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; haddr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpiposix_get_eof, HADDR_UNDEF); + FUNC_ENTER_NOAPI(H5FD_mpiposix_get_eof, HADDR_UNDEF) assert(file); assert(H5FD_MPIPOSIX==file->pub.driver_id); @@ -1096,7 +1100,7 @@ H5FD_mpiposix_get_eof(H5FD_t *_file) ret_value=MAX(file->eof,file->eoa); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpiposix_get_eof() */ @@ -1120,15 +1124,15 @@ H5FD_mpiposix_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void** file_handle) H5FD_mpiposix_t *file = (H5FD_mpiposix_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(H5FD_mpiposix_get_handle, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpiposix_get_handle, FAIL) if(!file_handle) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") *file_handle = &(file->fd); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -1162,7 +1166,7 @@ H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, ssize_t nbytes; /* Number of bytes read each I/O call */ herr_t ret_value=SUCCEED; - FUNC_ENTER_NOAPI(H5FD_mpiposix_read, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpiposix_read, FAIL) assert(file); assert(H5FD_MPIPOSIX==file->pub.driver_id); @@ -1170,11 +1174,11 @@ H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, /* Check for overflow conditions */ if (HADDR_UNDEF==addr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined") if (REGION_OVERFLOW(addr, size)) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow"); + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") if (addr+size>file->eoa) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow"); + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") #ifdef REPORT_IO { @@ -1188,7 +1192,7 @@ H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, /* Seek to the correct location */ if ((addr!=file->pos || OP_READ!=file->op) && file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0) - HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position"); + HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") /* * Read data, being careful of interrupted system calls, partial results, @@ -1199,7 +1203,7 @@ H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, nbytes = HDread(file->fd, buf, size); } while (-1==nbytes && EINTR==errno); if (-1==nbytes) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed"); + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") if (0==nbytes) { /* end of file but not end of format address space */ HDmemset(buf, 0, size); @@ -1224,7 +1228,7 @@ done: file->op = OP_UNKNOWN; } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpiposix_read() */ @@ -1263,7 +1267,7 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, unsigned block_before_meta_write=0; /* Whether to block before a metadata write */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_mpiposix_write, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpiposix_write, FAIL) assert(file); assert(H5FD_MPIPOSIX==file->pub.driver_id); @@ -1273,15 +1277,15 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, /* Check for overflow conditions */ if (HADDR_UNDEF==addr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined") if (REGION_OVERFLOW(addr, size)) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow"); + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") if (addr+size>file->eoa) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow"); + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") /* Obtain the data transfer properties */ if(NULL == (plist = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") /* Metadata specific actions */ if(type!=H5FD_MEM_DRAW) { @@ -1293,11 +1297,11 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, */ if(H5P_exist_plist(plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME)>0) if(H5P_get(plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,&block_before_meta_write)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get H5AC property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get H5AC property") if(block_before_meta_write) if (MPI_SUCCESS!= (mpi_code=MPI_Barrier(file->comm))) - HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code) /* Only p<round> will do the actual write if all procs in comm write same metadata */ if (H5_mpiposix_1_metawrite_g) @@ -1334,7 +1338,7 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hint.mar.accRangeArray[0].length = MIN(file->blksize-hint.mar.accRangeArray[0].start, size); hint.mar.accRangeArray[0].isWrite = 1; if (gpfs_fcntl(file->fd, &hint)<0) - HGOTO_ERROR(H5E_FILE, H5E_FCNTL, NULL, "failed to send hints to GPFS"); + HGOTO_ERROR(H5E_FILE, H5E_FCNTL, NULL, "failed to send hints to GPFS") } #endif /* H5_HAVE_GPFS */ } @@ -1342,7 +1346,7 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, /* Seek to the correct location */ if ((addr!=file->pos || OP_WRITE!=file->op) && file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0) - HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position"); + HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") /* * Write the data, being careful of interrupted system calls and partial @@ -1353,7 +1357,7 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, nbytes = HDwrite(file->fd, buf, size); } while (-1==nbytes && EINTR==errno); if (-1==nbytes) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") assert(nbytes>0); assert((size_t)nbytes<=size); size -= nbytes; @@ -1377,11 +1381,11 @@ done: /* if only p<round> writes, need to broadcast the ret_value to other processes */ if ((type!=H5FD_MEM_DRAW) && H5_mpiposix_1_metawrite_g) { if (MPI_SUCCESS != (mpi_code= MPI_Bcast(&ret_value, sizeof(ret_value), MPI_BYTE, H5_PAR_META_WRITE, file->comm))) - HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_code) } /* end if */ } /* end else */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpiposix_write() */ @@ -1411,7 +1415,7 @@ H5FD_mpiposix_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned UNUSED closing int mpi_code; /* MPI return code */ herr_t ret_value=SUCCEED; - FUNC_ENTER_NOAPI(H5FD_mpiposix_flush, FAIL); + FUNC_ENTER_NOAPI(H5FD_mpiposix_flush, FAIL) assert(file); assert(H5FD_MPIPOSIX==file->pub.driver_id); @@ -1429,10 +1433,10 @@ H5FD_mpiposix_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned UNUSED closing li.QuadPart = file->eoa; SetFilePointer((HANDLE)filehandle,li.LowPart,&li.HighPart,FILE_BEGIN); if(SetEndOfFile((HANDLE)filehandle)==0) - HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly"); + HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") #else /* WIN32 */ if(-1==file_truncate(file->fd, (file_offset_t)file->eoa)) - HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly"); + HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") #endif /* WIN32 */ } /* end if */ @@ -1443,7 +1447,7 @@ H5FD_mpiposix_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned UNUSED closing * the new data written) */ if (MPI_SUCCESS!= (mpi_code=MPI_Barrier(file->comm))) - HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code) /* Update the 'last' eoa and eof values */ file->last_eoa=file->eoa; @@ -1455,7 +1459,7 @@ H5FD_mpiposix_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned UNUSED closing } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpiposix_flush() */ #endif /*H5_HAVE_PARALLEL*/ diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 4d8849a..e5f5f2e 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -26,6 +26,13 @@ #include <assert.h> #include <stdlib.h> +/* Disable certain warnings in PC-Lint: */ +/*lint --emacro( {534, 830}, H5P_DEFAULT, H5P_FILE_ACCESS, H5P_DATASET_XFER) */ +/*lint --emacro( {534, 830}, H5F_ACC_DEBUG) */ +/*lint --emacro( {534, 830}, H5F_ACC_RDWR) */ +/*lint --emacro( {534, 830}, H5FD_MULTI) */ +/*lint -esym( 534, H5Eclear, H5Epush) */ + #include "hdf5.h" /* @@ -35,17 +42,15 @@ */ #define H5FD_MULTI_DEBUG -/* Our versions of MIN and MAX */ +/* Our version of MAX */ #undef MAX #define MAX(X,Y) ((X)>(Y)?(X):(Y)) -#undef MIN -#define MIN(X,Y) ((X)<(Y)?(X):(Y)) #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE -#define TRUE (!FALSE) +#define TRUE 1 #endif /* Loop through all mapped files */ @@ -60,6 +65,7 @@ assert(LOOPVAR>0 && LOOPVAR<H5FD_MEM_NTYPES); \ if (_seen[LOOPVAR]++) continue; +#ifdef LATER #define MAPPED_MEMBERS(MAP,LOOPVAR) { \ H5FD_mem_t _unmapped, LOOPVAR; \ \ @@ -67,6 +73,7 @@ LOOPVAR = MAP[_unmapped]; \ if (H5FD_MEM_DEFAULT==LOOPVAR) LOOPVAR=_unmapped; \ assert(LOOPVAR>0 && LOOPVAR<H5FD_MEM_NTYPES); +#endif /* LATER */ #define ALL_MEMBERS(LOOPVAR) { \ H5FD_mem_t LOOPVAR; \ @@ -312,8 +319,7 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, memb_addr[H5FD_MEM_SUPER] = 0; memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2; - return H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, - TRUE); + return H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE); } @@ -400,7 +406,7 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, */ herr_t H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, - const hid_t *memb_fapl, const char **memb_name, + const hid_t *memb_fapl, const char * const *memb_name, const haddr_t *memb_addr, hbool_t relax) { H5FD_multi_fapl_t fa; @@ -420,18 +426,16 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, /* Check arguments and supply default values */ if(H5I_GENPROP_LST != H5Iget_type(fapl_id) || - TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) - H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "not an access list", -1); + TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) + H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "not an access list", -1) if (!memb_map) { - for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) { + for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) _memb_map[mt] = H5FD_MEM_DEFAULT; - } memb_map = _memb_map; } if (!memb_fapl) { - for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) { + for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) _memb_fapl[mt] = H5Pcreate(H5P_FILE_ACCESS); - } memb_fapl = _memb_fapl; } if (!memb_name) { @@ -443,9 +447,8 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, memb_name = _memb_name_ptrs; } if (!memb_addr) { - for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) { + for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) _memb_addr[mt] = (mt?mt-1:0) * HADDR_MAX/H5FD_MEM_NTYPES; - } memb_addr = _memb_addr; } @@ -453,7 +456,7 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, /* Map usage type */ mmt = memb_map[mt]; if (mmt<0 || mmt>=H5FD_MEM_NTYPES) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADRANGE, "file resource type out of range", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADRANGE, "file resource type out of range", -1) if (H5FD_MEM_DEFAULT==mmt) mmt = mt; /* @@ -461,11 +464,11 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, * access property lists. */ if (H5P_DEFAULT!=memb_fapl[mmt] && TRUE!=H5Pisa_class(memb_fapl[mmt], H5P_FILE_ACCESS)) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type incorrect", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type incorrect", -1) /* All names must be defined */ if (!memb_name[mmt] || !memb_name[mmt][0]) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type not set", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type not set", -1) } /* @@ -523,23 +526,21 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/, H5Eclear(H5E_DEFAULT); if(H5I_GENPROP_LST != H5Iget_type(fapl_id) || - TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) - H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not an access list", -1); + TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) + H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not an access list", -1) if (H5FD_MULTI!=H5Pget_driver(fapl_id)) - H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", -1) if (NULL==(fa=H5Pget_driver_info(fapl_id))) - H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1) - if (memb_map) { + if (memb_map) memcpy(memb_map, fa->memb_map, H5FD_MEM_NTYPES*sizeof(H5FD_mem_t)); - } if (memb_fapl) { for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) { - if (fa->memb_fapl[mt]>=0) { + if (fa->memb_fapl[mt]>=0) memb_fapl[mt] = H5Pcopy(fa->memb_fapl[mt]); - } else { + else memb_fapl[mt] = fa->memb_fapl[mt]; /*default or bad ID*/ - } } } if (memb_name) { @@ -547,17 +548,14 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/, if (fa->memb_name[mt]) { memb_name[mt] = malloc(strlen(fa->memb_name[mt])+1); strcpy(memb_name[mt], fa->memb_name[mt]); - } else { + } else memb_name[mt] = NULL; - } } } - if (memb_addr) { + if (memb_addr) memcpy(memb_addr, fa->memb_addr, H5FD_MEM_NTYPES*sizeof(haddr_t)); - } - if (relax) { + if (relax) *relax = fa->relax; - } return 0; } @@ -596,12 +594,12 @@ H5Pset_dxpl_multi(hid_t dxpl_id, const hid_t *memb_dxpl) /* Check arguments */ if (TRUE!=H5Pisa_class(dxpl_id, H5P_DATASET_XFER)) - H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a data transfer property list", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a data transfer property list", -1) if (!memb_dxpl) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "invalid pointer", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "invalid pointer", -1) for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) { if (memb_dxpl[mt]!=H5P_DEFAULT && TRUE!=H5Pisa_class(memb_dxpl[mt], H5P_DATASET_XFER)) - H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a data transfer property list", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a data transfer property list", -1) } /* Initialize the data transfer property list */ @@ -647,19 +645,18 @@ H5Pget_dxpl_multi(hid_t dxpl_id, hid_t *memb_dxpl/*out*/) H5Eclear(H5E_DEFAULT); if (TRUE!=H5Pisa_class(dxpl_id, H5P_DATASET_XFER)) - H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1) if (H5FD_MULTI!=H5Pget_driver(dxpl_id)) - H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", -1) if (NULL==(dx=H5Pget_driver_info(dxpl_id))) - H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1) if (memb_dxpl) { for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) { - if (dx->memb_dxpl[mt]>=0) { + if (dx->memb_dxpl[mt]>=0) memb_dxpl[mt] = H5Pcopy(dx->memb_dxpl[mt]); - } else { + else memb_dxpl[mt] = dx->memb_dxpl[mt]; /*default or bad ID */ - } } } @@ -756,9 +753,8 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/, strcpy(name, "NCSAmulti"); assert(7==H5FD_MEM_NTYPES); - for (m=H5FD_MEM_SUPER; m<H5FD_MEM_NTYPES; m=(H5FD_mem_t)(m+1)) { - buf[m-1] = file->fa.memb_map[m]; - } + for (m=H5FD_MEM_SUPER; m<H5FD_MEM_NTYPES; m=(H5FD_mem_t)(m+1)) + buf[m-1] = (unsigned char)file->fa.memb_map[m]; buf[7] = 0; buf[8] = 0; @@ -780,9 +776,8 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/, nseen++; } END_MEMBERS; if (H5Tconvert(H5T_NATIVE_HADDR, H5T_STD_U64LE, nseen*2, buf+8, NULL, - H5P_DEFAULT)<0) { - H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1); - } + H5P_DEFAULT)<0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1) /* Encode all name templates */ p = buf + 8 + nseen*2*8; @@ -840,7 +835,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) /* Make sure the name/version number is correct */ if (strcmp(name, "NCSAmult")) - H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "invalid multi superblock", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "invalid multi superblock", -1) /* Set default values */ ALL_MEMBERS(mt) { @@ -869,7 +864,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) memcpy(x, buf, (size_t)(nseen*2*8)); buf += nseen*2*8; if (H5Tconvert(H5T_STD_U64LE, H5T_NATIVE_HADDR, nseen*2, x, NULL, H5P_DEFAULT)<0) - H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1) ap = (haddr_t*)x; UNIQUE_MEMBERS(map, mt) { memb_addr[_unmapped] = *ap++; @@ -920,7 +915,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) fprintf(stderr, "H5FD_MULTI: close member %d\n", (int)mt); } #endif - H5FDclose(file->memb[mt]); + (void)H5FDclose(file->memb[mt]); file->memb[mt] = NULL; } file->fa.memb_map[mt] = map[mt]; @@ -937,17 +932,17 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) } } END_MEMBERS; if (compute_next(file)<0) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "compute_next() failed", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "compute_next() failed", -1) /* Open all necessary files */ if (open_members(file)<0) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "open_members() failed", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "open_members() failed", -1) /* Set the EOA marker for all open files */ UNIQUE_MEMBERS(file->fa.memb_map, mt) { - if (file->memb[mt]) { - H5FDset_eoa(file->memb[mt], memb_eoa[mt]); - } + if (file->memb[mt]) + if(H5FDset_eoa(file->memb[mt], memb_eoa[mt])<0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET, "set_eoa() failed", -1) } END_MEMBERS; return 0; @@ -1030,11 +1025,11 @@ H5FD_multi_fapl_copy(const void *_old_fa) if (nerrors) { for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) { - if (new_fa->memb_fapl[mt]>=0) H5Pclose(new_fa->memb_fapl[mt]); + if (new_fa->memb_fapl[mt]>=0) (void)H5Pclose(new_fa->memb_fapl[mt]); if (new_fa->memb_name[mt]) free(new_fa->memb_name[mt]); } free(new_fa); - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "invalid freespace objects", NULL); + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "invalid freespace objects", NULL) } return new_fa; } @@ -1061,15 +1056,20 @@ H5FD_multi_fapl_free(void *_fa) { H5FD_multi_fapl_t *fa = (H5FD_multi_fapl_t*)_fa; H5FD_mem_t mt; + static const char *func="H5FD_multi_fapl_free"; /* Function Name for error reporting */ /* Clear the error stack */ H5Eclear(H5E_DEFAULT); for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) { - if (fa->memb_fapl[mt]>=0) H5Pclose(fa->memb_fapl[mt]); - if (fa->memb_name[mt]) free(fa->memb_name[mt]); + if (fa->memb_fapl[mt]>=0) + if(H5Pclose(fa->memb_fapl[mt])<0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTCLOSEOBJ, "can't close property list", -1) + if (fa->memb_name[mt]) + free(fa->memb_name[mt]); } free(fa); + return 0; } @@ -1114,9 +1114,9 @@ H5FD_multi_dxpl_copy(const void *_old_dx) if (nerrors) { for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) - H5Pclose(new_dx->memb_dxpl[mt]); + (void)H5Pclose(new_dx->memb_dxpl[mt]); free(new_dx); - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "invalid freespace objects", NULL); + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "invalid freespace objects", NULL) } return new_dx; } @@ -1143,13 +1143,15 @@ H5FD_multi_dxpl_free(void *_dx) { H5FD_multi_dxpl_t *dx = (H5FD_multi_dxpl_t*)_dx; H5FD_mem_t mt; + static const char *func="H5FD_multi_dxpl_free"; /* Function Name for error reporting */ /* Clear the error stack */ H5Eclear(H5E_DEFAULT); for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) if (dx->memb_dxpl[mt]>=0) - H5Pclose(dx->memb_dxpl[mt]); + if(H5Pclose(dx->memb_dxpl[mt])<0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTCLOSEOBJ, "can't close property list", -1) free(dx); return 0; } @@ -1188,41 +1190,41 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, /* Check arguments */ if (!name || !*name) - H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADVALUE, "invalid file name", NULL); + H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADVALUE, "invalid file name", NULL) if (0==maxaddr || HADDR_UNDEF==maxaddr) - H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADRANGE, "bogus maxaddr", NULL); + H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADRANGE, "bogus maxaddr", NULL) /* * Initialize the file from the file access properties, using default * values if necessary. */ if (NULL==(file=calloc(1, sizeof(H5FD_multi_t)))) - H5Epush_ret(func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL); + H5Epush_ret(func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL) if (H5P_FILE_ACCESS_DEFAULT==fapl_id || H5FD_MULTI!=H5Pget_driver(fapl_id)) { close_fapl = fapl_id = H5Pcreate(H5P_FILE_ACCESS); - H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, TRUE); + if(H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, TRUE)<0) + H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTSET, "can't set property value", error) } fa = H5Pget_driver_info(fapl_id); assert(fa); ALL_MEMBERS(mt) { file->fa.memb_map[mt] = fa->memb_map[mt]; file->fa.memb_addr[mt] = fa->memb_addr[mt]; - if (fa->memb_fapl[mt]>=0) { + if (fa->memb_fapl[mt]>=0) file->fa.memb_fapl[mt] = H5Pcopy(fa->memb_fapl[mt]); - } else { + else file->fa.memb_fapl[mt] = fa->memb_fapl[mt]; - } - if (fa->memb_name[mt]) { + if (fa->memb_name[mt]) file->fa.memb_name[mt] = my_strdup(fa->memb_name[mt]); - } else { + else file->fa.memb_name[mt] = NULL; - } } END_MEMBERS; file->fa.relax = fa->relax; file->flags = flags; file->name = my_strdup(name); if (close_fapl>=0) - H5Pclose(close_fapl); + if(H5Pclose(close_fapl)<0) + H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTCLOSEOBJ, "can't close property list", error) /* Compute derived properties and open member files */ if (compute_next(file)<0) @@ -1231,18 +1233,19 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, H5Epush_goto(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "open_members() failed", error); /* We must have opened at least the superblock file */ - if (H5FD_MEM_DEFAULT==(m=file->fa.memb_map[H5FD_MEM_SUPER])) { + if (H5FD_MEM_DEFAULT==(m=file->fa.memb_map[H5FD_MEM_SUPER])) m = H5FD_MEM_SUPER; - } - if (NULL==file->memb[m]) goto error; + if (NULL==file->memb[m]) + goto error; + return (H5FD_t*)file; error: /* Cleanup and fail */ if (file) { ALL_MEMBERS(mt) { - if (file->memb[mt]) H5FDclose(file->memb[mt]); - if (file->fa.memb_fapl[mt]>=0) H5Pclose(file->fa.memb_fapl[mt]); + if (file->memb[mt]) (void)H5FDclose(file->memb[mt]); + if (file->fa.memb_fapl[mt]>=0) (void)H5Pclose(file->fa.memb_fapl[mt]); if (file->fa.memb_name[mt]) free(file->fa.memb_name[mt]); } END_MEMBERS; if (file->name) free(file->name); @@ -1301,11 +1304,11 @@ H5FD_multi_close(H5FD_t *_file) } } END_MEMBERS; if (nerrors) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error closing member files", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error closing member files", -1) /* Clean up other stuff */ ALL_MEMBERS(mt) { - if (file->fa.memb_fapl[mt]>=0) H5Pclose(file->fa.memb_fapl[mt]); + if (file->fa.memb_fapl[mt]>=0) (void)H5Pclose(file->fa.memb_fapl[mt]); if (file->fa.memb_name[mt]) free(file->fa.memb_name[mt]); } END_MEMBERS; free(file->name); @@ -1472,7 +1475,7 @@ H5FD_multi_set_eoa(H5FD_t *_file, haddr_t eoa) status = H5FDset_eoa(file->memb[mmt], eoa-file->fa.memb_addr[mmt]); } H5E_END_TRY; if (status<0) - H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "member H5FDset_eoa failed", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "member H5FDset_eoa failed", -1) } /* Save new eoa for return later */ @@ -1516,7 +1519,7 @@ H5FD_multi_get_eof(H5FD_t *_file) tmp = H5FDget_eof(file->memb[mt]); } H5E_END_TRY; if (HADDR_UNDEF==tmp) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eof", HADDR_UNDEF); + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eof", HADDR_UNDEF) if (tmp>0) tmp += file->fa.memb_addr[mt]; } else if (file->fa.relax) { @@ -1528,7 +1531,7 @@ H5FD_multi_get_eof(H5FD_t *_file) assert(HADDR_UNDEF!=tmp); } else { - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eof", HADDR_UNDEF); + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eof", HADDR_UNDEF) } if (tmp>eof) eof = tmp; @@ -1561,9 +1564,9 @@ H5FD_multi_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) /* Get data type for multi driver */ if(H5Pget_multi_type(fapl, &type) < 0) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "can't get data type for multi driver", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "can't get data type for multi driver", -1) if(type<H5FD_MEM_DEFAULT || type>=H5FD_MEM_NTYPES) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "data type is out of range", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "data type is out of range", -1) mmt = file->fa.memb_map[type]; if(H5FD_MEM_DEFAULT==mmt) mmt = type; @@ -1599,7 +1602,7 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) if (H5FD_MEM_DEFAULT==mmt) mmt = type; if (HADDR_UNDEF==(addr=H5FDalloc(file->memb[mmt], type, dxpl_id, size))) { - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file can't alloc", HADDR_UNDEF); + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file can't alloc", HADDR_UNDEF) } addr += file->fa.memb_addr[mmt]; if (addr+size>file->eoa) file->eoa = addr+size; @@ -1820,7 +1823,7 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) } } if (nerrors) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error flushing member files", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error flushing member files", -1) return 0; } @@ -1924,7 +1927,7 @@ open_members(H5FD_multi_t *file) } } END_MEMBERS; if (nerrors) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error opening member files", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error opening member files", -1) return 0; } diff --git a/src/H5FDmulti.h b/src/H5FDmulti.h index 8768390..8250f4e 100644 --- a/src/H5FDmulti.h +++ b/src/H5FDmulti.h @@ -32,7 +32,7 @@ extern "C" { #endif H5_DLL hid_t H5FD_multi_init(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 **memb_name, + const hid_t *memb_fapl, const char * const *memb_name, const haddr_t *memb_addr, hbool_t relax); H5_DLL herr_t H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/, hid_t *memb_fapl/*out*/, char **memb_name/*out*/, @@ -1730,7 +1730,7 @@ static H5G_t * H5G_create(H5G_entry_t *loc, const char *name, size_t size_hint, hid_t dxpl_id) { H5G_t *grp = NULL; /*new group */ - H5F_t *file; /* File new group will be in */ + H5F_t *file = NULL; /* File new group will be in */ unsigned stab_init=0; /* Flag to indicate that the symbol stable was created successfully */ H5G_t *ret_value; /* Return value */ diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 01dba0a..d147977 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -999,8 +999,7 @@ H5S_mpio_spaces_write(H5F_t *f, H5O_layout_t *layout, /*OKAY: CAST DISCARDS CONST QUALIFIER*/ ret_value = H5S_mpio_spaces_xfer(f, layout, elmt_size, - file_space, mem_space, dxpl_id, - (void*)buf, 1/*write*/); + file_space, mem_space, dxpl_id, (void*)buf, 1/*write*/); done: FUNC_LEAVE_NOAPI(ret_value); diff --git a/src/hdf5.lnt b/src/hdf5.lnt index eb433bd..ad2a447 100755 --- a/src/hdf5.lnt +++ b/src/hdf5.lnt @@ -12,7 +12,11 @@ -esym(528, H5V_vector_cmp, H5V_vector_cmp_s, H5V_vector_cmp_u) -esym(528, H5V_vector_zerop_s, H5V_vector_zerop_u) -// Turn off warnings about not "Expression-like macro not parenthesized" for +// Turn off warnings about "Ignoring return value of function" for +// H5open() in public error macros +-emacro(534, H5Epush_ret, H5Epush_goto) + +// Turn off warnings about "Expression-like macro not parenthesized" for // enumerated type increment & decrement macros: -esym(773, H5_INC_ENUM, H5_DEC_ENUM) @@ -20,7 +24,7 @@ -esym(750, PABLO_MASK) // Suppress message about our use of 'goto' in our error macros --emacro(801,HGOTO_DONE) +-emacro(801,HGOTO_DONE, H5Epush_goto) // Suppress message about using 'goto' in a few functions -efunc(801,H5_term_library,H5_trace) @@ -81,6 +85,7 @@ H5FDcore.c H5FDfamily.c H5FDlog.c + H5FDmulti.c H5V.c H5Z.c @@ -93,4 +98,6 @@ macros cleaned up and the PABLO_MASK adjusted, but have not been linted: H5FDfphdf5.c H5FDgass.c + H5FDmpio.c + H5FDmpiposix.c */ |