summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2002-04-19 07:20:10 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2002-04-19 07:20:10 (GMT)
commitc6d695526c58f3f3906129e833883a183fb3cae6 (patch)
treecbdf2e899b6127be8d841942c2f18940387033b2
parent0dfa9a8549cc4f8c40fd84589fe74c1e7253f1ba (diff)
downloadhdf5-c6d695526c58f3f3906129e833883a183fb3cae6.zip
hdf5-c6d695526c58f3f3906129e833883a183fb3cae6.tar.gz
hdf5-c6d695526c58f3f3906129e833883a183fb3cae6.tar.bz2
[svn-r5204] Purpose:
Code cleanup Description: Platform dependent code related to the struct stat and fstat calls polluted source codes. Hard to maintain. Solution: Platform dependent code are moved to H5private.h and then internal code can #include H5private.h. Repeat those macro definition for the stdio and multi drivers since they area examples for writing a virtual file driver. They must not use any internal code. Platforms tested: eirene (parallel), modi4 (serial including gass driver.)
-rw-r--r--perform/overhead.c3
-rw-r--r--perform/pio_engine.c2
-rw-r--r--perform/pio_perf.h1
-rw-r--r--src/H5FDgass.c6
-rw-r--r--src/H5FDlog.c10
-rw-r--r--src/H5FDsec2.c10
-rw-r--r--src/H5private.h5
-rw-r--r--test/big.c2
-rw-r--r--test/h5test.c4
-rw-r--r--testpar/testphdf5.c2
10 files changed, 22 insertions, 23 deletions
diff --git a/perform/overhead.c b/perform/overhead.c
index 98dd2f2..3edbdd4 100644
--- a/perform/overhead.c
+++ b/perform/overhead.c
@@ -11,6 +11,7 @@
/* See H5private.h for how to include headers */
#undef NDEBUG
#include "hdf5.h"
+#include "H5private.h"
#ifdef H5_STDC_HEADERS
# include <ctype.h>
@@ -186,7 +187,7 @@ test(fill_t fill_style, const double splits[],
int mdc_nelmts; /*num meta objs to cache*/
hsize_t i;
int j;
- struct stat sb;
+ h5_stat_t sb;
if (!had) had = calloc(cur_size[0], sizeof(int));
if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) goto error;
diff --git a/perform/pio_engine.c b/perform/pio_engine.c
index b415638..089ed0b 100644
--- a/perform/pio_engine.c
+++ b/perform/pio_engine.c
@@ -412,7 +412,7 @@ pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t si
if ((strlen(fullname) + strlen(base_name) + 1) < size) {
/* Append the base_name with a slash first. Multiple slashes are
* handled below. */
- struct stat buf;
+ h5_stat_t buf;
if (stat(fullname, &buf) < 0)
/* The directory doesn't exist just yet */
diff --git a/perform/pio_perf.h b/perform/pio_perf.h
index 3c60756..531fc4b 100644
--- a/perform/pio_perf.h
+++ b/perform/pio_perf.h
@@ -8,6 +8,7 @@
#define PIO_PERF_H__
#include "pio_timer.h"
+#include "H5private.h"
typedef enum iotype_ {
RAW,
diff --git a/src/H5FDgass.c b/src/H5FDgass.c
index 7da8855..26d40c0 100644
--- a/src/H5FDgass.c
+++ b/src/H5FDgass.c
@@ -307,11 +307,7 @@ H5FD_gass_open(const char *name, unsigned flags, hid_t fapl_id,
H5FD_gass_t *file=NULL;
const H5FD_gass_fapl_t *fa=NULL;
H5FD_gass_fapl_t _fa;
-#ifdef WIN32
- struct _stati64 sb;
-#else
- struct stat sb;
-#endif
+ h5_stat_t sb;
char *filename = (char *) H5MM_malloc(80 * sizeof(char));
FUNC_ENTER(H5FD_gass_open, NULL);
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index a93a524..f42c5f7 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -416,13 +416,11 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id,
H5FD_log_t *file=NULL;
H5FD_log_fapl_t *fa; /* File access property list information */
#ifdef WIN32
- HFILE filehandle;
- struct _BY_HANDLE_FILE_INFORMATION fileinfo;
- int results;
- struct _stati64 sb;
-#else
- struct stat sb;
+ HFILE filehandle;
+ struct _BY_HANDLE_FILE_INFORMATION fileinfo;
+ int results;
#endif
+ h5_stat_t sb;
FUNC_ENTER(H5FD_log_open, NULL);
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index e29a2f8..5e80cb9 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -269,13 +269,11 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t UNUSED fapl_id,
int fd;
H5FD_sec2_t *file=NULL;
#ifdef WIN32
- HFILE filehandle;
- struct _BY_HANDLE_FILE_INFORMATION fileinfo;
- int results;
- struct _stati64 sb;
-#else
- struct stat sb;
+ HFILE filehandle;
+ struct _BY_HANDLE_FILE_INFORMATION fileinfo;
+ int results;
#endif
+ h5_stat_t sb;
FUNC_ENTER(H5FD_sec2_open, NULL);
diff --git a/src/H5private.h b/src/H5private.h
index fa281b9..742f762 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -547,10 +547,13 @@ __DLL__ int HDfprintf (FILE *stream, const char *fmt, ...);
/* fscanf() variable arguments */
#define HDfseek(F,O,W) fseek(F,O,W)
#define HDfsetpos(F,P) fsetpos(F,P)
+/* definitions related to the file stat utilities */
#ifdef WIN32
-#define HDfstat(F,B) _fstati64(F,B)
+#define HDfstat(F,B) _fstati64(F,B)
+typedef struct _stati64 h5_stat_t;
#else
#define HDfstat(F,B) fstat(F,B)
+typedef struct stat h5_stat_t;
#endif
#define HDftell(F) ftell(F)
#define HDfwrite(M,Z,N,F) fwrite(M,Z,N,F)
diff --git a/test/big.c b/test/big.c
index 4941995..0279e91 100644
--- a/test/big.c
+++ b/test/big.c
@@ -74,7 +74,7 @@ static int
is_sparse(void)
{
int fd;
- struct stat sb;
+ h5_stat_t sb;
if ((fd=open("x.h5", O_RDWR|O_TRUNC|O_CREAT, 0666))<0) return 0;
if (lseek(fd, (off_t)(1024*1024), SEEK_SET)!=1024*1024) return 0;
diff --git a/test/h5test.c b/test/h5test.c
index 6b43180..fd45a7e 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -12,6 +12,8 @@
#undef NDEBUG /*override -DNDEBUG */
#include "h5test.h"
+#include <sys/types.h>
+#include <sys/stat.h>
#ifdef WIN32
#include <process.h>
@@ -390,7 +392,7 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
if (strlen(fullname) + strlen(base_name) + 1 < size) {
/* Append the base_name with a slash first. Multiple slashes are
* handled below. */
- struct stat buf;
+ h5_stat_t buf;
if (stat(fullname, &buf) < 0)
/* The directory doesn't exist just yet */
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index aa1b349..71fe791 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -50,7 +50,7 @@ void pause_proc(void)
{
int pid;
- struct stat statbuf;
+ h5_stat_t statbuf;
char greenlight[] = "go";
int maxloop = 10;
int loops = 0;