summaryrefslogtreecommitdiffstats
path: root/src/H5FD.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5FD.c')
-rw-r--r--src/H5FD.c556
1 files changed, 272 insertions, 284 deletions
diff --git a/src/H5FD.c b/src/H5FD.c
index 0284d2d..0dfda38 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -25,6 +25,10 @@
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5FD_mask
+
/* Packages needed by this file */
#include "H5private.h" /*library functions */
#include "H5Dprivate.h" /*datasets */
@@ -42,7 +46,6 @@
#endif /* H5_HAVE_FPHDF5 */
/* Interface initialization */
-#define PABLO_MASK H5FD_mask
#define INTERFACE_INIT H5FD_init_interface
static int interface_initialize_g = 0;
@@ -106,16 +109,16 @@ H5FD_init_interface(void)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOINIT(H5FD_init_interface);
+ FUNC_ENTER_NOINIT(H5FD_init_interface)
if (H5I_init_group(H5I_VFL, H5I_VFL_HASHSIZE, 0, (H5I_free_t)H5FD_free_cls)<0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface")
/* Reset the file serial numbers */
file_serial_no=0;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -144,7 +147,7 @@ H5FD_term_interface(void)
{
int n = 0;
- FUNC_ENTER_NOINIT(H5FD_term_interface);
+ FUNC_ENTER_NOINIT(H5FD_term_interface)
if (interface_initialize_g) {
if ((n=H5I_nmembers(H5I_VFL))) {
@@ -155,7 +158,7 @@ H5FD_term_interface(void)
n = 1; /*H5I*/
}
}
- FUNC_LEAVE_NOAPI(n);
+ FUNC_LEAVE_NOAPI(n)
}
@@ -180,11 +183,11 @@ H5FD_term_interface(void)
static herr_t
H5FD_free_cls(H5FD_class_t *cls)
{
- FUNC_ENTER_NOINIT(H5FD_free_cls);
+ FUNC_ENTER_NOINIT(H5FD_free_cls)
H5MM_xfree(cls);
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
}
@@ -216,44 +219,44 @@ H5FDregister(const H5FD_class_t *cls)
H5FD_class_t *saved=NULL;
H5FD_mem_t type;
- FUNC_ENTER_API(H5FDregister, FAIL);
+ FUNC_ENTER_API(H5FDregister, FAIL)
H5TRACE1("i","x",cls);
/* Check arguments */
if (!cls)
- HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "null class pointer is disallowed");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "null class pointer is disallowed")
if (!cls->open || !cls->close)
- HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`open' and/or `close' methods are not defined");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`open' and/or `close' methods are not defined")
if (!cls->get_eoa || !cls->set_eoa)
- HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`get_eoa' and/or `set_eoa' methods are not defined");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`get_eoa' and/or `set_eoa' methods are not defined")
if (!cls->get_eof)
- HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`get_eof' method is not defined");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`get_eof' method is not defined")
if (!cls->read || !cls->write)
- HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`read' and/or `write' method is not defined");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`read' and/or `write' method is not defined")
for (type=H5FD_MEM_DEFAULT; type<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,type)) {
if (cls->fl_map[type]<H5FD_MEM_NOLIST ||
cls->fl_map[type]>=H5FD_MEM_NTYPES)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid free-list mapping");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid free-list mapping")
}
/* Copy the class structure so the caller can reuse or free it */
if (NULL==(saved=H5MM_malloc(sizeof(H5FD_class_t))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for file driver class struct");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for file driver class struct")
*saved = *cls;
/* Create the new class ID */
if ((ret_value=H5I_register(H5I_VFL, saved))<0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file driver ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file driver ID")
done:
if(ret_value<0)
if(saved)
H5MM_xfree(saved);
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -281,19 +284,19 @@ H5FDunregister(hid_t driver_id)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5FDunregister, FAIL);
+ FUNC_ENTER_API(H5FDunregister, FAIL)
H5TRACE1("e","i",driver_id);
/* Check arguments */
if (NULL==H5I_object_verify(driver_id,H5I_VFL))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver");
+ 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_ref(driver_id)<0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to unregister file driver");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to unregister file driver")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -331,30 +334,30 @@ H5FD_get_class(hid_t id)
H5FD_class_t *ret_value=NULL;
hid_t driver_id = -1;
- FUNC_ENTER_NOAPI(H5FD_get_class, NULL);
+ FUNC_ENTER_NOAPI(H5FD_get_class, NULL)
if (H5I_VFL==H5I_get_type(id)) {
ret_value = H5I_object(id);
} else {
/* Get the plist structure */
if(NULL == (plist = H5I_object(id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
if (TRUE==H5P_isa_class(id,H5P_FILE_ACCESS)) {
if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID")
ret_value = H5FD_get_class(driver_id);
} else if (TRUE==H5P_isa_class(id,H5P_DATASET_XFER)) {
if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID")
ret_value = H5FD_get_class(driver_id);
} else {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a driver id, file access property list or data transfer property list");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a driver id, file access property list or data transfer property list")
}
} /* end if */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -381,7 +384,7 @@ H5FD_sb_size(H5FD_t *file)
{
hsize_t ret_value=0;
- FUNC_ENTER_NOAPI(H5FD_sb_size, 0);
+ FUNC_ENTER_NOAPI(H5FD_sb_size, 0)
assert(file && file->cls);
@@ -389,7 +392,7 @@ H5FD_sb_size(H5FD_t *file)
ret_value = (file->cls->sb_size)(file);
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -419,15 +422,15 @@ H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_sb_encode, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_sb_encode, FAIL)
assert(file && file->cls);
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");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_encode request failed")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -452,15 +455,15 @@ H5FD_sb_decode(H5FD_t *file, const char *name, const uint8_t *buf)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_sb_decode, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_sb_decode, FAIL)
assert(file && file->cls);
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");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_decode request failed")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -495,7 +498,7 @@ H5FD_fapl_get(H5FD_t *file)
{
void *ret_value=NULL;
- FUNC_ENTER_NOAPI(H5FD_fapl_get, NULL);
+ FUNC_ENTER_NOAPI(H5FD_fapl_get, NULL)
assert(file);
@@ -503,7 +506,7 @@ H5FD_fapl_get(H5FD_t *file)
ret_value = (file->cls->fapl_get)(file);
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -534,11 +537,11 @@ H5FD_fapl_copy(hid_t driver_id, const void *old_fapl)
H5FD_class_t *driver=NULL;
void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_fapl_copy, NULL);
+ FUNC_ENTER_NOAPI(H5FD_fapl_copy, NULL)
/* Check args */
if (NULL==(driver=H5I_object(driver_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a driver ID");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a driver ID")
if (!old_fapl)
HGOTO_DONE(NULL); /*but no error*/
@@ -546,16 +549,17 @@ H5FD_fapl_copy(hid_t driver_id, const void *old_fapl)
if (driver->fapl_copy) {
new_fapl = (driver->fapl_copy)(old_fapl);
} else if (driver->fapl_size>0) {
- new_fapl = H5MM_malloc(driver->fapl_size);
+ if((new_fapl = H5MM_malloc(driver->fapl_size))==NULL)
+ HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, NULL, "fapl allocation failed")
HDmemcpy(new_fapl, old_fapl, driver->fapl_size);
} else
- HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "no way to copy driver file access property list");
+ HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "no way to copy driver file access property list")
/* Set return value */
ret_value=new_fapl;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -581,22 +585,22 @@ H5FD_fapl_free(hid_t driver_id, void *fapl)
H5FD_class_t *driver=NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_fapl_free, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_fapl_free, FAIL)
/* Check args */
if (NULL==(driver=H5I_object(driver_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID")
/* Allow driver to free or do it ourselves */
if (fapl && driver->fapl_free) {
if ((driver->fapl_free)(fapl)<0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver fapl_free request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver fapl_free request failed")
} else {
H5MM_xfree(fapl);
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -627,11 +631,11 @@ H5FD_dxpl_copy(hid_t driver_id, const void *old_dxpl, void **copied_dxpl)
H5FD_class_t *driver=NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_dxpl_copy, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_dxpl_copy, FAIL)
/* Check args */
if (NULL==(driver=H5I_object(driver_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID")
/* Copy old dxpl, if one exists */
if (old_dxpl) {
@@ -643,14 +647,14 @@ H5FD_dxpl_copy(hid_t driver_id, const void *old_dxpl, void **copied_dxpl)
assert(new_dxpl);
HDmemcpy(new_dxpl, old_dxpl, driver->dxpl_size);
} else
- HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "no way to copy driver file access property list");
+ HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "no way to copy driver file access property list")
} /* end if */
/* Set copied value */
*copied_dxpl=new_dxpl;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -676,22 +680,22 @@ H5FD_dxpl_free(hid_t driver_id, void *dxpl)
H5FD_class_t *driver=NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_dxpl_free, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_dxpl_free, FAIL)
/* Check args */
if (NULL==(driver=H5I_object(driver_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID")
/* Allow driver to free or do it ourselves */
if (dxpl && driver->dxpl_free) {
if ((driver->dxpl_free)(dxpl)<0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver dxpl_free request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver dxpl_free request failed")
} else {
H5MM_xfree(dxpl);
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -755,20 +759,20 @@ H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
{
H5FD_t *ret_value=NULL;
- FUNC_ENTER_API(H5FDopen, NULL);
+ FUNC_ENTER_API(H5FDopen, NULL)
/* Check arguments */
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");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
if (NULL==(ret_value=H5FD_open(name, flags, fapl_id, maxaddr)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to open file");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to open file")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -804,59 +808,60 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
H5P_genplist_t *plist; /* Property list pointer */
H5FD_t *ret_value;
- FUNC_ENTER_NOAPI(H5FD_open, NULL);
+ FUNC_ENTER_NOAPI(H5FD_open, NULL)
/* Get file access property list */
if(NULL == (plist = H5I_object(fapl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
if (0==maxaddr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "zero format address range");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "zero format address range")
if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID")
/* Get driver info */
if (NULL==(driver=H5I_object(driver_id)))
- HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid driver ID in file access property list");
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid driver ID in file access property list")
if (NULL==driver->open)
- HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method");
+ HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method")
/* Dispatch to file driver */
if (HADDR_UNDEF==maxaddr)
maxaddr = driver->maxaddr;
if (NULL==(file=(driver->open)(name, flags, fapl_id, maxaddr)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "open failed");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "open failed")
/*
* Fill in public fields. We must increment the reference count on the
* driver ID to prevent it from being freed while this file is open.
*/
file->driver_id = driver_id;
- H5I_inc_ref(file->driver_id);
+ if(H5I_inc_ref(file->driver_id)<0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver")
file->cls = driver;
file->maxaddr = maxaddr;
HDmemset(file->fl, 0, sizeof(file->fl));
if(H5P_get(plist, H5F_ACS_META_BLOCK_SIZE_NAME, &(meta_block_size)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get meta data block size");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get meta data block size")
file->def_meta_block_size = meta_block_size;
if(H5P_get(plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &(sdata_block_size)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'small data' block size");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'small data' block size")
file->def_sdata_block_size = sdata_block_size;
file->accum_loc = HADDR_UNDEF;
if(H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, &(file->threshold)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment threshold");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment threshold")
if(H5P_get(plist, H5F_ACS_ALIGN_NAME, &(file->alignment)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment");
+ 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)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to query file driver");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to query file driver")
/* Increment the global serial number & assign it to this H5FD_t object */
if(++file_serial_no==0) {
/* (Just error out if we wrap around for now...) */
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to get file serial number");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to get file serial number")
} /* end if */
file->fileno=file_serial_no;
@@ -865,7 +870,7 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
done:
/* Can't cleanup 'file' information, since we don't know what type it is */
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -894,17 +899,17 @@ H5FDclose(H5FD_t *file)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5FDclose, FAIL);
+ FUNC_ENTER_API(H5FDclose, FAIL)
H5TRACE1("e","x",file);
if (!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
if (H5FD_close(file)<0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to close file");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to close file")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -938,17 +943,18 @@ H5FD_close(H5FD_t *file)
const H5FD_class_t *driver;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(H5FD_close, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_close, FAIL)
/* check args */
assert(file && file->cls);
/* Free the freelist (this call never fails) */
- H5FD_free_freelist(file);
+ (void)H5FD_free_freelist(file);
/* Prepare to close file by clearing all public fields */
driver = file->cls;
- H5I_dec_ref(file->driver_id);
+ 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
@@ -957,10 +963,10 @@ H5FD_close(H5FD_t *file)
assert(driver->close);
if ((driver->close)(file) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "close failed");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "close failed")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -985,7 +991,7 @@ H5FD_free_freelist(H5FD_t *file)
#endif /* H5F_DEBUG */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(H5FD_free_freelist, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_free_freelist, FAIL)
/* check args */
assert(file && file->cls);
@@ -1030,7 +1036,7 @@ H5FD_free_freelist(H5FD_t *file)
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -1063,13 +1069,13 @@ H5FDcmp(const H5FD_t *f1, const H5FD_t *f2)
{
int ret_value;
- FUNC_ENTER_API(H5FDcmp, -1); /*return value is arbitrary*/
+ FUNC_ENTER_API(H5FDcmp, -1) /*return value is arbitrary*/
H5TRACE2("Is","xx",f1,f2);
ret_value = H5FD_cmp(f1, f2);
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -1094,32 +1100,32 @@ H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2)
{
int ret_value;
- FUNC_ENTER_NOAPI(H5FD_cmp, -1); /*return value is arbitrary*/
+ FUNC_ENTER_NOAPI(H5FD_cmp, -1) /*return value is arbitrary*/
if ((!f1 || !f1->cls) && (!f2 || !f2->cls))
- HGOTO_DONE(0);
+ HGOTO_DONE(0)
if (!f1 || !f1->cls)
- HGOTO_DONE(-1);
+ HGOTO_DONE(-1)
if (!f2 || !f2->cls)
- HGOTO_DONE(1);
+ HGOTO_DONE(1)
if (f1->cls < f2->cls)
- HGOTO_DONE(-1);
+ HGOTO_DONE(-1)
if (f1->cls > f2->cls)
- HGOTO_DONE(1);
+ HGOTO_DONE(1)
/* Files are same driver; no cmp callback */
if (!f1->cls->cmp) {
if (f1<f2)
- HGOTO_DONE(-1);
+ HGOTO_DONE(-1)
if (f1>f2)
- HGOTO_DONE(1);
- HGOTO_DONE(0);
+ HGOTO_DONE(1)
+ HGOTO_DONE(0)
}
ret_value = (f1->cls->cmp)(f1, f2);
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -1144,7 +1150,7 @@ H5FDquery(const H5FD_t *f, unsigned long *flags/*out*/)
{
int ret_value;
- FUNC_ENTER_API(H5FDquery, FAIL);
+ FUNC_ENTER_API(H5FDquery, FAIL)
H5TRACE2("Is","xx",f,flags);
assert(f);
@@ -1153,7 +1159,7 @@ H5FDquery(const H5FD_t *f, unsigned long *flags/*out*/)
ret_value = H5FD_query(f, flags);
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -1178,7 +1184,7 @@ H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/)
{
int ret_value=0;
- FUNC_ENTER_NOAPI(H5FD_query, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_query, FAIL)
assert(f);
assert(flags);
@@ -1190,7 +1196,7 @@ H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/)
*flags=0;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -1240,28 +1246,28 @@ H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
{
haddr_t ret_value = HADDR_UNDEF;
- FUNC_ENTER_API(H5FDalloc, HADDR_UNDEF);
+ FUNC_ENTER_API(H5FDalloc, HADDR_UNDEF)
H5TRACE4("a","xMtih",file,type,dxpl_id,size);
/* Check args */
if (!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer")
if (type<0 || type>=H5FD_MEM_NTYPES)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid request type");
- if (size<=0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "zero-size request");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid request type")
+ if (size==0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "zero-size request")
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");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a data transfer property list")
/* Do the real work */
if (HADDR_UNDEF==(ret_value=H5FD_alloc(file, type, dxpl_id, size)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file memory");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file memory")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -1298,7 +1304,7 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
H5FD_mem_t mapped_type;
haddr_t ret_value = HADDR_UNDEF;
- FUNC_ENTER_NOAPI(H5FD_alloc, HADDR_UNDEF);
+ FUNC_ENTER_NOAPI(H5FD_alloc, HADDR_UNDEF)
/* check args */
assert(file);
@@ -1321,11 +1327,11 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
/* Get the data xfer property list */
if ((plist = H5I_object(dxpl_id)) == NULL)
- HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, HADDR_UNDEF, "not a dataset transfer list");
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, HADDR_UNDEF, "not a dataset transfer list")
if (H5P_exist_plist(plist, H5FD_FPHDF5_CAPTN_ALLOC_ONLY) > 0)
if (H5P_get(plist, H5FD_FPHDF5_CAPTN_ALLOC_ONLY, &capt_only) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, HADDR_UNDEF, "can't retrieve FPHDF5 property");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, HADDR_UNDEF, "can't retrieve FPHDF5 property")
HDmemset(&fp_alloc, 0, sizeof(fp_alloc));
@@ -1339,7 +1345,7 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
&fp_alloc.eoa, &req_id, &status) != SUCCEED)
/* FIXME: Should we check the "status" variable here? */
HGOTO_ERROR(H5E_FPHDF5, H5E_CANTALLOC, HADDR_UNDEF,
- "server couldn't allocate from file");
+ "server couldn't allocate from file")
}
if (capt_only) {
@@ -1356,7 +1362,7 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
file->cls->set_eoa(file, fp_alloc.eoa);
/* We've succeeded -- return the value */
- HGOTO_DONE(fp_alloc.addr);
+ HGOTO_DONE(fp_alloc.addr)
}
#endif /* H5_HAVE_FPHDF5 */
@@ -1375,7 +1381,7 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
/* Try to allocate from the free list first */
if ((ret_value = H5FD_alloc_from_free_list(file, type,
mapped_type, size)) != HADDR_UNDEF)
- HGOTO_DONE(ret_value);
+ HGOTO_DONE(ret_value)
#ifdef H5F_DEBUG
if (H5DEBUG(F))
@@ -1385,15 +1391,15 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
if (type != H5FD_MEM_DRAW) {
/* Handle metadata differently from "raw" data */
if ((ret_value = H5FD_alloc_metadata(file, type, dxpl_id, size)) == HADDR_UNDEF)
- HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't allocate for metadata");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't allocate for metadata")
} else {
/* Allocate "raw" data */
if ((ret_value = H5FD_alloc_raw(file, type, dxpl_id, size)) == HADDR_UNDEF)
- HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't allocate for raw data");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't allocate for raw data")
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -1416,7 +1422,7 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type,
{
haddr_t ret_value = HADDR_UNDEF;
- FUNC_ENTER_NOAPI(H5FD_alloc_from_free_list, HADDR_UNDEF);
+ FUNC_ENTER_NOAPI(H5FD_alloc_from_free_list, HADDR_UNDEF)
assert(file);
assert(type >= 0 && type < H5FD_MEM_NTYPES);
@@ -1483,7 +1489,7 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type,
if (size == file->maxsize)
file->maxsize = 0; /*unknown*/
- HGOTO_DONE(ret_value);
+ HGOTO_DONE(ret_value)
}
}
@@ -1537,7 +1543,7 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type,
if (size == file->maxsize)
file->maxsize = 0; /*unknown*/
- HGOTO_DONE(ret_value);
+ HGOTO_DONE(ret_value)
}
} else {
if (cur->size > size && (!best || cur->size < best->size))
@@ -1571,7 +1577,7 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type,
} else {
best->addr += size; /* Reduce size of block on free list */
best->size -= size;
- HGOTO_DONE(ret_value);
+ HGOTO_DONE(ret_value)
}
} else {
/*
@@ -1590,48 +1596,31 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type,
*/
if (type == H5FD_MEM_DRAW &&
(file->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) &&
- H5F_addr_overlap(ret_value, size, file->accum_loc,
- file->accum_size)) {
+ H5F_addr_overlap(ret_value, size, file->accum_loc, file->accum_size)) {
ret_value = HADDR_UNDEF;
} else {
/* Attempt to allocate memory for temporary node */
- tmp = H5FL_MALLOC(H5FD_free_t);
-
-#ifdef H5F_DEBUG
- if (H5DEBUG(F))
- HDfprintf(H5DEBUG(F),
- "%s: 3 pieces, begin best->addr=%a, best->size=%Hd, "
- "head=%Hd, size=%Hd\n",
- FUNC, best->addr, best->size, head, size);
-#endif /* H5F_DEBUG */
-
- assert(tmp); /* bark in debug mode */
+ if((tmp = H5FL_MALLOC(H5FD_free_t))==NULL)
+ HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "free block allocation failed")
- if (tmp) {
- if ((tmp->size = (best->size - head - size))) {
- tmp->addr = best->addr + head + size;
- tmp->next = best->next;
- best->next = tmp;
- } else {
- /* no tail piece */
- H5FL_FREE(H5FD_free_t,tmp);
- }
+ if ((tmp->size = (best->size - (head + size)))) {
+ tmp->addr = best->addr + (head + size);
+ tmp->next = best->next;
+ best->next = tmp;
} else {
- /*
- * Cannot keep the tail piece. Leak file memory.
- * (Only happens if memory allocation fails)
- */
+ /* no tail piece */
+ H5FL_FREE(H5FD_free_t,tmp);
}
best->size = head;
- HGOTO_DONE(ret_value);
- }
- }
- }
- }
+ HGOTO_DONE(ret_value)
+ } /* end else */
+ } /* end else */
+ } /* end if */
+ } /* end if */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -1654,7 +1643,7 @@ H5FD_alloc_metadata(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
{
haddr_t ret_value = HADDR_UNDEF;
- FUNC_ENTER_NOAPI(H5FD_alloc_metadata, HADDR_UNDEF);
+ FUNC_ENTER_NOAPI(H5FD_alloc_metadata, HADDR_UNDEF)
/* check args */
assert(file);
@@ -1724,8 +1713,7 @@ H5FD_alloc_metadata(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
if (file->eoma != 0)
if (H5FD_free(file, H5FD_MEM_DEFAULT, dxpl_id, file->eoma,
file->cur_meta_block_size) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF,
- "can't free metadata block");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free metadata block")
/* Point the metadata block at the newly allocated block */
file->eoma = new_meta;
@@ -1749,7 +1737,7 @@ H5FD_alloc_metadata(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -1770,7 +1758,7 @@ H5FD_alloc_raw(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
{
haddr_t ret_value = HADDR_UNDEF;
- FUNC_ENTER_NOAPI(H5FD_alloc_raw, HADDR_UNDEF);
+ FUNC_ENTER_NOAPI(H5FD_alloc_raw, HADDR_UNDEF)
/* check args */
assert(file);
@@ -1832,8 +1820,7 @@ H5FD_alloc_raw(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
if (file->eosda != 0)
if (H5FD_free(file, H5FD_MEM_DRAW, dxpl_id, file->eosda,
file->cur_sdata_block_size) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF,
- "can't free 'small data' block");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free 'small data' block")
/*
* Point the "small data" block at the newly
@@ -1860,7 +1847,7 @@ H5FD_alloc_raw(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -1887,7 +1874,7 @@ H5FD_real_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
{
haddr_t ret_value = HADDR_UNDEF;
- FUNC_ENTER_NOINIT(H5FD_real_alloc);
+ FUNC_ENTER_NOINIT(H5FD_real_alloc)
/* check args */
assert(file);
@@ -1901,16 +1888,14 @@ H5FD_real_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
*/
if (file->cls->alloc) {
if ((ret_value = (file->cls->alloc)(file, type, dxpl_id, size)) == HADDR_UNDEF)
- HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF,
- "driver allocation request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "driver allocation request failed")
} else {
if ((ret_value = H5FD_update_eoa(file, type, dxpl_id, size)) == HADDR_UNDEF)
- HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF,
- "driver eoa update request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "driver eoa update request failed")
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_real_alloc() */
@@ -1935,7 +1920,7 @@ H5FD_update_eoa(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
hsize_t wasted;
haddr_t ret_value = HADDR_UNDEF;
- FUNC_ENTER_NOINIT(H5FD_update_eoa);
+ FUNC_ENTER_NOINIT(H5FD_update_eoa)
/* check args */
assert(file);
@@ -1964,29 +1949,29 @@ H5FD_update_eoa(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
/* Advance eoa to the next alignment by allocating the wasted */
if (H5F_addr_overflow(eoa, size) || eoa + wasted > file->maxaddr)
- HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF,
- "file allocation request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed")
eoa += wasted;
if (file->cls->set_eoa(file, eoa) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF,
- "file allocation request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed")
}
/* allocate the aligned memory */
if (H5F_addr_overflow(eoa, size) || eoa + size > file->maxaddr)
- HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed")
ret_value = eoa;
eoa += size;
if (file->cls->set_eoa(file, eoa) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed")
/* Free the wasted memory */
- if (wasted)
- H5FD_free(file, type, dxpl_id, oldeoa, wasted);
+ if (wasted) {
+ if(H5FD_free(file, type, dxpl_id, oldeoa, wasted)<0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "file deallocation request failed")
+ } /* end if */
#ifdef H5F_DEBUG
if (file->alignment * file->threshold != 1 && H5DEBUG(F))
@@ -1996,7 +1981,7 @@ H5FD_update_eoa(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
#endif /* H5F_DEBUG */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -2026,26 +2011,26 @@ H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t siz
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5FDfree, FAIL);
+ FUNC_ENTER_API(H5FDfree, FAIL)
H5TRACE5("e","xMtiah",file,type,dxpl_id,addr,size);
/* Check args */
if (!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
if (type<0 || type>=H5FD_MEM_NTYPES)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request type")
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");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
/* Do the real work */
if (H5FD_free(file, type, dxpl_id, addr, size)<0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file deallocation request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "file deallocation request failed")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -2075,7 +2060,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si
H5FD_mem_t mapped_type;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_free, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_free, FAIL)
/* Check args */
assert(file);
@@ -2095,21 +2080,20 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si
/* Send the request to the SAP */
if (H5FP_request_free(file, type, addr, size, &req_id, &status) != SUCCEED)
/* FIXME: Should we check the "status" variable here? */
- HGOTO_ERROR(H5E_FPHDF5, H5E_CANTFREE, FAIL,
- "server couldn't free from file");
+ HGOTO_ERROR(H5E_FPHDF5, H5E_CANTFREE, FAIL, "server couldn't free from file")
/* We've succeeded -- return the value */
- HGOTO_DONE(ret_value);
+ HGOTO_DONE(ret_value)
}
#endif /* H5_HAVE_FPHDF5 */
if (!H5F_addr_defined(addr) || addr>file->maxaddr ||
H5F_addr_overflow(addr, size) || addr+size>file->maxaddr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid region");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid region")
/* Allow 0-sized free's to occur without penalty */
if(0==size)
- HGOTO_DONE(SUCCEED);
+ HGOTO_DONE(SUCCEED)
/* Map request type to free list */
if (H5FD_MEM_DEFAULT==file->cls->fl_map[type]) {
@@ -2176,7 +2160,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si
/* Write out the part of the accumulator after the block to free */
/* (Use the driver's write call directly - to avoid looping back and writing to metadata accumulator) */
if ((file->cls->write)(file, H5FD_MEM_DEFAULT, dxpl_id, tail_addr, tail_size, file->meta_accum+(tail_addr-file->accum_loc))<0)
- HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file write request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file write request failed")
} /* end if */
/* Adjust the accumulator information */
@@ -2273,7 +2257,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si
else {
/* Allocate a new node to hold the free block's information */
if(NULL==(last = H5FL_MALLOC(H5FD_free_t)))
- HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate node for free space info");
+ HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate node for free space info")
last->addr = addr;
last->size = size;
@@ -2292,7 +2276,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si
eoa = file->cls->get_eoa(file);
if(eoa == (last->addr+last->size)) {
if(file->cls->set_eoa(file, last->addr) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "set end of space allocation request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "set end of space allocation request failed")
/* Remove this free block from the list */
file->fl[mapped_type] = last->next;
@@ -2303,7 +2287,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si
}
} else if (file->cls->free) {
if ((file->cls->free)(file, type, dxpl_id, addr, size)<0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver free request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver free request failed")
} else {
/* leak memory */
#ifdef H5F_DEBUG
@@ -2312,7 +2296,7 @@ HDfprintf(stderr, "%s: LEAKED MEMORY!!!!!!\n", FUNC);
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -2340,7 +2324,7 @@ H5FDrealloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsiz
{
haddr_t ret_value=HADDR_UNDEF;
- FUNC_ENTER_API(H5FDrealloc, HADDR_UNDEF);
+ FUNC_ENTER_API(H5FDrealloc, HADDR_UNDEF)
H5TRACE6("a","xMtiahh",file,type,dxpl_id,old_addr,old_size,new_size);
/* Check args */
@@ -2348,13 +2332,13 @@ H5FDrealloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsiz
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");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a data transfer property list")
if (HADDR_UNDEF==(ret_value=H5FD_realloc(file, type, dxpl_id, old_addr, old_size, new_size)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file reallocation request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file reallocation request failed")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -2384,7 +2368,7 @@ H5FD_realloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsi
uint8_t *buf=_buf;
haddr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_realloc, HADDR_UNDEF);
+ FUNC_ENTER_NOAPI(H5FD_realloc, HADDR_UNDEF)
if (new_size==old_size) {
/*nothing to do*/
@@ -2393,16 +2377,18 @@ H5FD_realloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsi
/* allocate memory */
assert(!H5F_addr_defined(old_addr));
if (HADDR_UNDEF==(new_addr=H5FD_alloc(file, type, dxpl_id, new_size)))
- HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed");
+ HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed")
} else if (0==new_size) {
/* free memory */
assert(H5F_addr_defined(old_addr));
- H5FD_free(file, type, dxpl_id, old_addr, old_size);
+ if(H5FD_free(file, type, dxpl_id, old_addr, old_size)<0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "file deallocation request failed")
new_addr = HADDR_UNDEF;
} else if (new_size<old_size) {
/* free the end of the block */
- H5FD_free(file, type, dxpl_id, old_addr+old_size, old_size-new_size);
+ if(H5FD_free(file, type, dxpl_id, old_addr+old_size, old_size-new_size)<0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "file deallocation request failed")
} else {
/* move memory to new location */
/* Note! This may fail if sizeof(hsize_t)>sizeof(size_t) and the
@@ -2412,29 +2398,31 @@ H5FD_realloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsi
* -QAK, 6/20/01
*/
if (HADDR_UNDEF==(new_addr=H5FD_alloc(file, type, dxpl_id, new_size)))
- HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed");
+ HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed")
H5_CHECK_OVERFLOW(old_size,hsize_t,size_t);
if (old_size>sizeof(_buf) && NULL==(buf=H5MM_malloc((size_t)old_size))) {
- H5FD_free(file, type, dxpl_id, new_addr, new_size);
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed");
+ (void)H5FD_free(file, type, dxpl_id, new_addr, new_size);
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed")
}
if (H5FD_read(file, type, dxpl_id, old_addr, (size_t)old_size, buf)<0 ||
H5FD_write(file, type, dxpl_id, new_addr, (size_t)old_size, buf)<0) {
- H5FD_free(file, type, dxpl_id, new_addr, new_size);
- H5MM_xfree(buf);
- HGOTO_ERROR(H5E_FILE, H5E_READERROR, HADDR_UNDEF, "unable to move file block");
+ (void)H5FD_free(file, type, dxpl_id, new_addr, new_size);
+ if (buf!=_buf)
+ H5MM_xfree(buf);
+ HGOTO_ERROR(H5E_FILE, H5E_READERROR, HADDR_UNDEF, "unable to move file block")
}
if (buf!=_buf)
H5MM_xfree(buf);
- H5FD_free(file, type, dxpl_id, old_addr, old_size);
+ if(H5FD_free(file, type, dxpl_id, old_addr, old_size)<0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "file deallocation request failed")
}
/* Set return value */
ret_value=new_addr;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -2460,19 +2448,19 @@ H5FDget_eoa(H5FD_t *file)
{
haddr_t ret_value;
- FUNC_ENTER_API(H5FDget_eoa, HADDR_UNDEF);
+ FUNC_ENTER_API(H5FDget_eoa, HADDR_UNDEF)
H5TRACE1("a","x",file);
/* Check args */
if (!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer")
/* The real work */
if (HADDR_UNDEF==(ret_value=H5FD_get_eoa(file)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eoa request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eoa request failed")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -2497,15 +2485,15 @@ H5FD_get_eoa(H5FD_t *file)
{
haddr_t ret_value;
- FUNC_ENTER_NOAPI(H5FD_get_eoa, HADDR_UNDEF);
+ FUNC_ENTER_NOAPI(H5FD_get_eoa, HADDR_UNDEF)
assert(file && file->cls);
/* Dispatch to driver */
if (HADDR_UNDEF==(ret_value=(file->cls->get_eoa)(file)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -2541,21 +2529,21 @@ H5FDset_eoa(H5FD_t *file, haddr_t addr)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5FDset_eoa, FAIL);
+ FUNC_ENTER_API(H5FDset_eoa, FAIL)
H5TRACE2("e","xa",file,addr);
/* Check args */
if (!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
if (!H5F_addr_defined(addr) || addr>file->maxaddr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid end-of-address value");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid end-of-address value")
/* The real work */
if (H5FD_set_eoa(file, addr)<0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file set eoa request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file set eoa request failed")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -2580,17 +2568,17 @@ H5FD_set_eoa(H5FD_t *file, haddr_t addr)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_set_eoa, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_set_eoa, FAIL)
assert(file && file->cls);
assert(H5F_addr_defined(addr) && addr<=file->maxaddr);
/* Dispatch to driver */
if ((file->cls->set_eoa)(file, addr)<0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver set_eoa request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver set_eoa request failed")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -2625,19 +2613,19 @@ H5FDget_eof(H5FD_t *file)
{
haddr_t ret_value;
- FUNC_ENTER_API(H5FDget_eof, HADDR_UNDEF);
+ FUNC_ENTER_API(H5FDget_eof, HADDR_UNDEF)
H5TRACE1("a","x",file);
/* Check arguments */
if (!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer")
/* The real work */
if (HADDR_UNDEF==(ret_value=H5FD_get_eof(file)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eof request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eof request failed")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -2662,20 +2650,20 @@ H5FD_get_eof(H5FD_t *file)
{
haddr_t ret_value;
- FUNC_ENTER_NOAPI(H5FD_get_eof, HADDR_UNDEF);
+ FUNC_ENTER_NOAPI(H5FD_get_eof, HADDR_UNDEF)
assert(file && file->cls);
/* Dispatch to driver */
if (file->cls->get_eof) {
if (HADDR_UNDEF==(ret_value=(file->cls->get_eof)(file)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eof request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eof request failed")
} else {
ret_value = file->maxaddr;
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -2706,28 +2694,28 @@ H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5FDread, FAIL);
+ FUNC_ENTER_API(H5FDread, FAIL)
H5TRACE6("e","xMtiazx",file,type,dxpl_id,addr,size,buf);
/* Check args */
if (!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
/* Get the default dataset transfer property list if the user didn't provide one */
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");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
if (!buf)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null result buffer");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null result buffer")
/* Do the real work */
if (H5FD_read(file, type, dxpl_id, addr, size, buf)<0)
- HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file read request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file read request failed")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -2757,7 +2745,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_read, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_read, FAIL)
assert(file && file->cls);
assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id));
@@ -2769,7 +2757,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
/* collective transfer. */
/* The no-op case */
if (0==size)
- HGOTO_DONE(SUCCEED);
+ HGOTO_DONE(SUCCEED)
#endif /* H5_HAVE_PARALLEL */
/* Check if this information is in the metadata accumulator */
@@ -2793,7 +2781,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
/* Dispatch to driver */
if ((file->cls->read)(file, type, dxpl_id, addr, amount_read, read_buf)<0)
- HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed")
/* Adjust the buffer, address & size */
read_buf+=amount_read;
@@ -2828,7 +2816,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
if(size>0 && addr>=(file->accum_loc+file->accum_size)) {
/* Dispatch to driver */
if ((file->cls->read)(file, type, dxpl_id, addr, size, read_buf)<0)
- HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed")
/* Adjust the buffer, address & size */
read_buf+=size;
@@ -2849,7 +2837,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
/* Flush current contents, if dirty */
if(file->accum_dirty) {
if ((file->cls->write)(file, H5FD_MEM_DEFAULT, dxpl_id, file->accum_loc, file->accum_size, file->meta_accum)<0)
- HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write request failed")
/* Reset accumulator dirty flag */
file->accum_dirty=FALSE;
@@ -2860,7 +2848,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
if(size>file->accum_buf_size) {
/* Grow the metadata accumulator buffer */
if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,size))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
/* Note the new buffer size */
file->accum_buf_size=size;
@@ -2873,7 +2861,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
/* Shrink the accumulator buffer */
if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,new_size))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
/* Note the new buffer size */
file->accum_buf_size=new_size;
@@ -2887,7 +2875,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
/* Read into accumulator */
if ((file->cls->read)(file, H5FD_MEM_DEFAULT, dxpl_id, file->accum_loc, file->accum_size, file->meta_accum)<0)
- HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed")
/* Copy into buffer */
HDmemcpy(buf,file->meta_accum,size);
@@ -2895,18 +2883,18 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
else {
/* Dispatch to driver */
if ((file->cls->read)(file, type, dxpl_id, addr, size, buf)<0)
- HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed")
} /* end else */
} /* end else */
} /* end if */
else {
/* Dispatch to driver */
if ((file->cls->read)(file, type, dxpl_id, addr, size, buf)<0)
- HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed")
} /* end else */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -2935,27 +2923,27 @@ H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5FDwrite, FAIL);
+ FUNC_ENTER_API(H5FDwrite, FAIL)
H5TRACE6("e","xMtiazx",file,type,dxpl_id,addr,size,buf);
/* Check args */
if (!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
/* Get the default dataset transfer property list if the user didn't provide one */
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");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
if (!buf)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null buffer");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null buffer")
/* The real work */
if (H5FD_write(file, type, dxpl_id, addr, size, buf)<0)
- HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file write request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file write request failed")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -2987,7 +2975,7 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
size_t old_offset; /* Offset of old data within the accumulator buffer */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_write, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_write, FAIL)
assert(file && file->cls);
assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id));
@@ -2999,7 +2987,7 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
/* collective transfer. */
/* The no-op case */
if (0==size)
- HGOTO_DONE(SUCCEED);
+ HGOTO_DONE(SUCCEED)
#endif /* H5_HAVE_PARALLEL */
/* Check for accumulating metadata */
@@ -3020,7 +3008,7 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
/* Reallocate the metadata accumulator buffer */
if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
} /* end if */
/* Move the existing metadata to the proper location */
@@ -3045,7 +3033,7 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
/* Reallocate the metadata accumulator buffer */
if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
} /* end if */
/* Copy the new metadata to the end */
@@ -3077,7 +3065,7 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
/* Reallocate the metadata accumulator buffer */
if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
} /* end if */
/* Calculate the proper offset of the existing metadata */
@@ -3108,7 +3096,7 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
/* Reallocate the metadata accumulator buffer */
if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
} /* end if */
/* Copy the new metadata to the end */
@@ -3130,7 +3118,7 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
/* Write out the existing metadata accumulator, with dispatch to driver */
if(file->accum_dirty) {
if ((file->cls->write)(file, H5FD_MEM_DEFAULT, dxpl_id, file->accum_loc, file->accum_size, file->meta_accum)<0)
- HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write request failed")
/* Reset accumulator dirty flag */
file->accum_dirty=FALSE;
} /* end if */
@@ -3140,7 +3128,7 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
if(size>file->accum_buf_size) {
/* Grow the metadata accumulator buffer */
if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,size))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
/* Note the new buffer size */
file->accum_buf_size=size;
@@ -3153,7 +3141,7 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
/* Shrink the accumulator buffer */
if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,tmp_size))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
/* Note the new buffer size */
file->accum_buf_size=tmp_size;
@@ -3175,7 +3163,7 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
if(size>file->accum_buf_size) {
/* Reallocate the metadata accumulator buffer */
if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,size))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
/* Note the new buffer size */
file->accum_buf_size=size;
@@ -3193,11 +3181,11 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
else {
/* Dispatch to driver */
if ((file->cls->write)(file, type, dxpl_id, addr, size, buf)<0)
- HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write request failed")
} /* end else */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -3225,24 +3213,24 @@ H5FDflush(H5FD_t *file, hid_t dxpl_id, unsigned closing)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5FDflush, FAIL);
+ FUNC_ENTER_API(H5FDflush, FAIL)
H5TRACE3("e","xiIu",file,dxpl_id,closing);
/* Check args */
if (!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
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");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
/* Do the real work */
if (H5FD_flush(file,dxpl_id,closing)<0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file flush request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file flush request failed")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -3269,7 +3257,7 @@ H5FD_flush(H5FD_t *file, hid_t dxpl_id, unsigned closing)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_flush, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_flush, FAIL)
assert(file && file->cls);
@@ -3278,17 +3266,17 @@ H5FD_flush(H5FD_t *file, hid_t dxpl_id, unsigned closing)
/* Flush the metadata contents */
/* Not certain if the type and dxpl should be the way they are... -QAK */
if ((file->cls->write)(file, H5FD_MEM_DEFAULT, dxpl_id, file->accum_loc, file->accum_size, file->meta_accum)<0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver write request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver write request failed")
/* Reset the dirty flag */
file->accum_dirty=FALSE;
} /* end if */
if (file->cls->flush && (file->cls->flush)(file,dxpl_id,closing)<0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver flush request failed");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver flush request failed")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -3313,7 +3301,7 @@ H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_get_fileno, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_get_fileno, FAIL)
assert(file);
assert(filenum);
@@ -3322,7 +3310,7 @@ H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum)
HDmemcpy(filenum,&file->fileno,sizeof(file->fileno));
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_get_fileno() */
@@ -3345,7 +3333,7 @@ herr_t H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle)
{
herr_t ret_value;
- FUNC_ENTER_API(H5FDget_vfd_handle, FAIL);
+ FUNC_ENTER_API(H5FDget_vfd_handle, FAIL)
/* Check arguments */
assert(file);
@@ -3353,7 +3341,7 @@ herr_t H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle)
ret_value=H5FD_get_vfd_handle(file, fapl, file_handle);
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -3375,12 +3363,12 @@ herr_t H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle)
{
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(H5FD_get_vfd_handle, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_get_vfd_handle, FAIL)
assert(file_handle);
if(file->cls->get_handle && ((ret_value=file->cls->get_handle(file, fapl, file_handle)) < 0))
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}