diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 15:29:53 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 15:29:53 (GMT) |
commit | ec8ad09125032c9c232878d02e90aa86df162841 (patch) | |
tree | 5d63105d3a0db7d5bbee41c5b74b097649a2115e /src/H5FD.c | |
parent | 453238e90e1574ef1c15e3c79f7fb3d77920e77c (diff) | |
download | hdf5-ec8ad09125032c9c232878d02e90aa86df162841.zip hdf5-ec8ad09125032c9c232878d02e90aa86df162841.tar.gz hdf5-ec8ad09125032c9c232878d02e90aa86df162841.tar.bz2 |
Source formatted
Diffstat (limited to 'src/H5FD.c')
-rw-r--r-- | src/H5FD.c | 548 |
1 files changed, 244 insertions, 304 deletions
@@ -23,43 +23,39 @@ /* Module Setup */ /****************/ -#define H5F_FRIEND /* Suppress error about including H5Fpkg */ -#include "H5FDmodule.h" /* This source code file is part of the H5FD module */ - +#define H5F_FRIEND /* Suppress error about including H5Fpkg */ +#include "H5FDmodule.h" /* This source code file is part of the H5FD module */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5FDpkg.h" /* File Drivers */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FDpkg.h" /* File Drivers */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ /****************/ /* Local Macros */ /****************/ - /******************/ /* Local Typedefs */ /******************/ - /********************/ /* Package Typedefs */ /********************/ - /********************/ /* Local Prototypes */ /********************/ static herr_t H5FD__free_cls(H5FD_class_t *cls); -static herr_t H5FD__query(const H5FD_t *f, unsigned long *flags/*out*/); +static herr_t H5FD__query(const H5FD_t *f, unsigned long *flags /*out*/); /*********************/ /* Package Variables */ @@ -68,12 +64,10 @@ static herr_t H5FD__query(const H5FD_t *f, unsigned long *flags/*out*/); /* Package initialization variable */ hbool_t H5_PKG_INIT_VAR = FALSE; - /*****************************/ /* Library Private Variables */ /*****************************/ - /*******************/ /* Local Variables */ /*******************/ @@ -94,14 +88,12 @@ static unsigned long H5FD_file_serial_no_g; /* File driver ID class */ static const H5I_class_t H5I_VFL_CLS[1] = {{ - H5I_VFL, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ - (H5I_free_t)H5FD__free_cls /* Callback routine for closing objects of this class */ + H5I_VFL, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5FD__free_cls /* Callback routine for closing objects of this class */ }}; - - /*------------------------------------------------------------------------- * Function: H5FD__init_package * @@ -114,11 +106,11 @@ static const H5I_class_t H5I_VFL_CLS[1] = {{ herr_t H5FD__init_package(void) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - if(H5I_register_type(H5I_VFL_CLS) < 0) + if (H5I_register_type(H5I_VFL_CLS) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface") /* Reset the file serial numbers */ @@ -128,7 +120,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__init_package() */ - /*------------------------------------------------------------------------- * Function: H5FD_term_package * @@ -147,29 +138,28 @@ done: int H5FD_term_package(void) { - int n = 0; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_PKG_INIT_VAR) { - if(H5I_nmembers(H5I_VFL) > 0) { + if (H5_PKG_INIT_VAR) { + if (H5I_nmembers(H5I_VFL) > 0) { (void)H5I_clear_type(H5I_VFL, FALSE, FALSE); n++; /*H5I*/ - } /* end if */ + } /* end if */ else { /* Destroy the VFL driver ID group */ n += (H5I_dec_type_ref(H5I_VFL) > 0); /* Mark closed */ - if(0 == n) + if (0 == n) H5_PKG_INIT_VAR = FALSE; } /* end else */ - } /* end if */ + } /* end if */ FUNC_LEAVE_NOAPI(n) } /* end H5FD_term_package() */ - /*------------------------------------------------------------------------- * Function: H5FD__free_cls * @@ -195,8 +185,9 @@ H5FD__free_cls(H5FD_class_t *cls) * driver a chance to free singletons or other resources which will become * invalid once the class structure is freed. */ - if(cls->terminate && cls->terminate() < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEOBJ, FAIL, "virtual file driver '%s' did not terminate cleanly", cls->name) + if (cls->terminate && cls->terminate() < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEOBJ, FAIL, "virtual file driver '%s' did not terminate cleanly", + cls->name) H5MM_xfree(cls); @@ -204,7 +195,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__free_cls() */ - /*------------------------------------------------------------------------- * Function: H5FDregister * @@ -224,36 +214,38 @@ done: hid_t H5FDregister(const H5FD_class_t *cls) { - H5FD_mem_t type; - hid_t ret_value = H5I_INVALID_HID; + H5FD_mem_t type; + hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "*x", cls); /* Check arguments */ - if(!cls) + if (!cls) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null class pointer is disallowed") - if(!cls->open || !cls->close) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'open' and/or 'close' methods are not defined") - if(!cls->get_eoa || !cls->set_eoa) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'get_eoa' and/or 'set_eoa' methods are not defined") - if(!cls->get_eof) + if (!cls->open || !cls->close) + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, + "'open' and/or 'close' methods are not defined") + if (!cls->get_eoa || !cls->set_eoa) + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, + "'get_eoa' and/or 'set_eoa' methods are not defined") + if (!cls->get_eof) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'get_eof' method is not defined") - if(!cls->read || !cls->write) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'read' and/or 'write' method is not defined") + if (!cls->read || !cls->write) + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, + "'read' and/or 'write' method is not defined") for (type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) - if(cls->fl_map[type] < H5FD_MEM_NOLIST || cls->fl_map[type] >= H5FD_MEM_NTYPES) + if (cls->fl_map[type] < H5FD_MEM_NOLIST || cls->fl_map[type] >= H5FD_MEM_NTYPES) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid free-list mapping") /* Create the new class ID */ - if((ret_value = H5FD_register(cls, sizeof(H5FD_class_t), TRUE)) < 0) + if ((ret_value = H5FD_register(cls, sizeof(H5FD_class_t), TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID") done: FUNC_LEAVE_API(ret_value) } /* end H5FDregister() */ - /*------------------------------------------------------------------------- * Function: H5FD_register * @@ -273,10 +265,10 @@ done: hid_t H5FD_register(const void *_cls, size_t size, hbool_t app_ref) { - const H5FD_class_t *cls = (const H5FD_class_t *)_cls; - H5FD_class_t *saved = NULL; - H5FD_mem_t type; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + const H5FD_class_t *cls = (const H5FD_class_t *)_cls; + H5FD_class_t * saved = NULL; + H5FD_mem_t type; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(H5I_INVALID_HID) @@ -286,28 +278,28 @@ H5FD_register(const void *_cls, size_t size, hbool_t app_ref) HDassert(cls->get_eoa && cls->set_eoa); HDassert(cls->get_eof); HDassert(cls->read && cls->write); - for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) { + for (type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) { HDassert(cls->fl_map[type] >= H5FD_MEM_NOLIST && cls->fl_map[type] < H5FD_MEM_NTYPES); } /* Copy the class structure so the caller can reuse or free it */ - if(NULL == (saved = (H5FD_class_t *)H5MM_malloc(size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed for file driver class struct") + if (NULL == (saved = (H5FD_class_t *)H5MM_malloc(size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, + "memory allocation failed for file driver class struct") H5MM_memcpy(saved, cls, size); /* Create the new class ID */ - if((ret_value = H5I_register(H5I_VFL, saved, app_ref)) < 0) + if ((ret_value = H5I_register(H5I_VFL, saved, app_ref)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID") done: - if(H5I_INVALID_HID == ret_value) - if(saved) + if (H5I_INVALID_HID == ret_value) + if (saved) saved = (H5FD_class_t *)H5MM_xfree(saved); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_register() */ - /*------------------------------------------------------------------------- * Function: H5FDunregister * @@ -323,24 +315,23 @@ done: herr_t H5FDunregister(hid_t driver_id) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", driver_id); /* Check arguments */ - if(NULL == H5I_object_verify(driver_id, H5I_VFL)) + if (NULL == H5I_object_verify(driver_id, H5I_VFL)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver") /* The H5FD_class_t struct will be freed by this function */ - if(H5I_dec_app_ref(driver_id) < 0) + if (H5I_dec_app_ref(driver_id) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "unable to unregister file driver") done: FUNC_LEAVE_API(ret_value) } /* end H5FDunregister() */ - /*------------------------------------------------------------------------- * Function: H5FD_get_class * @@ -361,23 +352,23 @@ done: H5FD_class_t * H5FD_get_class(hid_t id) { - H5FD_class_t *ret_value = NULL; + H5FD_class_t *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) - if(H5I_VFL == H5I_get_type(id)) + if (H5I_VFL == H5I_get_type(id)) ret_value = (H5FD_class_t *)H5I_object(id); else { - H5P_genplist_t *plist; /* Property list pointer */ + H5P_genplist_t *plist; /* Property list pointer */ /* Get the plist structure */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(id))) + if (NULL == (plist = (H5P_genplist_t *)H5I_object(id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID") - if(TRUE == H5P_isa_class(id, H5P_FILE_ACCESS)) { - H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ + if (TRUE == H5P_isa_class(id, H5P_FILE_ACCESS)) { + H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ - if(H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) + if (H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID & info") ret_value = H5FD_get_class(driver_prop.driver_id); } /* end if */ @@ -389,7 +380,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_get_class() */ - /*------------------------------------------------------------------------- * Function: H5FD_sb_size * @@ -406,7 +396,7 @@ done: hsize_t H5FD_sb_size(H5FD_t *file) { - hsize_t ret_value = 0; + hsize_t ret_value = 0; FUNC_ENTER_NOAPI(0) @@ -415,14 +405,13 @@ H5FD_sb_size(H5FD_t *file) HDassert(file->cls); /* Dispatch to driver */ - if(file->cls->sb_size) + if (file->cls->sb_size) ret_value = (file->cls->sb_size)(file); done: FUNC_LEAVE_NOAPI(ret_value) } - /*------------------------------------------------------------------------- * Function: H5FD_sb_encode * @@ -438,9 +427,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf) +H5FD_sb_encode(H5FD_t *file, char *name /*out*/, uint8_t *buf) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -449,14 +438,13 @@ H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf) HDassert(file->cls); /* Dispatch to driver */ - if(file->cls->sb_encode && (file->cls->sb_encode)(file, name/*out*/, buf/*out*/) < 0) + if (file->cls->sb_encode && (file->cls->sb_encode)(file, name /*out*/, buf /*out*/) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_encode request failed") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_sb_encode() */ - /*------------------------------------------------------------------------- * Function: H5FD__sb_decode * @@ -469,7 +457,7 @@ done: static herr_t H5FD__sb_decode(H5FD_t *file, const char *name, const uint8_t *buf) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -478,14 +466,13 @@ H5FD__sb_decode(H5FD_t *file, const char *name, const uint8_t *buf) HDassert(file->cls); /* Dispatch to driver */ - if(file->cls->sb_decode && (file->cls->sb_decode)(file, name, buf) < 0) + if (file->cls->sb_decode && (file->cls->sb_decode)(file, name, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_decode request failed") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__sb_decode() */ - /*------------------------------------------------------------------------- * Function: H5FD_sb_load * @@ -498,7 +485,7 @@ done: herr_t H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -509,20 +496,19 @@ H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf) /* Check if driver matches driver information saved. Unfortunately, we can't push this * function to each specific driver because we're checking if the driver is correct. */ - if(!HDstrncmp(name, "NCSAfami", (size_t)8) && HDstrcmp(file->cls->name, "family")) + if (!HDstrncmp(name, "NCSAfami", (size_t)8) && HDstrcmp(file->cls->name, "family")) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "family driver should be used") - if(!HDstrncmp(name, "NCSAmult", (size_t)8) && HDstrcmp(file->cls->name, "multi")) + if (!HDstrncmp(name, "NCSAmult", (size_t)8) && HDstrcmp(file->cls->name, "multi")) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "multi driver should be used") /* Decode driver information */ - if(H5FD__sb_decode(file, name, buf) < 0) + if (H5FD__sb_decode(file, name, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "unable to decode driver information") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_sb_load() */ - /*------------------------------------------------------------------------- * Function: H5FD_fapl_get * @@ -548,7 +534,7 @@ done: void * H5FD_fapl_get(H5FD_t *file) { - void *ret_value = NULL; + void *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) @@ -557,14 +543,13 @@ H5FD_fapl_get(H5FD_t *file) HDassert(file->cls); /* Dispatch to driver */ - if(file->cls->fapl_get) + if (file->cls->fapl_get) ret_value = (file->cls->fapl_get)(file); done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_fapl_get() */ - /*------------------------------------------------------------------------- * Function: H5FD_free_driver_info * @@ -577,22 +562,22 @@ done: herr_t H5FD_free_driver_info(hid_t driver_id, const void *driver_info) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if(driver_id > 0 && driver_info) { - H5FD_class_t *driver; + if (driver_id > 0 && driver_info) { + H5FD_class_t *driver; /* Retrieve the driver for the ID */ - if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_id))) + if (NULL == (driver = (H5FD_class_t *)H5I_object(driver_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID") /* Allow driver to free info or do it ourselves */ - if(driver->fapl_free) { + if (driver->fapl_free) { /* Free the const pointer */ /* Cast through uintptr_t to de-const memory */ - if((driver->fapl_free)((void *)(uintptr_t)driver_info) < 0) + if ((driver->fapl_free)((void *)(uintptr_t)driver_info) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed") } else @@ -603,7 +588,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_free_driver_info() */ - /*------------------------------------------------------------------------- * Function: H5FDopen * @@ -657,27 +641,25 @@ done: H5FD_t * H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - H5FD_t *ret_value = NULL; + H5FD_t *ret_value = NULL; FUNC_ENTER_API(NULL) H5TRACE4("*x", "*sIuia", name, flags, fapl_id, maxaddr); /* Check arguments */ - if(H5P_DEFAULT == fapl_id) + if (H5P_DEFAULT == fapl_id) fapl_id = H5P_FILE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(fapl_id,H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + else if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") /* Call private function */ - if(NULL == (ret_value = H5FD_open(name, flags, fapl_id, maxaddr))) + if (NULL == (ret_value = H5FD_open(name, flags, fapl_id, maxaddr))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to open file") done: FUNC_LEAVE_API(ret_value) } - /*------------------------------------------------------------------------- * Function: H5FD_open * @@ -692,52 +674,52 @@ done: H5FD_t * H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - H5FD_class_t *driver; /* VFD for file */ - H5FD_t *file = NULL; /* VFD file struct */ - H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ - H5P_genplist_t *plist; /* Property list pointer */ - unsigned long driver_flags = 0; /* File-inspecific driver feature flags */ - H5FD_file_image_info_t file_image_info; /* Initial file image */ - H5FD_t *ret_value = NULL; /* Return value */ + H5FD_class_t * driver; /* VFD for file */ + H5FD_t * file = NULL; /* VFD file struct */ + H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ + H5P_genplist_t * plist; /* Property list pointer */ + unsigned long driver_flags = 0; /* File-inspecific driver feature flags */ + H5FD_file_image_info_t file_image_info; /* Initial file image */ + H5FD_t * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) /* Sanity checks */ - if(0 == maxaddr) + if (0 == maxaddr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "zero format address range") /* Get file access property list */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") /* Get the VFD to open the file with */ - if(H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) + if (H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID & info") /* Get driver info */ - if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_prop.driver_id))) + if (NULL == (driver = (H5FD_class_t *)H5I_object(driver_prop.driver_id))) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid driver ID in file access property list") - if(NULL == driver->open) + if (NULL == driver->open) HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method") /* Query driver flag */ - if(H5FD_driver_query(driver, &driver_flags) < 0) + if (H5FD_driver_query(driver, &driver_flags) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't query VFD flags") /* Get initial file image info */ - if(H5P_peek(plist, H5F_ACS_FILE_IMAGE_INFO_NAME, &file_image_info) < 0) + if (H5P_peek(plist, H5F_ACS_FILE_IMAGE_INFO_NAME, &file_image_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file image info") /* If an image is provided, make sure the driver supports this feature */ HDassert(((file_image_info.buffer != NULL) && (file_image_info.size > 0)) || ((file_image_info.buffer == NULL) && (file_image_info.size == 0))); - if((file_image_info.buffer != NULL) && !(driver_flags & H5FD_FEAT_ALLOW_FILE_IMAGE)) + if ((file_image_info.buffer != NULL) && !(driver_flags & H5FD_FEAT_ALLOW_FILE_IMAGE)) HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file image set, but not supported.") /* Dispatch to file driver */ - if(HADDR_UNDEF == maxaddr) + if (HADDR_UNDEF == maxaddr) maxaddr = driver->maxaddr; - if(NULL == (file = (driver->open)(name, flags, fapl_id, maxaddr))) + if (NULL == (file = (driver->open)(name, flags, fapl_id, maxaddr))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "open failed") /* Set the file access flags */ @@ -747,21 +729,21 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) * driver ID to prevent it from being freed while this file is open. */ file->driver_id = driver_prop.driver_id; - if(H5I_inc_ref(file->driver_id, FALSE) < 0) + if (H5I_inc_ref(file->driver_id, FALSE) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver") - file->cls = driver; + file->cls = driver; file->maxaddr = maxaddr; - if(H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, &(file->threshold)) < 0) + if (H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, &(file->threshold)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment threshold") - if(H5P_get(plist, H5F_ACS_ALIGN_NAME, &(file->alignment)) < 0) + if (H5P_get(plist, H5F_ACS_ALIGN_NAME, &(file->alignment)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment") /* Retrieve the VFL driver feature flags */ - if(H5FD__query(file, &(file->feature_flags)) < 0) + if (H5FD__query(file, &(file->feature_flags)) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to query file driver") /* Increment the global serial number & assign it to this H5FD_t object */ - if(++H5FD_file_serial_no_g == 0) { + if (++H5FD_file_serial_no_g == 0) { /* (Just error out if we wrap around for now...) */ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to get file serial number") } /* end if */ @@ -779,7 +761,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_open() */ - /*------------------------------------------------------------------------- * Function: H5FDclose * @@ -796,26 +777,25 @@ done: herr_t H5FDclose(H5FD_t *file) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "*x", file); /* Check arguments */ - if(!file) + if (!file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") - if(!file->cls) + if (!file->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") /* Call private function */ - if(H5FD_close(file) < 0) + if (H5FD_close(file) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close file") done: FUNC_LEAVE_API(ret_value) } /* end H5FDclose() */ - /*------------------------------------------------------------------------- * Function: H5FD_close * @@ -839,21 +819,20 @@ H5FD_close(H5FD_t *file) /* Prepare to close file by clearing all public fields */ driver = file->cls; - if(H5I_dec_ref(file->driver_id) < 0) + if (H5I_dec_ref(file->driver_id) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID") /* Dispatch to the driver for actual close. If the driver fails to * close the file then the file will be in an unusable state. */ HDassert(driver->close); - if((driver->close)(file) < 0) + if ((driver->close)(file) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "close failed") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_close() */ - /*------------------------------------------------------------------------- * Function: H5FDcmp * @@ -876,7 +855,7 @@ done: int H5FDcmp(const H5FD_t *f1, const H5FD_t *f2) { - int ret_value = -1; + int ret_value = -1; FUNC_ENTER_API(-1) /* return value is arbitrary */ H5TRACE2("Is", "*x*x", f1, f2); @@ -888,7 +867,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5FDcmp() */ - /*------------------------------------------------------------------------- * Function: H5FD_cmp * @@ -903,26 +881,26 @@ done: int H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2) { - int ret_value = -1; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(-1) /* return value is arbitrary */ - if((!f1 || !f1->cls) && (!f2 || !f2->cls)) + if ((!f1 || !f1->cls) && (!f2 || !f2->cls)) HGOTO_DONE(0) - if(!f1 || !f1->cls) + if (!f1 || !f1->cls) HGOTO_DONE(-1) - if(!f2 || !f2->cls) + if (!f2 || !f2->cls) HGOTO_DONE(1) - if(f1->cls < f2->cls) + if (f1->cls < f2->cls) HGOTO_DONE(-1) - if(f1->cls > f2->cls) + if (f1->cls > f2->cls) HGOTO_DONE(1) /* Files are same driver; no cmp callback */ - if(!f1->cls->cmp) { - if(f1 < f2) + if (!f1->cls->cmp) { + if (f1 < f2) HGOTO_DONE(-1) - if(f1 > f2) + if (f1 > f2) HGOTO_DONE(1) HGOTO_DONE(0) } @@ -934,7 +912,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_cmp() */ - /*------------------------------------------------------------------------- * Function: H5FDquery * @@ -946,30 +923,29 @@ done: *------------------------------------------------------------------------- */ int -H5FDquery(const H5FD_t *file, unsigned long *flags/*out*/) +H5FDquery(const H5FD_t *file, unsigned long *flags /*out*/) { - int ret_value = 0; + int ret_value = 0; FUNC_ENTER_API((-1)) H5TRACE2("Is", "*xx", file, flags); /* Check arguments */ - if(!file) + if (!file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "file pointer cannot be NULL") - if(!file->cls) + if (!file->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "file class pointer cannot be NULL") - if(!flags) + if (!flags) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "flags parameter cannot be NULL") /* Call private function */ - if(H5FD__query(file, flags) < 0) + if (H5FD__query(file, flags) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, (-1), "unable to query feature flags") done: FUNC_LEAVE_API(ret_value) } - /*------------------------------------------------------------------------- * Function: H5FD_query * @@ -980,9 +956,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD__query(const H5FD_t *file, unsigned long *flags/*out*/) +H5FD__query(const H5FD_t *file, unsigned long *flags /*out*/) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -992,18 +968,17 @@ H5FD__query(const H5FD_t *file, unsigned long *flags/*out*/) HDassert(flags); /* Dispatch to driver (if available) */ - if(file->cls->query) { - if((file->cls->query)(file, flags) < 0) + if (file->cls->query) { + if ((file->cls->query)(file, flags) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "unable to query feature flags") } else - *flags=0; + *flags = 0; done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_query() */ - /*------------------------------------------------------------------------- * Function: H5FDalloc * @@ -1043,31 +1018,30 @@ done: haddr_t H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) { - haddr_t ret_value = HADDR_UNDEF; + haddr_t ret_value = HADDR_UNDEF; FUNC_ENTER_API(HADDR_UNDEF) H5TRACE4("a", "*xMtih", file, type, dxpl_id, size); /* Check arguments */ - if(!file) + if (!file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file pointer cannot be NULL") - if(!file->cls) + if (!file->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file class pointer cannot be NULL") - if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) + if (type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid request type") - if(size == 0) + if (size == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "zero-size request") - if(H5P_DEFAULT == dxpl_id) + if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; - else - if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a data transfer property list") + else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a data transfer property list") /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); /* Call private function */ - if(HADDR_UNDEF == (ret_value = H5FD__alloc_real(file, type, size, NULL, NULL))) + if (HADDR_UNDEF == (ret_value = H5FD__alloc_real(file, type, size, NULL, NULL))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file memory") /* (Note compensating for base address subtraction in internal routine) */ @@ -1077,7 +1051,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5FDalloc() */ - /*------------------------------------------------------------------------- * Function: H5FDfree * @@ -1095,37 +1068,35 @@ done: herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "*xMtiah", file, type, dxpl_id, addr, size); /* Check arguments */ - if(!file) + if (!file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") - if(!file->cls) + if (!file->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") - if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) + if (type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request type") - if(H5P_DEFAULT == dxpl_id) + if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; - else - if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") + else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); /* Call private function */ /* (Note compensating for base address addition in internal routine) */ - if(H5FD__free_real(file, type, addr - file->base_addr, size) < 0) + if (H5FD__free_real(file, type, addr - file->base_addr, size) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "file deallocation request failed") done: FUNC_LEAVE_API(ret_value) } /* end H5FDfree() */ - /*------------------------------------------------------------------------- * Function: H5FDget_eoa * @@ -1140,21 +1111,21 @@ done: haddr_t H5FDget_eoa(H5FD_t *file, H5FD_mem_t type) { - haddr_t ret_value; + haddr_t ret_value; FUNC_ENTER_API(HADDR_UNDEF) H5TRACE2("a", "*xMt", file, type); /* Check arguments */ - if(!file) + if (!file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file pointer cannot be NULL") - if(!file->cls) + if (!file->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file class pointer cannot be NULL") - if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) + if (type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file type") /* Call private function */ - if(HADDR_UNDEF == (ret_value = H5FD_get_eoa(file, type))) + if (HADDR_UNDEF == (ret_value = H5FD_get_eoa(file, type))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eoa request failed") /* (Note compensating for base address subtraction in internal routine) */ @@ -1164,7 +1135,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5FDget_eoa() */ - /*------------------------------------------------------------------------- * Function: H5FDset_eoa * @@ -1189,31 +1159,30 @@ done: herr_t H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t addr) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "*xMta", file, type, addr); /* Check arguments */ - if(!file) + if (!file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") - if(!file->cls) + if (!file->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") - if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) + if (type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file type") - if(!H5F_addr_defined(addr) || addr > file->maxaddr) + if (!H5F_addr_defined(addr) || addr > file->maxaddr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid end-of-address value") /* Call private function */ /* (Note compensating for base address addition in internal routine) */ - if(H5FD_set_eoa(file, type, addr - file->base_addr) < 0) + if (H5FD_set_eoa(file, type, addr - file->base_addr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file set eoa request failed") done: FUNC_LEAVE_API(ret_value) } /* end H5FDset_eoa() */ - /*------------------------------------------------------------------------- * Function: H5FDget_eof * @@ -1238,19 +1207,19 @@ done: haddr_t H5FDget_eof(H5FD_t *file, H5FD_mem_t type) { - haddr_t ret_value; + haddr_t ret_value; FUNC_ENTER_API(HADDR_UNDEF) H5TRACE2("a", "*xMt", file, type); /* Check arguments */ - if(!file) + if (!file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file pointer cannot be NULL") - if(!file->cls) + if (!file->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file class pointer cannot be NULL") /* Call private function */ - if(HADDR_UNDEF == (ret_value = H5FD_get_eof(file, type))) + if (HADDR_UNDEF == (ret_value = H5FD_get_eof(file, type))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eof request failed") /* (Note compensating for base address subtraction in internal routine) */ @@ -1260,7 +1229,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5FDget_eof() */ - /*------------------------------------------------------------------------- * Function: H5FD_get_maxaddr * @@ -1274,7 +1242,7 @@ done: haddr_t H5FD_get_maxaddr(const H5FD_t *file) { - haddr_t ret_value = HADDR_UNDEF; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) @@ -1288,7 +1256,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_get_maxaddr() */ - /*------------------------------------------------------------------------- * Function: H5FD_get_feature_flags * @@ -1313,7 +1280,6 @@ H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_get_feature_flags() */ - /*------------------------------------------------------------------------- * Function: H5FD_set_feature_flags * @@ -1337,7 +1303,6 @@ H5FD_set_feature_flags(H5FD_t *file, unsigned long feature_flags) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_set_feature_flags() */ - /*------------------------------------------------------------------------- * Function: H5FD_get_fs_type_map * @@ -1350,7 +1315,7 @@ H5FD_set_feature_flags(H5FD_t *file, unsigned long feature_flags) herr_t H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1360,9 +1325,9 @@ H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map) HDassert(type_map); /* Check for VFD class providing a type map retrieval rouine */ - if(file->cls->get_type_map) { + if (file->cls->get_type_map) { /* Retrieve type mapping for this file */ - if((file->cls->get_type_map)(file, type_map) < 0) + if ((file->cls->get_type_map)(file, type_map) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get type map failed") } /* end if */ else @@ -1373,7 +1338,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_get_fs_type_map() */ - /*------------------------------------------------------------------------- * Function: H5FDread * @@ -1392,42 +1356,39 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, - void *buf/*out*/) +H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf /*out*/) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "*xMtiazx", file, type, dxpl_id, addr, size, buf); /* Check arguments */ - if(!file) + if (!file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") - if(!file->cls) + if (!file->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") - if(!buf) + if (!buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "result buffer parameter can't be NULL") /* Get the default dataset transfer property list if the user didn't provide one */ - if(H5P_DEFAULT == dxpl_id) + if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; - else - if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") + else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); /* Call private function */ /* (Note compensating for base address addition in internal routine) */ - if(H5FD_read(file, type, addr - file->base_addr, size, buf) < 0) + if (H5FD_read(file, type, addr - file->base_addr, size, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file read request failed") done: FUNC_LEAVE_API(ret_value) } /* end H5FDread() */ - /*------------------------------------------------------------------------- * Function: H5FDwrite * @@ -1441,42 +1402,39 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, - const void *buf) +H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "*xMtiaz*x", file, type, dxpl_id, addr, size, buf); /* Check arguments */ - if(!file) + if (!file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") - if(!file->cls) + if (!file->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") - if(!buf) + if (!buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "result buffer parameter can't be NULL") /* Get the default dataset transfer property list if the user didn't provide one */ - if(H5P_DEFAULT == dxpl_id) + if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; - else - if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") + else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); /* Call private function */ /* (Note compensating for base address addition in internal routine) */ - if(H5FD_write(file, type, addr - file->base_addr, size, buf) < 0) + if (H5FD_write(file, type, addr - file->base_addr, size, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file write request failed") done: FUNC_LEAVE_API(ret_value) } /* end H5FDwrite() */ - /*------------------------------------------------------------------------- * Function: H5FDflush * @@ -1490,35 +1448,33 @@ done: herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "*xib", file, dxpl_id, closing); /* Check arguments */ - if(!file) + if (!file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") - if(!file->cls) + if (!file->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") - if(H5P_DEFAULT == dxpl_id) + if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; - else - if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") + else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); /* Call private function */ - if(H5FD_flush(file, closing) < 0) + if (H5FD_flush(file, closing) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFLUSH, FAIL, "file flush request failed") done: FUNC_LEAVE_API(ret_value) } /* end H5FDflush() */ - /*------------------------------------------------------------------------- * Function: H5FD_flush * @@ -1531,7 +1487,7 @@ done: herr_t H5FD_flush(H5FD_t *file, hbool_t closing) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1540,14 +1496,13 @@ H5FD_flush(H5FD_t *file, hbool_t closing) HDassert(file->cls); /* Dispatch to driver */ - if(file->cls->flush && (file->cls->flush)(file, H5CX_get_dxpl(), closing) < 0) + if (file->cls->flush && (file->cls->flush)(file, H5CX_get_dxpl(), closing) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver flush request failed") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_flush() */ - /*------------------------------------------------------------------------- * Function: H5FDtruncate * @@ -1560,34 +1515,32 @@ done: herr_t H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "*xib", file, dxpl_id, closing); /* Check arguments */ - if(!file) + if (!file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") - if(!file->cls) + if (!file->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") - if(H5P_DEFAULT == dxpl_id) + if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; - else - if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") + else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); /* Call private function */ - if(H5FD_truncate(file, closing) < 0) + if (H5FD_truncate(file, closing) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "file flush request failed") done: FUNC_LEAVE_API(ret_value) } /* end H5FDtruncate() */ - /*------------------------------------------------------------------------- * Function: H5FD_truncate * @@ -1600,7 +1553,7 @@ done: herr_t H5FD_truncate(H5FD_t *file, hbool_t closing) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1609,14 +1562,13 @@ H5FD_truncate(H5FD_t *file, hbool_t closing) HDassert(file->cls); /* Dispatch to driver */ - if(file->cls->truncate && (file->cls->truncate)(file, H5CX_get_dxpl(), closing) < 0) + if (file->cls->truncate && (file->cls->truncate)(file, H5CX_get_dxpl(), closing) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "driver truncate request failed") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_truncate() */ - /*------------------------------------------------------------------------- * Function: H5FDlock * @@ -1629,27 +1581,25 @@ done: herr_t H5FDlock(H5FD_t *file, hbool_t rw) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "*xb", file, rw); /* Check arguments */ - if(!file) + if (!file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") - if(!file->cls) + if (!file->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") /* Call private function */ - if(H5FD_lock(file, rw) < 0) + if (H5FD_lock(file, rw) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTLOCKFILE, FAIL, "file lock request failed") done: FUNC_LEAVE_API(ret_value) } /* end H5FDlock() */ - - /*------------------------------------------------------------------------- * Function: H5FD_lock * @@ -1662,7 +1612,7 @@ done: herr_t H5FD_lock(H5FD_t *file, hbool_t rw) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1671,14 +1621,13 @@ H5FD_lock(H5FD_t *file, hbool_t rw) HDassert(file->cls); /* Dispatch to driver */ - if(file->cls->lock && (file->cls->lock)(file, rw) < 0) + if (file->cls->lock && (file->cls->lock)(file, rw) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTLOCKFILE, FAIL, "driver lock request failed") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_lock() */ - /*------------------------------------------------------------------------- * Function: H5FDunlock * @@ -1691,26 +1640,25 @@ done: herr_t H5FDunlock(H5FD_t *file) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "*x", file); /* Check arguments */ - if(!file) + if (!file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") - if(!file->cls) + if (!file->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") /* Call private function */ - if(H5FD_unlock(file) < 0) + if (H5FD_unlock(file) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "file unlock request failed") done: FUNC_LEAVE_API(ret_value) } /* end H5FDunlock() */ - /*------------------------------------------------------------------------- * Function: H5FD_unlock * @@ -1723,7 +1671,7 @@ done: herr_t H5FD_unlock(H5FD_t *file) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1732,14 +1680,13 @@ H5FD_unlock(H5FD_t *file) HDassert(file->cls); /* Dispatch to driver */ - if(file->cls->unlock && (file->cls->unlock)(file) < 0) + if (file->cls->unlock && (file->cls->unlock)(file) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "driver unlock request failed") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_unlock() */ - /*------------------------------------------------------------------------- * Function: H5FD_get_fileno * @@ -1766,7 +1713,6 @@ H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_get_fileno() */ - /*-------------------------------------------------------------------------- * Function: H5FDget_vfd_handle * @@ -1786,27 +1732,26 @@ H5FDget_vfd_handle(H5FD_t *file, hid_t fapl_id, void **file_handle) H5TRACE3("e", "*xi**x", file, fapl_id, file_handle); /* Check arguments */ - if(!file) + if (!file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") - if(!file->cls) + if (!file->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be 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_BADVALUE, FAIL, "fapl_id parameter is not a file access property list") - if(!file_handle) + if (!file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle parameter cannot be NULL") /* Call private function */ - if(H5FD_get_vfd_handle(file, fapl_id, file_handle) < 0) + if (H5FD_get_vfd_handle(file, fapl_id, file_handle) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver") done: - if(FAIL == ret_value) + if (FAIL == ret_value) *file_handle = NULL; FUNC_LEAVE_API(ret_value) } /* end H5FDget_vfd_handle() */ - /*-------------------------------------------------------------------------- * Function: H5FD_get_vfd_handle * @@ -1829,16 +1774,15 @@ H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl_id, void **file_handle) HDassert(file_handle); /* Dispatch to driver */ - if(NULL == file->cls->get_handle) + if (NULL == file->cls->get_handle) HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "file driver has no `get_vfd_handle' method") - if((file->cls->get_handle)(file, fapl_id, file_handle) < 0) + if ((file->cls->get_handle)(file, fapl_id, file_handle) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_get_vfd_handle() */ - /*-------------------------------------------------------------------------- * Function: H5FD_set_base_addr * @@ -1863,7 +1807,6 @@ H5FD_set_base_addr(H5FD_t *file, haddr_t base_addr) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_set_base_addr() */ - /*-------------------------------------------------------------------------- * Function: H5FD_get_base_addr * @@ -1886,7 +1829,6 @@ H5FD_get_base_addr(const H5FD_t *file) FUNC_LEAVE_NOAPI(file->base_addr) } /* end H5FD_get_base_addr() */ - /*-------------------------------------------------------------------------- * Function: H5FD_set_paged_aggr * @@ -1910,30 +1852,29 @@ H5FD_set_paged_aggr(H5FD_t *file, hbool_t paged) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_set_paged_aggr() */ - /*------------------------------------------------------------------------- -* Function: H5FDdriver_query -* -* Purpose: Similar to H5FD_query(), but intended for cases when we don't -* have a file available (e.g. before one is opened). Since we -* can't use the file to get the driver, the driver ID is passed -* in as a parameter. -* -* Return: Non-negative on success/Negative on failure -* -*------------------------------------------------------------------------- -*/ + * Function: H5FDdriver_query + * + * Purpose: Similar to H5FD_query(), but intended for cases when we don't + * have a file available (e.g. before one is opened). Since we + * can't use the file to get the driver, the driver ID is passed + * in as a parameter. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ herr_t -H5FDdriver_query(hid_t driver_id, unsigned long *flags/*out*/) +H5FDdriver_query(hid_t driver_id, unsigned long *flags /*out*/) { - H5FD_class_t *driver = NULL; /* Pointer to VFD class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_class_t *driver = NULL; /* Pointer to VFD class struct */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "ix", driver_id, flags); /* Check arguments */ - if(NULL == flags) + if (NULL == flags) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "flags parameter cannot be NULL") /* Check for the driver to query and then query it */ @@ -1945,4 +1886,3 @@ H5FDdriver_query(hid_t driver_id, unsigned long *flags/*out*/) done: FUNC_LEAVE_API(ret_value) } /* end H5FDdriver_query() */ - |