summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5FDcore.c4
-rw-r--r--src/H5FDlog.c21
-rw-r--r--src/H5FDprivate.h2
-rw-r--r--src/H5FDsec2.c21
4 files changed, 48 insertions, 0 deletions
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index 97437de..66c08ad 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -386,7 +386,9 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size)
int myerrno = errno;
time_t mytime = HDtime(NULL);
+#ifndef H5_HAVE_PREADWRITE
offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+#endif /* H5_HAVE_PREADWRITE */
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write to backing store failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', ptr = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), ptr, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)offset);
} /* end if */
@@ -910,7 +912,9 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
int myerrno = errno;
time_t mytime = HDtime(NULL);
+#ifndef H5_HAVE_PREADWRITE
offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+#endif /* H5_HAVE_PREADWRITE */
HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', file->mem = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), file->mem, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)offset);
} /* end if */
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 5d1b536..cbd475f 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -81,8 +81,10 @@ typedef struct H5FD_log_t {
int fd; /* the unix file */
haddr_t eoa; /* end of allocated region */
haddr_t eof; /* end of file; current file size */
+#ifndef H5_HAVE_PREADWRITE
haddr_t pos; /* current file I/O position */
H5FD_file_op_t op; /* last operation */
+#endif /* H5_HAVE_PREADWRITE */
hbool_t ignore_disabled_file_locks;
char filename[H5FD_MAX_FILENAME_LEN]; /* Copy of file name from open operation */
#ifndef H5_HAVE_WIN32_API
@@ -571,8 +573,10 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
file->fd = fd;
H5_CHECKED_ASSIGN(file->eof, haddr_t, sb.st_size, h5_stat_size_t);
+#ifndef H5_HAVE_PREADWRITE
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
+#endif /* H5_HAVE_PREADWRITE */
#ifdef H5_HAVE_WIN32_API
file->hFile = (HANDLE)_get_osfhandle(fd);
if(INVALID_HANDLE_VALUE == file->hFile)
@@ -1280,7 +1284,9 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
int myerrno = errno;
time_t mytime = HDtime(NULL);
+#ifndef H5_HAVE_PREADWRITE
offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+#endif /* H5_HAVE_PREADWRITE */
if(file->fa.flags & H5FD_LOG_LOC_READ)
HDfprintf(file->logfp, "Error! Reading: %10a-%10a (%10Zu bytes)\n", orig_addr, (orig_addr + orig_size) - 1, orig_size);
@@ -1337,15 +1343,19 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
HDfprintf(file->logfp, "\n");
} /* end if */
+#ifndef H5_HAVE_PREADWRITE
/* Update current position */
file->pos = addr;
file->op = OP_READ;
+#endif /* H5_HAVE_PREADWRITE */
done:
if(ret_value < 0) {
+#ifndef H5_HAVE_PREADWRITE
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
+#endif /* H5_HAVE_PREADWRITE */
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -1489,7 +1499,9 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
int myerrno = errno;
time_t mytime = HDtime(NULL);
+#ifndef H5_HAVE_PREADWRITE
offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+#endif /* H5_HAVE_PREADWRITE */
if(file->fa.flags & H5FD_LOG_LOC_WRITE)
HDfprintf(file->logfp, "Error! Writing: %10a-%10a (%10Zu bytes)\n", orig_addr, (orig_addr + orig_size) - 1, orig_size);
@@ -1541,17 +1553,24 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
HDfprintf(file->logfp, "\n");
} /* end if */
+#ifndef H5_HAVE_PREADWRITE
/* Update current position and eof */
file->pos = addr;
file->op = OP_WRITE;
if(file->pos > file->eof)
file->eof = file->pos;
+#else /* H5_HAVE_PREADWRITE */
+ if(addr > file->eof)
+ file->eof = addr;
+#endif /* H5_HAVE_PREADWRITE */
done:
if(ret_value < 0) {
+#ifndef H5_HAVE_PREADWRITE
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
+#endif /* H5_HAVE_PREADWRITE */
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -1656,9 +1675,11 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_
/* Update the eof value */
file->eof = file->eoa;
+#ifndef H5_HAVE_PREADWRITE
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
+#endif /* H5_HAVE_PREADWRITE */
} /* end if */
done:
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index 7d5b66d..7ac63b7 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -59,12 +59,14 @@ typedef struct H5FD_class_mpi_t {
/* Library Private Typedefs */
/****************************/
+#ifndef H5_HAVE_PREADWRITE
/* File operations */
typedef enum {
OP_UNKNOWN = 0, /* Unknown last file operation */
OP_READ = 1, /* Last file I/O operation was a read */
OP_WRITE = 2 /* Last file I/O operation was a write */
} H5FD_file_op_t;
+#endif /* H5_HAVE_PREADWRITE */
/* Define structure to hold initial file image and other relevant information */
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index 147d08f..6a16838 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -58,8 +58,10 @@ typedef struct H5FD_sec2_t {
int fd; /* the filesystem file descriptor */
haddr_t eoa; /* end of allocated region */
haddr_t eof; /* end of file; current file size */
+#ifndef H5_HAVE_PREADWRITE
haddr_t pos; /* current file I/O position */
H5FD_file_op_t op; /* last operation */
+#endif /* H5_HAVE_PREADWRITE */
hbool_t ignore_disabled_file_locks;
char filename[H5FD_MAX_FILENAME_LEN]; /* Copy of file name from open operation */
#ifndef H5_HAVE_WIN32_API
@@ -369,8 +371,10 @@ H5FD__sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
file->fd = fd;
H5_CHECKED_ASSIGN(file->eof, haddr_t, sb.st_size, h5_stat_size_t);
+#ifndef H5_HAVE_PREADWRITE
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
+#endif /* H5_HAVE_PREADWRITE */
#ifdef H5_HAVE_WIN32_API
file->hFile = (HANDLE)_get_osfhandle(fd);
if(INVALID_HANDLE_VALUE == file->hFile)
@@ -748,7 +752,9 @@ H5FD__sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
int myerrno = errno;
time_t mytime = HDtime(NULL);
+#ifndef H5_HAVE_PREADWRITE
offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+#endif /* H5_HAVE_PREADWRITE */
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%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->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)offset);
} /* end if */
@@ -767,15 +773,19 @@ H5FD__sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
buf = (char *)buf + bytes_read;
} /* end while */
+#ifndef H5_HAVE_PREADWRITE
/* Update current position */
file->pos = addr;
file->op = OP_READ;
+#endif /* H5_HAVE_PREADWRITE */
done:
if(ret_value < 0) {
+#ifndef H5_HAVE_PREADWRITE
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
+#endif /* H5_HAVE_PREADWRITE */
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -851,7 +861,9 @@ H5FD__sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN
int myerrno = errno;
time_t mytime = HDtime(NULL);
+#ifndef H5_HAVE_PREADWRITE
offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+#endif /* H5_HAVE_PREADWRITE */
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%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->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)offset);
} /* end if */
@@ -864,17 +876,24 @@ H5FD__sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN
buf = (const char *)buf + bytes_wrote;
} /* end while */
+#ifndef H5_HAVE_PREADWRITE
/* Update current position and eof */
file->pos = addr;
file->op = OP_WRITE;
if(file->pos > file->eof)
file->eof = file->pos;
+#else /* H5_HAVE_PREADWRITE */
+ if(addr > file->eof)
+ file->eof = addr;
+#endif /* H5_HAVE_PREADWRITE */
done:
if(ret_value < 0) {
+#ifndef H5_HAVE_PREADWRITE
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
+#endif /* H5_HAVE_PREADWRITE */
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -940,9 +959,11 @@ H5FD__sec2_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR
/* Update the eof value */
file->eof = file->eoa;
+#ifndef H5_HAVE_PREADWRITE
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
+#endif /* H5_HAVE_PREADWRITE */
} /* end if */
done: