diff options
Diffstat (limited to 'src/H5FDmpiposix.c')
-rw-r--r-- | src/H5FDmpiposix.c | 62 |
1 files changed, 22 insertions, 40 deletions
diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c index 092cd24..978494e 100644 --- a/src/H5FDmpiposix.c +++ b/src/H5FDmpiposix.c @@ -71,21 +71,6 @@ */ static hid_t H5FD_MPIPOSIX_g = 0; -/* Since Windows doesn't follow the rest of the world when it comes - * to POSIX I/O types, some typedefs and constants are needed to avoid - * making the code messy with #ifdefs. - */ -#ifdef H5_HAVE_WIN32_API -typedef unsigned int h5_mpiposix_io_t; -typedef int h5_mpiposix_io_ret_t; -static int H5_MPIPOSIX_MAX_IO_BYTES_g = INT_MAX; -#else -/* Unix, everyone else */ -typedef size_t h5_mpiposix_io_t; -typedef ssize_t h5_mpiposix_io_ret_t; -static size_t H5_MPIPOSIX_MAX_IO_BYTES_g = SSIZET_MAX; -#endif /* H5_HAVE_WIN32_API */ - /* * The description of a file belonging to this driver. * The EOF value is only used just after the file is opened in order for the @@ -238,19 +223,16 @@ static const H5FD_class_mpi_t H5FD_mpiposix_g = { }; -/*-------------------------------------------------------------------------- -NAME - H5FD_mpiposix_init_interface -- Initialize interface-specific information -USAGE - herr_t H5FD_mpiposix_init_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5FD_mpiposix_init currently). - ---------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------- + * Function: H5FD_mpiposix_init_interface + * + * Purpose: Initializes any interface-specific data or routines. + * + * Return: Success: The driver ID for the mpiposix driver. + * Failure: Negative. + * + *------------------------------------------------------------------------- + */ static herr_t H5FD_mpiposix_init_interface(void) { @@ -1081,16 +1063,16 @@ H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, */ while(size > 0) { - h5_mpiposix_io_t bytes_in = 0; /* # of bytes to read */ - h5_mpiposix_io_ret_t bytes_read = -1; /* # of bytes actually read */ + h5_posix_io_t bytes_in = 0; /* # of bytes to read */ + h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ /* Trying to read more bytes than the return type can handle is * undefined behavior in POSIX. */ - if(size > H5_MPIPOSIX_MAX_IO_BYTES_g) - bytes_in = H5_MPIPOSIX_MAX_IO_BYTES_g; + if(size > H5_POSIX_MAX_IO_BYTES) + bytes_in = H5_POSIX_MAX_IO_BYTES; else - bytes_in = (h5_mpiposix_io_t)size; + bytes_in = (h5_posix_io_t)size; do { bytes_read = HDread(file->fd, buf, bytes_in); @@ -1101,7 +1083,7 @@ H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, time_t mytime = HDtime(NULL); HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, file descriptor = %d, errno = %d, error message = '%s', buf = %p, size = %lu, offset = %llu", HDctime(&mytime), file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long)size, (unsigned long long)myoffset); + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, file descriptor = %d, errno = %d, error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)myoffset); } /* end if */ if(0 == bytes_read) { @@ -1265,16 +1247,16 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, */ while(size > 0) { - h5_mpiposix_io_t bytes_in = 0; /* # of bytes to write */ - h5_mpiposix_io_ret_t bytes_wrote = -1; /* # of bytes actually written */ + h5_posix_io_t bytes_in = 0; /* # of bytes to write */ + h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes actually written */ /* Trying to write more bytes than the return type can handle is * undefined behavior in POSIX. */ - if(size > H5_MPIPOSIX_MAX_IO_BYTES_g) - bytes_in = H5_MPIPOSIX_MAX_IO_BYTES_g; + if(size > H5_POSIX_MAX_IO_BYTES) + bytes_in = H5_POSIX_MAX_IO_BYTES; else - bytes_in = (h5_mpiposix_io_t)size; + bytes_in = (h5_posix_io_t)size; do { bytes_wrote = HDwrite(file->fd, buf, bytes_in); @@ -1285,7 +1267,7 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, time_t mytime = HDtime(NULL); HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file write failed: time = %s, file descriptor = %d, errno = %d, error message = '%s', buf = %p, size = %lu, offset = %llu", HDctime(&mytime), file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long)size, (unsigned long long)myoffset); + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file write failed: time = %s, file descriptor = %d, errno = %d, error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)myoffset); } /* end if */ if(0 == bytes_wrote) { |