diff options
Diffstat (limited to 'src/H5FDsplitter.c')
-rw-r--r-- | src/H5FDsplitter.c | 538 |
1 files changed, 253 insertions, 285 deletions
diff --git a/src/H5FDsplitter.c b/src/H5FDsplitter.c index d0ed250d..5ba1a27 100644 --- a/src/H5FDsplitter.c +++ b/src/H5FDsplitter.c @@ -19,36 +19,36 @@ /* This source code file is part of the H5FD driver module */ #include "H5FDdrvr_module.h" -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5FDsplitter.h" /* Splitter file driver */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FDsplitter.h" /* Splitter file driver */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ /* The driver identification number, initialized at runtime */ static hid_t H5FD_SPLITTER_g = 0; /* Driver-specific file access properties */ typedef struct H5FD_splitter_fapl_t { - hid_t rw_fapl_id; /* fapl for the R/W channel */ - hid_t wo_fapl_id; /* fapl for the W/O channel */ - char wo_path[H5FD_SPLITTER_PATH_MAX + 1]; /* file name for the W/O channel */ - char log_file_path[H5FD_SPLITTER_PATH_MAX + 1]; /* file to record errors reported by the W/O channel */ - hbool_t ignore_wo_errs; /* TRUE to ignore errors on the W/O channel */ + hid_t rw_fapl_id; /* fapl for the R/W channel */ + hid_t wo_fapl_id; /* fapl for the W/O channel */ + char wo_path[H5FD_SPLITTER_PATH_MAX + 1]; /* file name for the W/O channel */ + char log_file_path[H5FD_SPLITTER_PATH_MAX + 1]; /* file to record errors reported by the W/O channel */ + hbool_t ignore_wo_errs; /* TRUE to ignore errors on the W/O channel */ } H5FD_splitter_fapl_t; /* The information of this splitter */ typedef struct H5FD_splitter_t { - H5FD_t pub; /* public stuff, must be first */ - unsigned version; /* version of the H5FD_splitter_vfd_config_t structure used */ - H5FD_splitter_fapl_t fa; /* driver-specific file access properties */ - H5FD_t *rw_file; /* pointer of R/W channel */ - H5FD_t *wo_file; /* pointer of W/O channel */ - FILE *logfp; /* Log file pointer */ + H5FD_t pub; /* public stuff, must be first */ + unsigned version; /* version of the H5FD_splitter_vfd_config_t structure used */ + H5FD_splitter_fapl_t fa; /* driver-specific file access properties */ + H5FD_t * rw_file; /* pointer of R/W channel */ + H5FD_t * wo_file; /* pointer of W/O channel */ + FILE * logfp; /* Log file pointer */ } H5FD_splitter_t; /* @@ -66,101 +66,103 @@ typedef struct H5FD_splitter_t { * which can be addressed entirely by the second * argument of the file seek function. */ -#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) -#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR)) -#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) -#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ - HADDR_UNDEF==(A)+(Z) || \ - (HDoff_t)((A)+(Z))<(HDoff_t)(A)) +#define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) +#define ADDR_OVERFLOW(A) (HADDR_UNDEF == (A) || ((A) & ~(haddr_t)MAXADDR)) +#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) +#define REGION_OVERFLOW(A, Z) \ + (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || HADDR_UNDEF == (A) + (Z) || (HDoff_t)((A) + (Z)) < (HDoff_t)(A)) /* This macro provides a wrapper for shared fail-log-ignore behavior * for errors arising in the splitter's W/O channel. * Logs an error entry in a log file, if the file exists. * If not set to ignore errors, registers an error with the library. */ -#define H5FD_SPLITTER_WO_ERROR(file, funcname, errmajor, errminor, ret, mesg) \ -{ \ - H5FD__splitter_log_error((file), (funcname), (mesg)); \ - if(FALSE == (file)->fa.ignore_wo_errs) \ - HGOTO_ERROR((errmajor), (errminor), (ret), (mesg)) \ -} +#define H5FD_SPLITTER_WO_ERROR(file, funcname, errmajor, errminor, ret, mesg) \ + { \ + H5FD__splitter_log_error((file), (funcname), (mesg)); \ + if (FALSE == (file)->fa.ignore_wo_errs) \ + HGOTO_ERROR((errmajor), (errminor), (ret), (mesg)) \ + } #define H5FD_SPLITTER_DEBUG_OP_CALLS 0 /* debugging print toggle; 0 disables */ #if H5FD_SPLITTER_DEBUG_OP_CALLS -#define H5FD_SPLITTER_LOG_CALL(name) do { \ - HDprintf("called %s()\n", (name)); \ - HDfflush(stdout); \ -} while (0) +#define H5FD_SPLITTER_LOG_CALL(name) \ + do { \ + HDprintf("called %s()\n", (name)); \ + HDfflush(stdout); \ + } while (0) #else #define H5FD_SPLITTER_LOG_CALL(name) /* no-op */ -#endif /* H5FD_SPLITTER_DEBUG_OP_CALLS */ +#endif /* H5FD_SPLITTER_DEBUG_OP_CALLS */ /* Private functions */ /* Print error messages from W/O channel to log file */ static herr_t H5FD__splitter_log_error(const H5FD_splitter_t *file, const char *atfunc, const char *msg); -static int H5FD__copy_plist(hid_t fapl_id, hid_t *id_out_ptr); +static int H5FD__copy_plist(hid_t fapl_id, hid_t *id_out_ptr); /* Prototypes */ -static herr_t H5FD__splitter_term(void); +static herr_t H5FD__splitter_term(void); static hsize_t H5FD__splitter_sb_size(H5FD_t *_file); -static herr_t H5FD__splitter_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out*/); -static herr_t H5FD__splitter_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf); -static void *H5FD__splitter_fapl_get(H5FD_t *_file); -static void *H5FD__splitter_fapl_copy(const void *_old_fa); -static herr_t H5FD__splitter_fapl_free(void *_fapl); +static herr_t H5FD__splitter_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out*/); +static herr_t H5FD__splitter_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf); +static void * H5FD__splitter_fapl_get(H5FD_t *_file); +static void * H5FD__splitter_fapl_copy(const void *_old_fa); +static herr_t H5FD__splitter_fapl_free(void *_fapl); static H5FD_t *H5FD__splitter_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static herr_t H5FD__splitter_close(H5FD_t *_file); -static int H5FD__splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2); -static herr_t H5FD__splitter_query(const H5FD_t *_file, unsigned long *flags /* out */); -static herr_t H5FD__splitter_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map); +static herr_t H5FD__splitter_close(H5FD_t *_file); +static int H5FD__splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2); +static herr_t H5FD__splitter_query(const H5FD_t *_file, unsigned long *flags /* out */); +static herr_t H5FD__splitter_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map); static haddr_t H5FD__splitter_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); -static herr_t H5FD__splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); +static herr_t H5FD__splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); static haddr_t H5FD__splitter_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type); -static herr_t H5FD__splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr); +static herr_t H5FD__splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr); static haddr_t H5FD__splitter_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type); -static herr_t H5FD__splitter_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void** file_handle); -static herr_t H5FD__splitter_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf); -static herr_t H5FD__splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD__splitter_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD__splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD__splitter_lock(H5FD_t *_file, hbool_t rw); -static herr_t H5FD__splitter_unlock(H5FD_t *_file); +static herr_t H5FD__splitter_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handle); +static herr_t H5FD__splitter_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, + void *buf); +static herr_t H5FD__splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, + const void *buf); +static herr_t H5FD__splitter_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__splitter_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD__splitter_unlock(H5FD_t *_file); static const H5FD_class_t H5FD_splitter_g = { - "splitter", /* name */ - MAXADDR, /* maxaddr */ - H5F_CLOSE_WEAK, /* fc_degree */ - H5FD__splitter_term, /* terminate */ - H5FD__splitter_sb_size, /* sb_size */ - H5FD__splitter_sb_encode, /* sb_encode */ - H5FD__splitter_sb_decode, /* sb_decode */ + "splitter", /* name */ + MAXADDR, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + H5FD__splitter_term, /* terminate */ + H5FD__splitter_sb_size, /* sb_size */ + H5FD__splitter_sb_encode, /* sb_encode */ + H5FD__splitter_sb_decode, /* sb_decode */ sizeof(H5FD_splitter_fapl_t), /* fapl_size */ - H5FD__splitter_fapl_get, /* fapl_get */ - H5FD__splitter_fapl_copy, /* fapl_copy */ - H5FD__splitter_fapl_free, /* fapl_free */ - 0, /* dxpl_size */ - NULL, /* dxpl_copy */ - NULL, /* dxpl_free */ - H5FD__splitter_open, /* open */ - H5FD__splitter_close, /* close */ - H5FD__splitter_cmp, /* cmp */ - H5FD__splitter_query, /* query */ - H5FD__splitter_get_type_map, /* get_type_map */ - H5FD__splitter_alloc, /* alloc */ - H5FD__splitter_free, /* free */ - H5FD__splitter_get_eoa, /* get_eoa */ - H5FD__splitter_set_eoa, /* set_eoa */ - H5FD__splitter_get_eof, /* get_eof */ - H5FD__splitter_get_handle, /* get_handle */ - H5FD__splitter_read, /* read */ - H5FD__splitter_write, /* write */ - H5FD__splitter_flush, /* flush */ - H5FD__splitter_truncate, /* truncate */ - H5FD__splitter_lock, /* lock */ - H5FD__splitter_unlock, /* unlock */ - H5FD_FLMAP_DICHOTOMY /* fl_map */ + H5FD__splitter_fapl_get, /* fapl_get */ + H5FD__splitter_fapl_copy, /* fapl_copy */ + H5FD__splitter_fapl_free, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD__splitter_open, /* open */ + H5FD__splitter_close, /* close */ + H5FD__splitter_cmp, /* cmp */ + H5FD__splitter_query, /* query */ + H5FD__splitter_get_type_map, /* get_type_map */ + H5FD__splitter_alloc, /* alloc */ + H5FD__splitter_free, /* free */ + H5FD__splitter_get_eoa, /* get_eoa */ + H5FD__splitter_set_eoa, /* set_eoa */ + H5FD__splitter_get_eof, /* get_eof */ + H5FD__splitter_get_handle, /* get_handle */ + H5FD__splitter_read, /* read */ + H5FD__splitter_write, /* write */ + H5FD__splitter_flush, /* flush */ + H5FD__splitter_truncate, /* truncate */ + H5FD__splitter_lock, /* lock */ + H5FD__splitter_unlock, /* unlock */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ }; /* Declare a free list to manage the H5FD_splitter_t struct */ @@ -169,7 +171,6 @@ H5FL_DEFINE_STATIC(H5FD_splitter_t); /* Declare a free list to manage the H5FD_splitter_fapl_t struct */ H5FL_DEFINE_STATIC(H5FD_splitter_fapl_t); - /*------------------------------------------------------------------------- * Function: H5FD__init_package * @@ -187,14 +188,13 @@ H5FD__init_package(void) H5FD_SPLITTER_LOG_CALL(FUNC); - if(H5FD_splitter_init() < 0) + if (H5FD_splitter_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize splitter VFD") done: FUNC_LEAVE_NOAPI(ret_value) } /* H5FD__init_package() */ - /*------------------------------------------------------------------------- * Function: H5FD_splitter_init * @@ -214,7 +214,7 @@ H5FD_splitter_init(void) H5FD_SPLITTER_LOG_CALL(FUNC); - if(H5I_VFL != H5I_get_type(H5FD_SPLITTER_g)) + if (H5I_VFL != H5I_get_type(H5FD_SPLITTER_g)) H5FD_SPLITTER_g = H5FDregister(&H5FD_splitter_g); ret_value = H5FD_SPLITTER_g; @@ -223,7 +223,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_splitter_init() */ - /*--------------------------------------------------------------------------- * Function: H5FD__splitter_term * @@ -245,8 +244,7 @@ H5FD__splitter_term(void) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD__splitter_term() */ - - /*------------------------------------------------------------------------- +/*------------------------------------------------------------------------- * Function: H5FD__copy_plist * * Purpose: Sanity-wrapped H5P_copy_plist() for each channel. @@ -256,11 +254,10 @@ H5FD__splitter_term(void) *------------------------------------------------------------------------- */ static int -H5FD__copy_plist(hid_t fapl_id, - hid_t *id_out_ptr) +H5FD__copy_plist(hid_t fapl_id, hid_t *id_out_ptr) { - int ret_value = 0; - H5P_genplist_t *plist_ptr = NULL; + int ret_value = 0; + H5P_genplist_t *plist_ptr = NULL; FUNC_ENTER_STATIC @@ -268,22 +265,21 @@ H5FD__copy_plist(hid_t fapl_id, HDassert(id_out_ptr != NULL); - if(FALSE == H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) + if (FALSE == H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, -1, "not a file access property list"); plist_ptr = (H5P_genplist_t *)H5I_object(fapl_id); - if(NULL == plist_ptr) + if (NULL == plist_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, -1, "unable to get property list"); *id_out_ptr = H5P_copy_plist(plist_ptr, FALSE); - if(H5I_INVALID_HID == *id_out_ptr) + if (H5I_INVALID_HID == *id_out_ptr) HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, -1, "unable to copy file access property list"); done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD__copy_plist() */ - /*------------------------------------------------------------------------- * Function: H5Pset_fapl_splitter * @@ -296,8 +292,8 @@ done: herr_t H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *vfd_config) { - H5FD_splitter_fapl_t *info = NULL; - H5P_genplist_t *plist_ptr = NULL; + H5FD_splitter_fapl_t *info = NULL; + H5P_genplist_t * plist_ptr = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) @@ -305,11 +301,11 @@ H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *vfd_config) H5FD_SPLITTER_LOG_CALL(FUNC); - if(H5FD_SPLITTER_MAGIC != vfd_config->magic) + if (H5FD_SPLITTER_MAGIC != vfd_config->magic) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid configuration (magic number mismatch)") - if(H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION != vfd_config->version) + if (H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION != vfd_config->version) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid config (version number mismatch)") - if(NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(fapl_id))) + if (NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid property list") /* Make sure that the W/O channel supports write-only capability. @@ -318,28 +314,28 @@ H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *vfd_config) * Uses the feature flag H5FD_FEAT_DEFAULT_VFD_COMPATIBLE as the * determining attribute. */ - if(H5P_DEFAULT != vfd_config->wo_fapl_id) { - H5FD_class_t *wo_driver = NULL; - H5FD_driver_prop_t wo_driver_prop; - H5P_genplist_t *wo_plist_ptr = NULL; - unsigned long wo_driver_flags = 0; + if (H5P_DEFAULT != vfd_config->wo_fapl_id) { + H5FD_class_t * wo_driver = NULL; + H5FD_driver_prop_t wo_driver_prop; + H5P_genplist_t * wo_plist_ptr = NULL; + unsigned long wo_driver_flags = 0; wo_plist_ptr = (H5P_genplist_t *)H5I_object(vfd_config->wo_fapl_id); - if(NULL == wo_plist_ptr) + if (NULL == wo_plist_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - if(H5P_peek(wo_plist_ptr, H5F_ACS_FILE_DRV_NAME, &wo_driver_prop) < 0) + if (H5P_peek(wo_plist_ptr, H5F_ACS_FILE_DRV_NAME, &wo_driver_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID & info") wo_driver = (H5FD_class_t *)H5I_object(wo_driver_prop.driver_id); - if(NULL == wo_driver) + if (NULL == wo_driver) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid driver ID in file access property list") - if(H5FD_driver_query(wo_driver, &wo_driver_flags) < 0) + if (H5FD_driver_query(wo_driver, &wo_driver_flags) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't query VFD flags") - if(0 == (H5FD_FEAT_DEFAULT_VFD_COMPATIBLE & wo_driver_flags)) + if (0 == (H5FD_FEAT_DEFAULT_VFD_COMPATIBLE & wo_driver_flags)) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "unsuitable W/O driver") } /* end if W/O VFD is non-default */ info = H5FL_CALLOC(H5FD_splitter_fapl_t); - if(NULL == info) + if (NULL == info) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate file access property list struct") info->ignore_wo_errs = vfd_config->ignore_wo_errs; @@ -349,13 +345,13 @@ H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *vfd_config) info->wo_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */ /* Set non-default channel FAPL IDs in splitter configuration info */ - if(H5P_DEFAULT != vfd_config->rw_fapl_id) { - if(FALSE == H5P_isa_class(vfd_config->rw_fapl_id, H5P_FILE_ACCESS)) + if (H5P_DEFAULT != vfd_config->rw_fapl_id) { + if (FALSE == H5P_isa_class(vfd_config->rw_fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") info->rw_fapl_id = vfd_config->rw_fapl_id; } - if(H5P_DEFAULT != vfd_config->wo_fapl_id) { - if(FALSE == H5P_isa_class(vfd_config->wo_fapl_id, H5P_FILE_ACCESS)) + if (H5P_DEFAULT != vfd_config->wo_fapl_id) { + if (FALSE == H5P_isa_class(vfd_config->wo_fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") info->wo_fapl_id = vfd_config->wo_fapl_id; } @@ -363,13 +359,12 @@ H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *vfd_config) ret_value = H5P_set_driver(plist_ptr, H5FD_SPLITTER, info); done: - if(info) + if (info) info = H5FL_FREE(H5FD_splitter_fapl_t, info); FUNC_LEAVE_API(ret_value) } /* end H5Pset_fapl_splitter() */ - /*------------------------------------------------------------------------- * Function: H5Pget_fapl_splitter * @@ -386,7 +381,7 @@ herr_t H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config_out) { const H5FD_splitter_fapl_t *fapl_ptr = NULL; - H5P_genplist_t *plist_ptr = NULL; + H5P_genplist_t * plist_ptr = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) @@ -395,13 +390,13 @@ H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config_out) H5FD_SPLITTER_LOG_CALL(FUNC); /* Check arguments */ - if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) + if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - if(config_out == NULL) + if (config_out == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "config_out pointer is null") - if(H5FD_SPLITTER_MAGIC != config_out->magic) + if (H5FD_SPLITTER_MAGIC != config_out->magic) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "info-out pointer invalid (magic number mismatch)") - if(H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION != config_out->version) + if (H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION != config_out->version) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "info-out pointer invalid (version unsafe)") /* Pre-set out FAPL IDs with intent to replace these values */ @@ -409,11 +404,11 @@ H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config_out) config_out->wo_fapl_id = H5I_INVALID_HID; /* Check and get the splitter fapl */ - if(NULL == (plist_ptr = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) + if (NULL == (plist_ptr = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - if(H5FD_SPLITTER != H5P_peek_driver(plist_ptr)) + if (H5FD_SPLITTER != H5P_peek_driver(plist_ptr)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") - if(NULL == (fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist_ptr))) + if (NULL == (fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist_ptr))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unable to get specific-driver info") HDstrncpy(config_out->wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX); @@ -421,16 +416,15 @@ H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config_out) config_out->ignore_wo_errs = fapl_ptr->ignore_wo_errs; /* Copy R/W and W/O FAPLs */ - if(H5FD__copy_plist(fapl_ptr->rw_fapl_id, &(config_out->rw_fapl_id)) < 0) + if (H5FD__copy_plist(fapl_ptr->rw_fapl_id, &(config_out->rw_fapl_id)) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't copy R/W FAPL"); - if(H5FD__copy_plist(fapl_ptr->wo_fapl_id, &(config_out->wo_fapl_id)) < 0) + if (H5FD__copy_plist(fapl_ptr->wo_fapl_id, &(config_out->wo_fapl_id)) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't copy W/O FAPL"); done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_fapl_splitter() */ - /*------------------------------------------------------------------------- * Function: H5FD__splitter_flush * @@ -442,24 +436,23 @@ done: static herr_t H5FD__splitter_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) { - H5FD_splitter_t *file = (H5FD_splitter_t *)_file; - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_splitter_t *file = (H5FD_splitter_t *)_file; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC H5FD_SPLITTER_LOG_CALL(FUNC); /* Public API for dxpl "context" */ - if(H5FDflush(file->rw_file, dxpl_id, closing) < 0) + if (H5FDflush(file->rw_file, dxpl_id, closing) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush R/W file") - if(H5FDflush(file->wo_file, dxpl_id, closing) < 0) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush W/O file") + if (H5FDflush(file->wo_file, dxpl_id, closing) < 0) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush W/O file") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_flush() */ - /*------------------------------------------------------------------------- * Function: H5FD__splitter_read * @@ -475,11 +468,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD__splitter_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, - hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, void *buf) +H5FD__splitter_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, + size_t size, void *buf) { - H5FD_splitter_t *file = (H5FD_splitter_t *)_file; - herr_t ret_value = SUCCEED; + H5FD_splitter_t *file = (H5FD_splitter_t *)_file; + herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC @@ -489,21 +482,20 @@ H5FD__splitter_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, HDassert(buf); /* Check for overflow conditions */ - if(!H5F_addr_defined(addr)) + if (!H5F_addr_defined(addr)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr) - if(REGION_OVERFLOW(addr, size)) + if (REGION_OVERFLOW(addr, size)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr) /* Only read from R/W channel */ /* Public API for dxpl "context" */ - if(H5FDread(file->rw_file, type, dxpl_id, addr, size, buf) < 0) + if (H5FDread(file->rw_file, type, dxpl_id, addr, size, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "Reading from R/W channel failed") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_read() */ - /*------------------------------------------------------------------------- * Function: H5FD__splitter_write * @@ -515,32 +507,31 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD__splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, - haddr_t addr, size_t size, const void *buf) +H5FD__splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, + const void *buf) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; - H5P_genplist_t *plist_ptr = NULL; + H5P_genplist_t * plist_ptr = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC H5FD_SPLITTER_LOG_CALL(FUNC); - if(NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(dxpl_id))) + if (NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") /* Write to each file */ /* Public API for dxpl "context" */ - if(H5FDwrite(file->rw_file, type, dxpl_id, addr, size, buf) < 0) + if (H5FDwrite(file->rw_file, type, dxpl_id, addr, size, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "R/W file write failed") - if(H5FDwrite(file->wo_file, type, dxpl_id, addr, size, buf) < 0) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write W/O file") + if (H5FDwrite(file->wo_file, type, dxpl_id, addr, size, buf) < 0) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write W/O file") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_write() */ - /*------------------------------------------------------------------------- * Function: H5FD__splitter_fapl_get * @@ -557,7 +548,7 @@ static void * H5FD__splitter_fapl_get(H5FD_t *_file) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; - void *ret_value = NULL; + void * ret_value = NULL; FUNC_ENTER_STATIC_NOERR @@ -568,7 +559,6 @@ H5FD__splitter_fapl_get(H5FD_t *_file) FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_fapl_get() */ - /*------------------------------------------------------------------------- * Function: H5FD__splitter_fapl_copy * @@ -582,8 +572,8 @@ static void * H5FD__splitter_fapl_copy(const void *_old_fa) { const H5FD_splitter_fapl_t *old_fa_ptr = (const H5FD_splitter_fapl_t *)_old_fa; - H5FD_splitter_fapl_t *new_fa_ptr = NULL; - void *ret_value = NULL; + H5FD_splitter_fapl_t * new_fa_ptr = NULL; + void * ret_value = NULL; FUNC_ENTER_STATIC @@ -592,7 +582,7 @@ H5FD__splitter_fapl_copy(const void *_old_fa) HDassert(old_fa_ptr); new_fa_ptr = H5FL_CALLOC(H5FD_splitter_fapl_t); - if(NULL == new_fa_ptr) + if (NULL == new_fa_ptr) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate log file FAPL") HDmemcpy(new_fa_ptr, old_fa_ptr, sizeof(H5FD_splitter_fapl_t)); @@ -600,22 +590,21 @@ H5FD__splitter_fapl_copy(const void *_old_fa) HDstrncpy(new_fa_ptr->log_file_path, old_fa_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX); /* Copy R/W and W/O FAPLs */ - if(H5FD__copy_plist(old_fa_ptr->rw_fapl_id, &(new_fa_ptr->rw_fapl_id)) < 0) + if (H5FD__copy_plist(old_fa_ptr->rw_fapl_id, &(new_fa_ptr->rw_fapl_id)) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy R/W FAPL"); - if(H5FD__copy_plist(old_fa_ptr->wo_fapl_id, &(new_fa_ptr->wo_fapl_id)) < 0) + if (H5FD__copy_plist(old_fa_ptr->wo_fapl_id, &(new_fa_ptr->wo_fapl_id)) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy W/O FAPL"); ret_value = (void *)new_fa_ptr; done: - if(NULL == ret_value) - if(new_fa_ptr) + if (NULL == ret_value) + if (new_fa_ptr) new_fa_ptr = H5FL_FREE(H5FD_splitter_fapl_t, new_fa_ptr); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_fapl_copy() */ - /*-------------------------------------------------------------------------- * Function: H5FD__splitter_fapl_free * @@ -627,7 +616,7 @@ done: static herr_t H5FD__splitter_fapl_free(void *_fapl) { - H5FD_splitter_fapl_t *fapl = (H5FD_splitter_fapl_t*)_fapl; + H5FD_splitter_fapl_t *fapl = (H5FD_splitter_fapl_t *)_fapl; herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC @@ -637,9 +626,9 @@ H5FD__splitter_fapl_free(void *_fapl) /* Check arguments */ HDassert(fapl); - if(H5I_dec_ref(fapl->rw_fapl_id) < 0) + if (H5I_dec_ref(fapl->rw_fapl_id) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close R/W FAPL ID") - if(H5I_dec_ref(fapl->wo_fapl_id) < 0) + if (H5I_dec_ref(fapl->wo_fapl_id) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close W/O FAPL ID") /* Free the property list */ @@ -649,7 +638,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_fapl_free() */ - /*------------------------------------------------------------------------- * Function: H5FD__splitter_open * @@ -664,39 +652,38 @@ done: static H5FD_t * H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, haddr_t maxaddr) { - H5FD_splitter_t *file_ptr = NULL; /* Splitter VFD info */ + H5FD_splitter_t * file_ptr = NULL; /* Splitter VFD info */ const H5FD_splitter_fapl_t *fapl_ptr = NULL; /* Driver-specific property list */ - H5P_genplist_t *plist_ptr = NULL; - H5FD_t *ret_value = NULL; + H5P_genplist_t * plist_ptr = NULL; + H5FD_t * ret_value = NULL; FUNC_ENTER_STATIC H5FD_SPLITTER_LOG_CALL(FUNC); /* Check arguments */ - if(!name || !*name) + if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name") - if(0 == maxaddr || HADDR_UNDEF == maxaddr) + if (0 == maxaddr || HADDR_UNDEF == maxaddr) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") - if(ADDR_OVERFLOW(maxaddr)) + if (ADDR_OVERFLOW(maxaddr)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr") - if((H5P_FILE_ACCESS_DEFAULT == splitter_fapl_id) || - (H5FD_SPLITTER != H5Pget_driver(splitter_fapl_id)) ) + if ((H5P_FILE_ACCESS_DEFAULT == splitter_fapl_id) || (H5FD_SPLITTER != H5Pget_driver(splitter_fapl_id))) /* presupposes that H5P_FILE_ACCESS_DEFAULT is not a splitter */ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "driver is not splitter") file_ptr = (H5FD_splitter_t *)H5FL_CALLOC(H5FD_splitter_t); - if(NULL == file_ptr) + if (NULL == file_ptr) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file struct") file_ptr->fa.rw_fapl_id = H5I_INVALID_HID; file_ptr->fa.wo_fapl_id = H5I_INVALID_HID; /* Get the driver-specific file access properties */ plist_ptr = (H5P_genplist_t *)H5I_object(splitter_fapl_id); - if(NULL == plist_ptr) + if (NULL == plist_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist_ptr); - if(NULL == fapl_ptr) + if (NULL == fapl_ptr) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to get VFL driver info") /* Copy simpler info */ @@ -705,45 +692,45 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha file_ptr->fa.ignore_wo_errs = fapl_ptr->ignore_wo_errs; /* Copy R/W and W/O channel FAPLs. */ - if(H5FD__copy_plist(fapl_ptr->rw_fapl_id, &(file_ptr->fa.rw_fapl_id)) < 0) + if (H5FD__copy_plist(fapl_ptr->rw_fapl_id, &(file_ptr->fa.rw_fapl_id)) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy R/W FAPL"); - if(H5FD__copy_plist(fapl_ptr->wo_fapl_id, &(file_ptr->fa.wo_fapl_id)) < 0) + if (H5FD__copy_plist(fapl_ptr->wo_fapl_id, &(file_ptr->fa.wo_fapl_id)) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy W/O FAPL"); /* Prepare log file if necessary. * If application wants to ignore the errors from W/O channel and * provided a name for the log file, then open it */ - if(!file_ptr->logfp) { - if(file_ptr->fa.log_file_path[0] != '\0') { + if (!file_ptr->logfp) { + if (file_ptr->fa.log_file_path[0] != '\0') { file_ptr->logfp = HDfopen(file_ptr->fa.log_file_path, "w"); - if(file_ptr->logfp == NULL) + if (file_ptr->logfp == NULL) HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open log file") } /* end if logfile path given */ - } /* end if logfile pointer/handle does not exist */ + } /* end if logfile pointer/handle does not exist */ file_ptr->rw_file = H5FD_open(name, flags, fapl_ptr->rw_fapl_id, HADDR_UNDEF); - if(!file_ptr->rw_file) + if (!file_ptr->rw_file) HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open R/W file") file_ptr->wo_file = H5FD_open(fapl_ptr->wo_path, flags, fapl_ptr->wo_fapl_id, HADDR_UNDEF); - if(!file_ptr->wo_file) - H5FD_SPLITTER_WO_ERROR(file_ptr, FUNC, H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open W/O file") + if (!file_ptr->wo_file) + H5FD_SPLITTER_WO_ERROR(file_ptr, FUNC, H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open W/O file") - ret_value = (H5FD_t*)file_ptr; + ret_value = (H5FD_t *)file_ptr; done: - if(NULL == ret_value) { - if(file_ptr) { - if(H5I_INVALID_HID != file_ptr->fa.rw_fapl_id) + if (NULL == ret_value) { + if (file_ptr) { + if (H5I_INVALID_HID != file_ptr->fa.rw_fapl_id) H5I_dec_ref(file_ptr->fa.rw_fapl_id); - if(H5I_INVALID_HID != file_ptr->fa.wo_fapl_id) + if (H5I_INVALID_HID != file_ptr->fa.wo_fapl_id) H5I_dec_ref(file_ptr->fa.wo_fapl_id); - if(file_ptr->rw_file) + if (file_ptr->rw_file) H5FD_close(file_ptr->rw_file); - if(file_ptr->wo_file) + if (file_ptr->wo_file) H5FD_close(file_ptr->wo_file); - if(file_ptr->logfp) + if (file_ptr->logfp) HDfclose(file_ptr->logfp); H5FL_FREE(H5FD_splitter_t, file_ptr); } @@ -752,7 +739,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_open() */ - /*------------------------------------------------------------------------- * Function: H5FD__splitter_close * @@ -775,19 +761,19 @@ H5FD__splitter_close(H5FD_t *_file) /* Sanity check */ HDassert(file); - if(H5I_dec_ref(file->fa.rw_fapl_id) < 0) + if (H5I_dec_ref(file->fa.rw_fapl_id) < 0) HGOTO_ERROR(H5E_VFL, H5E_ARGS, FAIL, "can't close R/W FAPL") - if(H5I_dec_ref(file->fa.wo_fapl_id) < 0) + if (H5I_dec_ref(file->fa.wo_fapl_id) < 0) HGOTO_ERROR(H5E_VFL, H5E_ARGS, FAIL, "can't close W/O FAPL") - if(file->rw_file) - if(H5FD_close(file->rw_file) == FAIL) + if (file->rw_file) + if (H5FD_close(file->rw_file) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close R/W file") - if(file->wo_file) - if(H5FD_close(file->wo_file) == FAIL) + if (file->wo_file) + if (H5FD_close(file->wo_file) == FAIL) H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close W/O file") - if(file->logfp) { + if (file->logfp) { HDfclose(file->logfp); file->logfp = NULL; } @@ -800,7 +786,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_close() */ - /*------------------------------------------------------------------------- * Function: H5FD__splitter_get_eoa * @@ -827,14 +812,13 @@ H5FD__splitter_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) HDassert(file); HDassert(file->rw_file); - if((ret_value = H5FD_get_eoa(file->rw_file, type)) == HADDR_UNDEF) + if ((ret_value = H5FD_get_eoa(file->rw_file, type)) == HADDR_UNDEF) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, HADDR_UNDEF, "unable to get eoa") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_get_eoa */ - /*------------------------------------------------------------------------- * Function: H5FD__splitter_set_eoa * @@ -848,8 +832,8 @@ done: static herr_t H5FD__splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) { - H5FD_splitter_t *file = (H5FD_splitter_t *)_file; - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_splitter_t *file = (H5FD_splitter_t *)_file; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -860,17 +844,16 @@ H5FD__splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t ad HDassert(file->rw_file); HDassert(file->wo_file); - if(H5FD_set_eoa(file->rw_file, type, addr) < 0) + if (H5FD_set_eoa(file->rw_file, type, addr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "H5FDset_eoa failed for R/W file") - if(H5FD_set_eoa(file->wo_file, type, addr) < 0) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTSET, FAIL, "unable to set EOA for W/O file") + if (H5FD_set_eoa(file->wo_file, type, addr) < 0) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTSET, FAIL, "unable to set EOA for W/O file") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_set_eoa() */ - /*------------------------------------------------------------------------- * Function: H5FD__splitter_get_eof * @@ -886,8 +869,8 @@ done: static haddr_t H5FD__splitter_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { - const H5FD_splitter_t *file = (const H5FD_splitter_t *)_file; - haddr_t ret_value = HADDR_UNDEF; /* Return value */ + const H5FD_splitter_t *file = (const H5FD_splitter_t *)_file; + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_STATIC @@ -897,14 +880,13 @@ H5FD__splitter_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) HDassert(file); HDassert(file->rw_file); - if(HADDR_UNDEF == (ret_value = H5FD_get_eof(file->rw_file, type))) + if (HADDR_UNDEF == (ret_value = H5FD_get_eof(file->rw_file, type))) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, HADDR_UNDEF, "unable to get eof") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_get_eof */ - /*------------------------------------------------------------------------- * Function: H5FD__splitter_truncate * @@ -916,8 +898,8 @@ done: static herr_t H5FD__splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) { - H5FD_splitter_t *file = (H5FD_splitter_t *)_file; - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_splitter_t *file = (H5FD_splitter_t *)_file; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -927,17 +909,16 @@ H5FD__splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) HDassert(file->rw_file); HDassert(file->wo_file); - if(H5FDtruncate(file->rw_file, dxpl_id, closing) < 0) + if (H5FDtruncate(file->rw_file, dxpl_id, closing) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate R/W file") - if(H5FDtruncate(file->wo_file, dxpl_id, closing) < 0) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate W/O file") + if (H5FDtruncate(file->wo_file, dxpl_id, closing) < 0) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate W/O file") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_truncate */ - /*------------------------------------------------------------------------- * Function: H5FD__splitter_sb_size * @@ -966,13 +947,12 @@ H5FD__splitter_sb_size(H5FD_t *_file) HDassert(file); HDassert(file->rw_file); - if(file->rw_file) + if (file->rw_file) ret_value = H5FD_sb_size(file->rw_file); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_sb_size */ - /*------------------------------------------------------------------------- * Function: H5FD__splitter_sb_encode * @@ -982,10 +962,10 @@ H5FD__splitter_sb_size(H5FD_t *_file) *------------------------------------------------------------------------- */ static herr_t -H5FD__splitter_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out*/) +H5FD__splitter_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out*/) { - H5FD_splitter_t *file = (H5FD_splitter_t *)_file; - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_splitter_t *file = (H5FD_splitter_t *)_file; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -995,14 +975,13 @@ H5FD__splitter_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*o HDassert(file); HDassert(file->rw_file); - if(file->rw_file && H5FD_sb_encode(file->rw_file, name, buf) < 0) + if (file->rw_file && H5FD_sb_encode(file->rw_file, name, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTENCODE, FAIL, "unable to encode the superblock in R/W file") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_sb_encode */ - /*------------------------------------------------------------------------- * Function: H5FD__splitter_sb_decode * @@ -1016,8 +995,8 @@ done: static herr_t H5FD__splitter_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) { - H5FD_splitter_t *file = (H5FD_splitter_t *)_file; - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_splitter_t *file = (H5FD_splitter_t *)_file; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1027,14 +1006,13 @@ H5FD__splitter_sb_decode(H5FD_t *_file, const char *name, const unsigned char *b HDassert(file); HDassert(file->rw_file); - if(H5FD_sb_load(file->rw_file, name, buf) < 0) + if (H5FD_sb_load(file->rw_file, name, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "unable to decode the superblock in R/W file") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_sb_decode */ - /*------------------------------------------------------------------------- * Function: H5FD__splitter_cmp * @@ -1047,9 +1025,9 @@ done: static int H5FD__splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { - const H5FD_splitter_t *f1 = (const H5FD_splitter_t *)_f1; - const H5FD_splitter_t *f2 = (const H5FD_splitter_t *)_f2; - herr_t ret_value = 0; /* Return value */ + const H5FD_splitter_t *f1 = (const H5FD_splitter_t *)_f1; + const H5FD_splitter_t *f2 = (const H5FD_splitter_t *)_f2; + herr_t ret_value = 0; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -1063,7 +1041,6 @@ H5FD__splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2) FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_cmp */ - /*-------------------------------------------------------------------------- * Function: H5FD__splitter_get_handle * @@ -1074,11 +1051,10 @@ H5FD__splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2) *-------------------------------------------------------------------------- */ static herr_t -H5FD__splitter_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, - void **file_handle) +H5FD__splitter_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handle) { - H5FD_splitter_t *file = (H5FD_splitter_t*)_file; - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_splitter_t *file = (H5FD_splitter_t *)_file; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1090,14 +1066,13 @@ H5FD__splitter_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, HDassert(file_handle); /* Only do for R/W channel */ - if(H5FD_get_vfd_handle(file->rw_file, file->fa.rw_fapl_id, file_handle) < 0) + if (H5FD_get_vfd_handle(file->rw_file, file->fa.rw_fapl_id, file_handle) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "unable to get handle of R/W file") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_get_handle */ - /*-------------------------------------------------------------------------- * Function: H5FD__splitter_lock * @@ -1109,8 +1084,8 @@ done: static herr_t H5FD__splitter_lock(H5FD_t *_file, hbool_t rw) { - H5FD_splitter_t *file = (H5FD_splitter_t *)_file; /* VFD file struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_splitter_t *file = (H5FD_splitter_t *)_file; /* VFD file struct */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1120,18 +1095,17 @@ H5FD__splitter_lock(H5FD_t *_file, hbool_t rw) HDassert(file->rw_file); /* Place the lock on each file */ - if(H5FD_lock(file->rw_file, rw) < 0) + if (H5FD_lock(file->rw_file, rw) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTLOCKFILE, FAIL, "unable to lock R/W file") - if(file->wo_file != NULL) - if(H5FD_lock(file->wo_file, rw) < 0) + if (file->wo_file != NULL) + if (H5FD_lock(file->wo_file, rw) < 0) H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTLOCKFILE, FAIL, "unable to lock W/O file") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_lock */ - /*-------------------------------------------------------------------------- * Function: H5FD__splitter_unlock * @@ -1143,8 +1117,8 @@ done: static herr_t H5FD__splitter_unlock(H5FD_t *_file) { - H5FD_splitter_t *file = (H5FD_splitter_t *)_file; /* VFD file struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_splitter_t *file = (H5FD_splitter_t *)_file; /* VFD file struct */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1155,18 +1129,17 @@ H5FD__splitter_unlock(H5FD_t *_file) HDassert(file->rw_file); /* Remove the lock on each file */ - if(H5FD_unlock(file->rw_file) < 0) + if (H5FD_unlock(file->rw_file) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock R/W file") - if(file->wo_file != NULL) - if(H5FD_unlock(file->wo_file) < 0) + if (file->wo_file != NULL) + if (H5FD_unlock(file->wo_file) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock W/O file") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_unlock */ - /*------------------------------------------------------------------------- * Function: H5FD__splitter_query * @@ -1186,18 +1159,18 @@ H5FD__splitter_query(const H5FD_t *_file, unsigned long *flags /* out */) H5FD_SPLITTER_LOG_CALL(FUNC); - if(file) { + if (file) { HDassert(file); HDassert(file->rw_file); - if(H5FDquery(file->rw_file, flags) < 0) + if (H5FDquery(file->rw_file, flags) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTLOCK, FAIL, "unable to query R/W file"); } else { /* There is no file. Because this is a pure passthrough VFD, * it has no features of its own. */ - if(flags) + if (flags) *flags = 0; } @@ -1205,7 +1178,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_query() */ - /*------------------------------------------------------------------------- * Function: H5FD__splitter_alloc * @@ -1217,8 +1189,8 @@ done: static haddr_t H5FD__splitter_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) { - H5FD_splitter_t *file = (H5FD_splitter_t *)_file; /* VFD file struct */ - haddr_t ret_value = HADDR_UNDEF; /* Return value */ + H5FD_splitter_t *file = (H5FD_splitter_t *)_file; /* VFD file struct */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_STATIC @@ -1229,17 +1201,16 @@ H5FD__splitter_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size HDassert(file->rw_file); /* Allocate memory for each file, only return the return value for R/W file. */ - if((ret_value = H5FDalloc(file->rw_file, type, dxpl_id, size)) == HADDR_UNDEF) + if ((ret_value = H5FDalloc(file->rw_file, type, dxpl_id, size)) == HADDR_UNDEF) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate for R/W file") - if(H5FDalloc(file->wo_file, type, dxpl_id, size) == HADDR_UNDEF) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to alloc for W/O file") + if (H5FDalloc(file->wo_file, type, dxpl_id, size) == HADDR_UNDEF) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to alloc for W/O file") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_alloc() */ - /*------------------------------------------------------------------------- * Function: H5FD__splitter_get_type_map * @@ -1263,14 +1234,13 @@ H5FD__splitter_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map) HDassert(file->rw_file); /* Retrieve memory type mapping for R/W channel only */ - if(H5FD_get_fs_type_map(file->rw_file, type_map) < 0) + if (H5FD_get_fs_type_map(file->rw_file, type_map) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "unable to allocate for R/W file") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_get_type_map() */ - /*------------------------------------------------------------------------- * Function: H5FD__splitter_free * @@ -1282,8 +1252,8 @@ done: static herr_t H5FD__splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size) { - H5FD_splitter_t *file = (H5FD_splitter_t *)_file; /* VFD file struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_splitter_t *file = (H5FD_splitter_t *)_file; /* VFD file struct */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1293,17 +1263,16 @@ H5FD__splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, HDassert(file); HDassert(file->rw_file); - if(H5FDfree(file->rw_file, type, dxpl_id, addr, size) < 0) + if (H5FDfree(file->rw_file, type, dxpl_id, addr, size) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "unable to free for R/W file") - if(H5FDfree(file->wo_file, type, dxpl_id, addr, size) < 0) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTINIT, FAIL, "unable to free for W/O file") + if (H5FDfree(file->wo_file, type, dxpl_id, addr, size) < 0) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTINIT, FAIL, "unable to free for W/O file") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_free() */ - /*------------------------------------------------------------------------- * Function: H5FD__splitter_log_error * @@ -1326,21 +1295,20 @@ H5FD__splitter_log_error(const H5FD_splitter_t *file, const char *atfunc, const HDassert(atfunc && *atfunc); HDassert(msg && *msg); - if(file->logfp != NULL) { + if (file->logfp != NULL) { size_t size; - char *s; + char * s; size = HDstrlen(atfunc) + HDstrlen(msg) + 3; /* ':', ' ', '\n' */ - s = (char *)HDmalloc(sizeof(char) * (size + 1)); - if(NULL == s) + s = (char *)HDmalloc(sizeof(char) * (size + 1)); + if (NULL == s) ret_value = FAIL; - else if(size < (size_t)HDsnprintf(s, size+1, "%s: %s\n", atfunc, msg)) + else if (size < (size_t)HDsnprintf(s, size + 1, "%s: %s\n", atfunc, msg)) ret_value = FAIL; - else if(size != HDfwrite(s, 1, size, file->logfp)) + else if (size != HDfwrite(s, 1, size, file->logfp)) ret_value = FAIL; HDfree(s); } FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__splitter_log_error() */ - |