summaryrefslogtreecommitdiffstats
path: root/src/H5FDgass.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-08-21 18:24:28 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-08-21 18:24:28 (GMT)
commit28f555604c12561c4bbde4c83283c6651638ce6b (patch)
tree9437dcf1472653735b63df1239d65747c9cf0e06 /src/H5FDgass.c
parent942db9322725b3d73ecc1db1892fe12752b06519 (diff)
downloadhdf5-28f555604c12561c4bbde4c83283c6651638ce6b.zip
hdf5-28f555604c12561c4bbde4c83283c6651638ce6b.tar.gz
hdf5-28f555604c12561c4bbde4c83283c6651638ce6b.tar.bz2
[svn-r7387] Purpose:
Code cleanup Description: More de-linting Platforms tested: FreeBSD 4.8 (sleipnir) too small to need h5committest
Diffstat (limited to 'src/H5FDgass.c')
-rw-r--r--src/H5FDgass.c126
1 files changed, 65 insertions, 61 deletions
diff --git a/src/H5FDgass.c b/src/H5FDgass.c
index dbbc249..0f888b8 100644
--- a/src/H5FDgass.c
+++ b/src/H5FDgass.c
@@ -19,14 +19,19 @@
* Purpose: This is the GASS I/O driver.
*
*/
-#include "H5private.h" /*library functions */
-#include "H5Eprivate.h" /*error handling */
-#include "H5Fprivate.h" /*files */
-#include "H5FDprivate.h" /*file driver */
-#include "H5FDgass.h" /* Core file driver */
-#include "H5Iprivate.h" /*object IDs */
-#include "H5MMprivate.h" /* Memory allocation */
-#include "H5Pprivate.h" /*property lists */
+
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5FD_gass_mask
+
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files access */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5FDgass.h" /* GASS file driver */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
#ifdef H5_HAVE_GASS
@@ -170,7 +175,6 @@ static const H5FD_class_t H5FD_gass_g = {
};
/* Interface initialization */
-#define PABLO_MASK H5FD_gass_mask
#define INTERFACE_INIT H5FD_gass_init
static int interface_initialize_g = 0;
@@ -197,7 +201,7 @@ H5FD_gass_init(void)
{
hid_t ret_value=H5FD_GASS_g; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_gass_init, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_gass_init, FAIL)
if (!H5FD_GASS_g)
H5FD_GASS_g = H5FDregister(&H5FD_gass_g);
@@ -209,7 +213,7 @@ H5FD_gass_init(void)
ret_value=H5FD_GASS_g;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -248,12 +252,12 @@ H5Pset_fapl_gass(hid_t fapl_id, GASS_Info info)
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value;
- FUNC_ENTER_API(H5Pset_fapl_gass, FAIL);
+ FUNC_ENTER_API(H5Pset_fapl_gass, FAIL)
/*NO TRACE*/
/* Check arguments */
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
#ifdef LATER
#warning "We need to verify that INFO contain sensible information."
@@ -265,7 +269,7 @@ H5Pset_fapl_gass(hid_t fapl_id, GASS_Info info)
ret_value= H5P_set_driver(plist, H5FD_GASS, &fa);
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -301,21 +305,21 @@ H5Pget_fapl_gass(hid_t fapl_id, GASS_Info *info/*out*/)
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Pget_fapl_gass, FAIL);
+ FUNC_ENTER_API(H5Pget_fapl_gass, FAIL)
H5TRACE2("e","ix",fapl_id,info);
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
if (H5FD_GASS!=H5P_get_driver(plist))
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver");
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver")
if (NULL==(fa=H5P_get_driver_info(plist)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info");
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info")
if (info)
*info = fa->info;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -355,23 +359,23 @@ H5FD_gass_open(const char *name, unsigned flags, hid_t fapl_id,
h5_stat_t sb;
H5FD_t *ret_value;
- FUNC_ENTER_NOAPI(H5FD_gass_open, NULL);
+ FUNC_ENTER_NOAPI(H5FD_gass_open, NULL)
/* fprintf(stdout, "Entering H5FD_gass_open name=%s flags=0x%x\n", name, flags); */
/* Check arguments */
if (!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name")
if (0==maxaddr || HADDR_UNDEF==maxaddr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr")
if (ADDR_OVERFLOW(maxaddr))
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr")
strcpy (filename, name);
/* Obtain a pointer to gass-specific file access properties */
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
if (H5P_FILE_ACCESS_DEFAULT==fapl_id || H5FD_GASS!=H5P_get_driver(plist)) {
GASS_INFO_NULL (_fa.info);
/* _fa.info = GASS_INFO_NULL; */
@@ -404,37 +408,37 @@ H5FD_gass_open(const char *name, unsigned flags, hid_t fapl_id,
if ((flags & H5F_ACC_CREAT) && (flags & H5F_ACC_RDWR) && (flags & H5F_ACC_EXCL)) {
if ((fd = globus_gass_open (filename, O_RDWR|O_TRUNC)) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTOPENFILE, NULL, "open failed");
+ HGOTO_ERROR(H5E_IO, H5E_CANTOPENFILE, NULL, "open failed")
}
else if ((flags & H5F_ACC_CREAT) && (flags & H5F_ACC_RDWR) && (flags & H5F_ACC_TRUNC)) {
if ((fd = globus_gass_open (filename, O_RDWR|O_TRUNC)) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTOPENFILE, NULL, "open failed");
+ HGOTO_ERROR(H5E_IO, H5E_CANTOPENFILE, NULL, "open failed")
}
else if ((flags & H5F_ACC_RDWR) && (flags & H5F_ACC_TRUNC)) {
if ((fd = globus_gass_open (filename, O_RDWR|O_TRUNC)) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTOPENFILE, NULL, "open failed");
+ HGOTO_ERROR(H5E_IO, H5E_CANTOPENFILE, NULL, "open failed")
}
else if (flags & H5F_ACC_RDWR) {
if ((fd = globus_gass_open (filename, O_RDWR)) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTOPENFILE, NULL, "open failed");
+ HGOTO_ERROR(H5E_IO, H5E_CANTOPENFILE, NULL, "open failed")
}
else { /* This is case where H5F_ACC_RDWR is not set */
if ((fd = globus_gass_open (filename, O_RDONLY)) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTOPENFILE, NULL, "open failed");
+ HGOTO_ERROR(H5E_IO, H5E_CANTOPENFILE, NULL, "open failed")
}
if (HDfstat(fd, &sb)<0) {
close(fd);
- HGOTO_ERROR(H5E_IO, H5E_BADFILE, NULL, "fstat failed");
+ HGOTO_ERROR(H5E_IO, H5E_BADFILE, NULL, "fstat failed")
}
/* Create the new file struct */
if (NULL==(file=H5MM_calloc(sizeof(H5FD_gass_t))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate file struct");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate file struct")
file->fd = fd;
file->eof = sb.st_size;
file->pos = HADDR_UNDEF;
@@ -445,7 +449,7 @@ H5FD_gass_open(const char *name, unsigned flags, hid_t fapl_id,
ret_value=(H5FD_t*)file;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -471,18 +475,18 @@ H5FD_gass_close (H5FD_t *_file)
H5FD_gass_t *file = (H5FD_gass_t *)_file;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_gass_close, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_gass_close, FAIL)
if (file == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file handle");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file handle")
if (globus_gass_close (file->fd) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "can't close GASS file");
+ HGOTO_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "can't close GASS file")
H5MM_xfree(file);
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -508,7 +512,7 @@ H5FD_gass_query(const UNUSED H5FD_t *_f, unsigned long *flags /* out */)
{
herr_t ret_value=SUCCEED;
- FUNC_ENTER_NOAPI(H5FD_gass_query, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_gass_query, FAIL)
/* Set the VFL feature flags that this driver supports */
if(flags) {
@@ -518,7 +522,7 @@ H5FD_gass_query(const UNUSED H5FD_t *_f, unsigned long *flags /* out */)
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -546,13 +550,13 @@ H5FD_gass_get_eoa(H5FD_t *_file)
H5FD_gass_t *file = (H5FD_gass_t *)_file;
haddr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_gass_get_eoa, HADDR_UNDEF);
+ FUNC_ENTER_NOAPI(H5FD_gass_get_eoa, HADDR_UNDEF)
/* Set return value */
ret_value=file->eoa;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -578,12 +582,12 @@ H5FD_gass_set_eoa(H5FD_t *_file, haddr_t addr)
H5FD_gass_t *file = (H5FD_gass_t *)_file;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_gass_set_eoa, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_gass_set_eoa, FAIL)
file->eoa = addr;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -613,13 +617,13 @@ H5FD_gass_get_eof(H5FD_t *_file)
H5FD_gass_t *file = (H5FD_gass_t*)_file;
haddr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_gass_get_eof, HADDR_UNDEF);
+ FUNC_ENTER_NOAPI(H5FD_gass_get_eof, HADDR_UNDEF)
/* Set return value */
ret_value=MAX(file->eof, file->eoa);
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -643,15 +647,15 @@ H5FD_gass_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void** file_handle)
H5FD_gass_t *file = (H5FD_gass_t *)_file;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(H5FD_gass_get_handle, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_gass_get_handle, FAIL)
if(!file_handle)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid")
*file_handle = &(file->fd);
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -681,25 +685,25 @@ H5FD_gass_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id/*unused*/, h
ssize_t nbytes;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_gass_read, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_gass_read, FAIL)
assert(file && file->pub.cls);
assert(buf);
/* Check for overflow conditions */
if (HADDR_UNDEF==addr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "addr undefined");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "addr undefined")
if (REGION_OVERFLOW(addr, size))
- HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr too large");
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr too large")
if (addr+size>file->eoa)
- HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr too large");
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr too large")
/* Seek to the correct location */
if ((addr!=file->pos || OP_READ!=file->op) &&
file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0) {
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
- HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "gass file seek failed");
+ HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "gass file seek failed")
}
/*
@@ -715,7 +719,7 @@ H5FD_gass_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id/*unused*/, h
/* error */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "gass file read failed");
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "gass file read failed")
}
if (0==nbytes) {
/* end of file but not end of format address space */
@@ -734,7 +738,7 @@ H5FD_gass_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id/*unused*/, h
file->op = OP_READ;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -763,25 +767,25 @@ H5FD_gass_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id/*unused*/, haddr_t
ssize_t nbytes;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_gass_write, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_gass_write, FAIL)
assert(file && file->pub.cls);
assert(buf);
/* Check for overflow conditions */
if (HADDR_UNDEF==addr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "addr undefined");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "addr undefined")
if (REGION_OVERFLOW(addr, size))
- HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr too large");
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr too large")
if (addr+size>file->eoa)
- HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr too large");
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr too large")
/* Seek to the correct location */
if ((addr!=file->pos || OP_WRITE!=file->op) &&
file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0) {
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
- HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "gass file seek failed");
+ HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "gass file seek failed")
}
/*
@@ -797,7 +801,7 @@ H5FD_gass_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id/*unused*/, haddr_t
/* error */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "gass file write failed");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "gass file write failed")
}
assert(nbytes>0);
assert(nbytes<=size);
@@ -813,7 +817,7 @@ H5FD_gass_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id/*unused*/, haddr_t
file->eof = file->pos;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
#endif /* H5_HAVE_GASS */