summaryrefslogtreecommitdiffstats
path: root/src/H5FD.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-12-29 14:26:20 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-12-29 14:26:20 (GMT)
commit427ff7da2848042f68ecfadf5a321b1d8077e9db (patch)
tree73024b1954031fbb724c2d96a485590348e5cc22 /src/H5FD.c
parent9b96fd2003ae74cca389cc4c2216b4371d6eb173 (diff)
downloadhdf5-427ff7da2848042f68ecfadf5a321b1d8077e9db.zip
hdf5-427ff7da2848042f68ecfadf5a321b1d8077e9db.tar.gz
hdf5-427ff7da2848042f68ecfadf5a321b1d8077e9db.tar.bz2
[svn-r9727] Purpose:
Bug Fix/Code Cleanup/Doc Cleanup/Optimization/Branch Sync :-) Description: Generally speaking, this is the "signed->unsigned" change to selections. However, in the process of merging code back, things got stickier and stickier until I ended up doing a big "sync the two branches up" operation. So... I brought back all the "infrastructure" fixes from the development branch to the release branch (which I think were actually making some improvement in performance) as well as fixed several bugs which had been fixed in one branch, but not the other. I've also tagged the repository before making this checkin with the label "before_signed_unsigned_changes". Platforms tested: FreeBSD 4.10 (sleipnir) w/parallel & fphdf5 FreeBSD 4.10 (sleipnir) w/threadsafe FreeBSD 4.10 (sleipnir) w/backward compatibility Solaris 2.7 (arabica) w/"purify options" Solaris 2.8 (sol) w/FORTRAN & C++ AIX 5.x (copper) w/parallel & FORTRAN IRIX64 6.5 (modi4) w/FORTRAN Linux 2.4 (heping) w/FORTRAN & C++ Misc. update:
Diffstat (limited to 'src/H5FD.c')
-rw-r--r--src/H5FD.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/H5FD.c b/src/H5FD.c
index 2c5465b..30ec0eb 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -50,7 +50,7 @@
#include "H5FDstream.h" /* In-memory files streamed via sockets */
#include "H5FLprivate.h" /* Free lists */
#ifdef H5_HAVE_FPHDF5
-#include "H5FPprivate.h" /*Flexible Parallel HDF5 */
+#include "H5FPprivate.h" /* Flexible Parallel HDF5 */
#endif /* H5_HAVE_FPHDF5 */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
@@ -121,7 +121,7 @@ H5FD_init_interface(void)
FUNC_ENTER_NOAPI_NOINIT(H5FD_init_interface)
- if (H5I_register_type(H5I_VFL, H5I_VFL_HASHSIZE, 0, (H5I_free_t)H5FD_free_cls)<0)
+ if (H5I_register_type(H5I_VFL, H5I_VFL_HASHSIZE, 0, (H5I_free_t)H5FD_free_cls)<H5I_FILE)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface")
/* Reset the file serial numbers */
@@ -160,7 +160,7 @@ H5FD_term_interface(void)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_term_interface)
if (H5_interface_initialize_g) {
- if ((n=H5I_nmembers(H5I_VFL))) {
+ if ((n=H5I_nmembers(H5I_VFL))!=0) {
H5I_clear_type(H5I_VFL, FALSE);
/* Reset the VFL drivers, if they've been closed */
@@ -634,7 +634,8 @@ H5FD_pl_close(hid_t driver_id, herr_t (*free_func)(void *), void *pl)
H5MM_xfree(pl);
/* Decrement reference count for driver */
- H5I_dec_ref(driver_id);
+ if(H5I_dec_ref(driver_id)<0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't decrement reference count for driver")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1472,7 +1473,7 @@ H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
/* Check args */
if (!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer")
- if (type<0 || 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)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "zero-size request")
@@ -1533,7 +1534,7 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
/* check args */
assert(file);
assert(file->cls);
- assert(type >= 0 && type < H5FD_MEM_NTYPES);
+ assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
assert(size > 0);
#ifdef H5_HAVE_FPHDF5
@@ -1614,7 +1615,7 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type,
FUNC_ENTER_NOAPI(H5FD_alloc_from_free_list, HADDR_UNDEF)
assert(file);
- assert(type >= 0 && type < H5FD_MEM_NTYPES);
+ assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
assert(size > 0);
/*
@@ -1636,7 +1637,7 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type,
* 2. block address is aligned with smallest size > requested size;
* 3. block address is not aligned with smallest size >= requested size.
*/
- if (mapped_type >= 0 && (file->maxsize == 0 || size <= file->maxsize)) {
+ if (mapped_type >= H5FD_MEM_DEFAULT && (file->maxsize == 0 || size <= file->maxsize)) {
H5FD_free_t *prev = NULL, *best = NULL;
H5FD_free_t *cur = file->fl[mapped_type];
int found_aligned = 0;
@@ -1792,7 +1793,7 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type,
if((tmp = H5FL_MALLOC(H5FD_free_t))==NULL)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "free block allocation failed")
- if ((tmp->size = (best->size - (head + size)))) {
+ if ((tmp->size = (best->size - (head + size)))!=0) {
tmp->addr = best->addr + (head + size);
tmp->next = best->next;
best->next = tmp;
@@ -1836,7 +1837,7 @@ H5FD_alloc_metadata(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
/* check args */
assert(file);
- assert(type >= 0 && type < H5FD_MEM_NTYPES);
+ assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
assert(size > 0);
/*
@@ -1951,7 +1952,7 @@ H5FD_alloc_raw(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
/* check args */
assert(file);
- assert(type >= 0 && type < H5FD_MEM_NTYPES);
+ assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
assert(size > 0);
/*
@@ -2068,7 +2069,7 @@ H5FD_real_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
/* check args */
assert(file);
assert(file->cls);
- assert(type >= 0 && type < H5FD_MEM_NTYPES);
+ assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
assert(size > 0);
/*
@@ -2114,7 +2115,7 @@ H5FD_update_eoa(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
/* check args */
assert(file);
assert(file->cls);
- assert(type >= 0 && type < H5FD_MEM_NTYPES);
+ assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
assert(size > 0);
eoa = file->cls->get_eoa(file);
@@ -2206,7 +2207,7 @@ H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t siz
/* Check args */
if (!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
- if (type<0 || 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)
dxpl_id= H5P_DATASET_XFER_DEFAULT;
@@ -2254,7 +2255,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si
/* Check args */
assert(file);
assert(file->cls);
- assert(type >= 0 && type < H5FD_MEM_NTYPES);
+ assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
#ifdef H5_HAVE_FPHDF5
/*
@@ -2296,7 +2297,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si
* without ever telling the driver that it was freed. Otherwise let the
* driver deallocate the memory.
*/
- if (mapped_type>=0) {
+ if (mapped_type>=H5FD_MEM_DEFAULT) {
H5FD_free_t *last; /* Last merged node */
H5FD_free_t *last_prev=NULL;/* Pointer to node before merged node */
H5FD_free_t *curr; /* Current free block being inspected */
@@ -3751,7 +3752,7 @@ done:
*-------------------------------------------------------------------------
*/
hssize_t
-H5FD_get_freespace(H5FD_t *file)
+H5FD_get_freespace(const H5FD_t *file)
{
H5FD_free_t *free_node; /* Pointer to node on free list */
H5FD_mem_t type; /* Type of memory */
@@ -3771,7 +3772,7 @@ H5FD_get_freespace(H5FD_t *file)
/* Iterate through the free list, accumulating the amount of free space for this type */
free_node = file->fl[type];
while(free_node) {
- ret_value+=free_node->size;
+ ret_value+=(hssize_t)free_node->size;
free_node=free_node->next;
} /* end while */
} /* end for */