From 2457d8ecaf8a2195a2966ad6e0f649473bdb7177 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 6 Sep 2011 11:50:32 -0500 Subject: [svn-r21366] JIRA HDFFV-2748 replace use of _WIN32 in source. Created new defines H5_HAVE_WIN32_API and H5_HAVE_VISUAL_STUDIO defines to use. These can be properly set during configurration. Tested: windows and local linux - reviewed internally --- config/cmake/ConfigureChecks.cmake | 10 +- config/cmake/H5pubconf.h.in | 6 + examples/h5_elink_unix2win.c | 14 +- perform/benchpar.c | 2 +- perform/iopipe.c | 306 +++++----- perform/pio_standalone.h | 56 +- perform/sio_standalone.h | 32 +- release_docs/RELEASE.txt | 4 +- src/H5FDcore.c | 16 +- src/H5FDdirect.c | 778 ++++++++++++------------ src/H5FDlog.c | 20 +- src/H5FDmpiposix.c | 604 +++++++++---------- src/H5FDsec2.c | 20 +- src/H5FDstdio.c | 427 +++++++------ src/H5FDwindows.c | 2 +- src/H5TS.c | 38 +- src/H5api_adpt.h | 22 +- src/H5private.h | 1170 ++++++++++++++++++------------------ src/H5system.c | 2 +- src/H5win32defs.h | 55 +- test/flush2.c | 4 +- test/h5test.c | 646 ++++++++++---------- test/vfd.c | 125 ++-- tools/h5import/h5import.c | 4 +- tools/h5import/h5importtest.c | 2 +- windows/src/H5pubconf.h | 6 + 26 files changed, 2190 insertions(+), 2181 deletions(-) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 145fd98..37560a5 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -129,8 +129,12 @@ ENDMACRO (CHECK_LIBRARY_EXISTS_CONCAT) SET (WINDOWS) IF (WIN32) + SET (H5_HAVE_WIN32_API 1) IF (NOT UNIX AND NOT CYGWIN AND NOT MINGW) SET (WINDOWS 1) + IF (MSVC_IDE) + SET (H5_HAVE_VISUAL_STUDIO 1) + ENDIF (MSVC_IDE) ENDIF (NOT UNIX AND NOT CYGWIN AND NOT MINGW) ENDIF (WIN32) @@ -582,7 +586,7 @@ IF (NOT WINDOWS) HDF5_FUNCTION_TEST (${test}) ENDFOREACH (test) IF (NOT CYGWIN AND NOT MINGW) - HDF5_FUNCTION_TEST (HAVE_TIMEZONE) + HDF5_FUNCTION_TEST (HAVE_TIMEZONE) # HDF5_FUNCTION_TEST (HAVE_STAT_ST_BLOCKS) ENDIF (NOT CYGWIN AND NOT MINGW) ENDIF (NOT WINDOWS) @@ -649,7 +653,7 @@ IF (WINDOWS AND NOT HDF5_NO_IOEO_TEST) ENDIF("${HAVE_IOEO_EXITCODE}" EQUAL 0) ENDIF("${H5_HAVE_IOEO}" MATCHES "^${H5_HAVE_IOEO}$") ENDIF (WINDOWS AND NOT HDF5_NO_IOEO_TEST) - + #----------------------------------------------------------------------------- # Option to see if GPFS is available on this filesystem --enable-gpfs @@ -924,4 +928,4 @@ H5ConversionTests (H5_NO_ALIGNMENT_RESTRICTIONS "Checking IF alignment restricti # problem converting from unsigned long long to long double */ IF (CYGWIN) SET (H5_CYGWIN_ULLONG_TO_LDOUBLE_ROUND_PROBLEM 1) -ENDIF (CYGWIN) +ENDIF (CYGWIN) \ No newline at end of file diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 31a0829..0b1140d 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -6,6 +6,12 @@ /* Define if the Windows virtual file driver should be compiled */ #cmakedefine H5_HAVE_WINDOWS @H5_HAVE_WINDOWS@ +/* Define if on the Windows platform and default WIN32 API */ +#cmakedefine H5_HAVE_WIN32_API @H5_HAVE_WIN32_API@ + +/* Define if using a Windows compiler (i.e. Visual Studio) */ +#cmakedefine H5_HAVE_VISUAL_STUDIO @H5_HAVE_VISUAL_STUDIO@ + /* Define if the Windows virtual file driver should use buffered IO functions */ /* #undef WINDOWS_USE_STDIO */ diff --git a/examples/h5_elink_unix2win.c b/examples/h5_elink_unix2win.c index bcbb65f..9c0918c 100644 --- a/examples/h5_elink_unix2win.c +++ b/examples/h5_elink_unix2win.c @@ -138,11 +138,11 @@ const H5L_class_t elink_unix2win_class[1] = {{ static int unix2win_example(void) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ /* Create the target file. */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API if((fid=H5Fcreate("u2w\\u2w_target.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) goto error; #else if((fid=H5Fcreate("u2w/u2w_target.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) goto error; @@ -161,7 +161,7 @@ unix2win_example(void) * that external links can be traversed. */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API /* Register the elink_unix2win class defined above to replace default * external links */ @@ -181,8 +181,8 @@ unix2win_example(void) error: printf("Error!\n"); H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } @@ -195,7 +195,7 @@ unix2win_example(void) int main(void) { - int ret; + int ret; printf("Testing unix2win external links.\n"); ret = unix2win_example(); diff --git a/perform/benchpar.c b/perform/benchpar.c index ea1195b..24146e4 100644 --- a/perform/benchpar.c +++ b/perform/benchpar.c @@ -25,7 +25,7 @@ #include "hdf5.h" /* Local macros */ -#ifdef _MSC_VER /* H5_HAVE_VISUAL_STUDIO */ +#ifdef H5_HAVE_VISUAL_STUDIO #define HDgetlogin() Wgetlogin() #else /* H5_HAVE_VISUAL_STUDIO */ #define HDgetlogin() getlogin() diff --git a/perform/iopipe.c b/perform/iopipe.c index c72e3aa..85063fa 100644 --- a/perform/iopipe.c +++ b/perform/iopipe.c @@ -28,34 +28,34 @@ #endif -#define RAW_FILE_NAME "iopipe.raw" -#define HDF5_FILE_NAME "iopipe.h5" -#define HEADING "%-16s" -#define PROGRESS '=' +#define RAW_FILE_NAME "iopipe.raw" +#define HDF5_FILE_NAME "iopipe.h5" +#define HEADING "%-16s" +#define PROGRESS '=' #if 0 /* Normal testing */ -#define REQUEST_SIZE_X 4579 -#define REQUEST_SIZE_Y 4579 -#define NREAD_REQUESTS 45 -#define NWRITE_REQUESTS 45 +#define REQUEST_SIZE_X 4579 +#define REQUEST_SIZE_Y 4579 +#define NREAD_REQUESTS 45 +#define NWRITE_REQUESTS 45 #else /* Speedy testing */ -#define REQUEST_SIZE_X 1000 -#define REQUEST_SIZE_Y 1000 -#define NREAD_REQUESTS 45 -#define NWRITE_REQUESTS 45 +#define REQUEST_SIZE_X 1000 +#define REQUEST_SIZE_Y 1000 +#define NREAD_REQUESTS 45 +#define NWRITE_REQUESTS 45 #endif /*------------------------------------------------------------------------- - * Function: print_stats + * Function: print_stats * - * Purpose: Prints statistics + * Purpose: Prints statistics * - * Return: void + * Return: void * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, March 12, 1998 * * Modifications: @@ -65,63 +65,63 @@ #ifdef H5_HAVE_GETRUSAGE static void print_stats (const char *prefix, - struct rusage *r_start, struct rusage *r_stop, - struct timeval *t_start, struct timeval *t_stop, - size_t nbytes) + struct rusage *r_start, struct rusage *r_stop, + struct timeval *t_start, struct timeval *t_stop, + size_t nbytes) #else /* H5_HAVE_GETRUSAGE */ static void print_stats (const char *prefix, - struct timeval *r_start, struct timeval *r_stop, - struct timeval *t_start, struct timeval *t_stop, - size_t nbytes) + struct timeval *r_start, struct timeval *r_stop, + struct timeval *t_start, struct timeval *t_stop, + size_t nbytes) #endif /* H5_HAVE_GETRUSAGE */ { - double e_time, bw; + double e_time, bw; #ifdef H5_HAVE_GETRUSAGE - double u_time, s_time; + double u_time, s_time; u_time = ((double)(r_stop->ru_utime.tv_sec)+ - (double)(r_stop->ru_utime.tv_usec)/1000000.0) - - ((double)(r_start->ru_utime.tv_sec)+ - (double)(r_start->ru_utime.tv_usec)/1000000.0); + (double)(r_stop->ru_utime.tv_usec)/1000000.0) - + ((double)(r_start->ru_utime.tv_sec)+ + (double)(r_start->ru_utime.tv_usec)/1000000.0); s_time = ((double)(r_stop->ru_stime.tv_sec)+ - (double)(r_stop->ru_stime.tv_usec)/1000000.0) - - ((double)(r_start->ru_stime.tv_sec)+ - (double)(r_start->ru_stime.tv_usec)/1000000.0); + (double)(r_stop->ru_stime.tv_usec)/1000000.0) - + ((double)(r_start->ru_stime.tv_sec)+ + (double)(r_start->ru_stime.tv_usec)/1000000.0); #endif #ifndef H5_HAVE_SYS_TIMEB e_time = ((double)(t_stop->tv_sec)+ - (double)(t_stop->tv_usec)/1000000.0) - - ((double)(t_start->tv_sec)+ - (double)(t_start->tv_usec)/1000000.0); + (double)(t_stop->tv_usec)/1000000.0) - + ((double)(t_start->tv_sec)+ + (double)(t_start->tv_usec)/1000000.0); #else e_time = ((double)(t_stop->tv_sec)+ - (double)(t_stop->tv_usec)/1000.0) - - ((double)(t_start->tv_sec)+ - (double)(t_start->tv_usec)/1000.0); + (double)(t_stop->tv_usec)/1000.0) - + ((double)(t_start->tv_sec)+ + (double)(t_start->tv_usec)/1000.0); #endif bw = (double)nbytes / e_time; #ifdef H5_HAVE_GETRUSAGE printf (HEADING "%1.2fuser %1.2fsystem %1.2felapsed %1.2fMB/s\n", - prefix, u_time, s_time, e_time, bw/(1024*1024)); + prefix, u_time, s_time, e_time, bw/(1024*1024)); #else printf (HEADING "%1.2felapsed %1.2fMB/s\n", - prefix, e_time, bw/(1024*1024)); + prefix, e_time, bw/(1024*1024)); #endif } /*------------------------------------------------------------------------- - * Function: synchronize + * Function: synchronize * * Purpose: * - * Return: void + * Return: void * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, March 12, 1998 * * Modifications: @@ -132,7 +132,7 @@ static void synchronize (void) { #ifdef H5_HAVE_SYSTEM -#if defined(_WIN32) && ! defined(__CYGWIN__) +#if defined(H5_HAVE_WIN32_API) && ! defined(__CYGWIN__) _flushall(); #else HDsystem("sync"); @@ -143,15 +143,15 @@ synchronize (void) /*------------------------------------------------------------------------- - * Function: main + * Function: main * * Purpose: * - * Return: Success: + * Return: Success: * - * Failure: + * Failure: * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, March 12, 1998 * * Modifications: @@ -161,29 +161,29 @@ synchronize (void) int main (void) { - static hsize_t size[2] = {REQUEST_SIZE_X, REQUEST_SIZE_Y}; - static unsigned nread = NREAD_REQUESTS, nwrite = NWRITE_REQUESTS; + static hsize_t size[2] = {REQUEST_SIZE_X, REQUEST_SIZE_Y}; + static unsigned nread = NREAD_REQUESTS, nwrite = NWRITE_REQUESTS; - unsigned char *the_data = NULL; - hid_t file, dset, file_space = -1; - herr_t status; + unsigned char *the_data = NULL; + hid_t file, dset, file_space = -1; + herr_t status; #ifdef H5_HAVE_GETRUSAGE - struct rusage r_start, r_stop; + struct rusage r_start, r_stop; #else struct timeval r_start, r_stop; #endif - struct timeval t_start, t_stop; - int fd; - unsigned u; - hssize_t n; - off_t offset; - hsize_t start[2]; - hsize_t count[2]; + struct timeval t_start, t_stop; + int fd; + unsigned u; + hssize_t n; + off_t offset; + hsize_t start[2]; + hsize_t count[2]; #ifdef H5_HAVE_SYS_TIMEB - struct _timeb *tbstart = malloc(sizeof(struct _timeb)); - struct _timeb *tbstop = malloc(sizeof(struct _timeb)); + struct _timeb *tbstart = malloc(sizeof(struct _timeb)); + struct _timeb *tbstop = malloc(sizeof(struct _timeb)); #endif /* * The extra cast in the following statement is a bug workaround for the @@ -191,7 +191,7 @@ main (void) * 1998-11-06 ptl */ printf ("I/O request size is %1.1fMB\n", - (double)(hssize_t)(size[0]*size[1])/1024.0*1024); + (double)(hssize_t)(size[0]*size[1])/1024.0*1024); /* Open the files */ file = H5Fcreate (HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -218,14 +218,14 @@ main (void) HDgettimeofday(&t_start, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstart); + _ftime(tbstart); #endif #endif fprintf (stderr, HEADING, "fill raw"); for(u = 0; u < nwrite; u++) { - putc (PROGRESS, stderr); - HDfflush(stderr); - HDmemset(the_data, 0xAA, (size_t)(size[0]*size[1])); + putc (PROGRESS, stderr); + HDfflush(stderr); + HDmemset(the_data, 0xAA, (size_t)(size[0]*size[1])); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -234,17 +234,17 @@ main (void) HDgettimeofday(&t_stop, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstop); - t_start.tv_sec = tbstart->time; - t_start.tv_usec = tbstart->millitm; - t_stop.tv_sec = tbstop->time; - t_stop.tv_usec = tbstop->millitm; + _ftime(tbstop); + t_start.tv_sec = tbstart->time; + t_start.tv_usec = tbstart->millitm; + t_stop.tv_sec = tbstop->time; + t_stop.tv_usec = tbstop->millitm; #endif #endif putc ('\n', stderr); print_stats ("fill raw", - &r_start, &r_stop, &t_start, &t_stop, - (size_t)(nread*size[0]*size[1])); + &r_start, &r_stop, &t_start, &t_stop, + (size_t)(nread*size[0]*size[1])); /* Fill hdf5 */ @@ -256,16 +256,16 @@ main (void) HDgettimeofday(&t_start, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstart); + _ftime(tbstart); #endif #endif fprintf (stderr, HEADING, "fill hdf5"); for(u = 0; u < nread; u++) { - putc (PROGRESS, stderr); - HDfflush(stderr); - status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, - H5P_DEFAULT, the_data); - assert (status>=0); + putc (PROGRESS, stderr); + HDfflush(stderr); + status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, + H5P_DEFAULT, the_data); + assert (status>=0); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -274,17 +274,17 @@ main (void) HDgettimeofday(&t_stop, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstop); - t_start.tv_sec = tbstart->time; - t_start.tv_usec = tbstart->millitm; - t_stop.tv_sec = tbstop->time; - t_stop.tv_usec = tbstop->millitm; + _ftime(tbstop); + t_start.tv_sec = tbstart->time; + t_start.tv_usec = tbstart->millitm; + t_stop.tv_sec = tbstop->time; + t_stop.tv_usec = tbstop->millitm; #endif #endif putc ('\n', stderr); print_stats ("fill hdf5", - &r_start, &r_stop, &t_start, &t_stop, - (size_t)(nread*size[0]*size[1])); + &r_start, &r_stop, &t_start, &t_stop, + (size_t)(nread*size[0]*size[1])); /* Write the raw dataset */ synchronize (); @@ -295,17 +295,17 @@ main (void) HDgettimeofday(&t_start, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstart); + _ftime(tbstart); #endif #endif fprintf (stderr, HEADING, "out raw"); for(u = 0; u < nwrite; u++) { - putc (PROGRESS, stderr); - HDfflush(stderr); - offset = HDlseek (fd, (off_t)0, SEEK_SET); - assert (0==offset); - n = HDwrite (fd, the_data, (size_t)(size[0]*size[1])); - assert (n>=0 && (size_t)n==size[0]*size[1]); + putc (PROGRESS, stderr); + HDfflush(stderr); + offset = HDlseek (fd, (off_t)0, SEEK_SET); + assert (0==offset); + n = HDwrite (fd, the_data, (size_t)(size[0]*size[1])); + assert (n>=0 && (size_t)n==size[0]*size[1]); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -314,17 +314,17 @@ main (void) HDgettimeofday(&t_stop, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstop); - t_start.tv_sec = tbstart->time; - t_start.tv_usec = tbstart->millitm; - t_stop.tv_sec = tbstop->time; - t_stop.tv_usec = tbstop->millitm; + _ftime(tbstop); + t_start.tv_sec = tbstart->time; + t_start.tv_usec = tbstart->millitm; + t_stop.tv_sec = tbstop->time; + t_stop.tv_usec = tbstop->millitm; #endif #endif putc ('\n', stderr); print_stats ("out raw", - &r_start, &r_stop, &t_start, &t_stop, - (size_t)(nread*size[0]*size[1])); + &r_start, &r_stop, &t_start, &t_stop, + (size_t)(nread*size[0]*size[1])); /* Write the hdf5 dataset */ synchronize (); @@ -335,16 +335,16 @@ main (void) HDgettimeofday(&t_start, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstart); + _ftime(tbstart); #endif #endif fprintf (stderr, HEADING, "out hdf5"); for(u = 0; u < nwrite; u++) { - putc (PROGRESS, stderr); - HDfflush(stderr); - status = H5Dwrite (dset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, - H5P_DEFAULT, the_data); - assert (status>=0); + putc (PROGRESS, stderr); + HDfflush(stderr); + status = H5Dwrite (dset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, + H5P_DEFAULT, the_data); + assert (status>=0); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -353,17 +353,17 @@ main (void) HDgettimeofday(&t_stop, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstop); - t_start.tv_sec = tbstart->time; - t_start.tv_usec = tbstart->millitm; - t_stop.tv_sec = tbstop->time; - t_stop.tv_usec = tbstop->millitm; + _ftime(tbstop); + t_start.tv_sec = tbstart->time; + t_start.tv_usec = tbstart->millitm; + t_stop.tv_sec = tbstop->time; + t_stop.tv_usec = tbstop->millitm; #endif #endif putc ('\n', stderr); print_stats ("out hdf5", - &r_start, &r_stop, &t_start, &t_stop, - (size_t)(nread*size[0]*size[1])); + &r_start, &r_stop, &t_start, &t_stop, + (size_t)(nread*size[0]*size[1])); /* Read the raw dataset */ synchronize (); @@ -374,17 +374,17 @@ main (void) HDgettimeofday(&t_start, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstart); + _ftime(tbstart); #endif #endif fprintf (stderr, HEADING, "in raw"); for(u = 0; u < nread; u++) { - putc (PROGRESS, stderr); - HDfflush(stderr); - offset = HDlseek (fd, (off_t)0, SEEK_SET); - assert (0==offset); - n = HDread (fd, the_data, (size_t)(size[0]*size[1])); - assert (n>=0 && (size_t)n==size[0]*size[1]); + putc (PROGRESS, stderr); + HDfflush(stderr); + offset = HDlseek (fd, (off_t)0, SEEK_SET); + assert (0==offset); + n = HDread (fd, the_data, (size_t)(size[0]*size[1])); + assert (n>=0 && (size_t)n==size[0]*size[1]); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -393,17 +393,17 @@ main (void) HDgettimeofday(&t_stop, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstop); - t_start.tv_sec = tbstart->time; - t_start.tv_usec = tbstart->millitm; - t_stop.tv_sec = tbstop->time; - t_stop.tv_usec = tbstop->millitm; + _ftime(tbstop); + t_start.tv_sec = tbstart->time; + t_start.tv_usec = tbstart->millitm; + t_stop.tv_sec = tbstop->time; + t_stop.tv_usec = tbstop->millitm; #endif #endif putc ('\n', stderr); print_stats ("in raw", - &r_start, &r_stop, &t_start, &t_stop, - (size_t)(nread*size[0]*size[1])); + &r_start, &r_stop, &t_start, &t_stop, + (size_t)(nread*size[0]*size[1])); /* Read the hdf5 dataset */ @@ -415,16 +415,16 @@ main (void) HDgettimeofday(&t_start, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstart); + _ftime(tbstart); #endif #endif fprintf (stderr, HEADING, "in hdf5"); for(u = 0; u < nread; u++) { - putc (PROGRESS, stderr); - HDfflush(stderr); - status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, - H5P_DEFAULT, the_data); - assert (status>=0); + putc (PROGRESS, stderr); + HDfflush(stderr); + status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, + H5P_DEFAULT, the_data); + assert (status>=0); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -433,17 +433,17 @@ main (void) HDgettimeofday(&t_stop, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstop); - t_start.tv_sec = tbstart->time; - t_start.tv_usec = tbstart->millitm; - t_stop.tv_sec = tbstop->time; - t_stop.tv_usec = tbstop->millitm; + _ftime(tbstop); + t_start.tv_sec = tbstart->time; + t_start.tv_usec = tbstart->millitm; + t_stop.tv_sec = tbstop->time; + t_stop.tv_usec = tbstop->millitm; #endif #endif putc ('\n', stderr); print_stats ("in hdf5", - &r_start, &r_stop, &t_start, &t_stop, - (size_t)(nread*size[0]*size[1])); + &r_start, &r_stop, &t_start, &t_stop, + (size_t)(nread*size[0]*size[1])); /* Read hyperslab */ assert (size[0]>20 && size[1]>20); @@ -459,16 +459,16 @@ main (void) HDgettimeofday(&t_start, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstart); + _ftime(tbstart); #endif #endif fprintf (stderr, HEADING, "in hdf5 partial"); for(u = 0; u < nread; u++) { - putc (PROGRESS, stderr); - HDfflush(stderr); - status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, - H5P_DEFAULT, the_data); - assert (status>=0); + putc (PROGRESS, stderr); + HDfflush(stderr); + status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, + H5P_DEFAULT, the_data); + assert (status>=0); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -477,17 +477,17 @@ main (void) HDgettimeofday(&t_stop, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstop); - t_start.tv_sec = tbstart->time; - t_start.tv_usec = tbstart->millitm; - t_stop.tv_sec = tbstop->time; - t_stop.tv_usec = tbstop->millitm; + _ftime(tbstop); + t_start.tv_sec = tbstart->time; + t_start.tv_usec = tbstart->millitm; + t_stop.tv_sec = tbstop->time; + t_stop.tv_usec = tbstop->millitm; #endif #endif putc('\n', stderr); print_stats("in hdf5 partial", - &r_start, &r_stop, &t_start, &t_stop, - (size_t)(nread*count[0]*count[1])); + &r_start, &r_stop, &t_start, &t_stop, + (size_t)(nread*count[0]*count[1])); diff --git a/perform/pio_standalone.h b/perform/pio_standalone.h index a4bc8b5..584a057 100644 --- a/perform/pio_standalone.h +++ b/perform/pio_standalone.h @@ -22,7 +22,7 @@ /** From H5private.h **/ -#include "H5public.h" /* Include Public Definitions */ +#include "H5public.h" /* Include Public Definitions */ /* @@ -47,57 +47,57 @@ * And now for a couple non-Posix functions... Watch out for systems that * define these in terms of macros. */ -#ifdef _WIN32 -#define HDstrdup(S) _strdup(S) -#else /* _WIN32 */ +#ifdef H5_HAVE_WIN32_API +#define HDstrdup(S) _strdup(S) +#else /* H5_HAVE_WIN32_API */ #if !defined strdup && !defined H5_HAVE_STRDUP extern char *strdup(const char *s); #endif -#define HDstrdup(S) strdup(S) +#define HDstrdup(S) strdup(S) -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); -#define HDstrcmp(S,T) strcmp(S,T) -#define HDstrlen(S) strlen(S) -#define HDstrncmp(S,T,L) strncmp(S,T,L) -#define HDstrncpy(X,Y,Z) strncpy(X,Y,Z) -#define HDstrchr(S,C) strchr(S,C) -#define HDfree(M) free(M) +#define HDstrcmp(S,T) strcmp(S,T) +#define HDstrlen(S) strlen(S) +#define HDstrncmp(S,T,L) strncmp(S,T,L) +#define HDstrncpy(X,Y,Z) strncpy(X,Y,Z) +#define HDstrchr(S,C) strchr(S,C) +#define HDfree(M) free(M) #ifdef _O_BINARY -#define HDopen(S,F,M) open(S,F|_O_BINARY,M) +#define HDopen(S,F,M) open(S,F|_O_BINARY,M) #else -#define HDopen(S,F,M) open(S,F,M) +#define HDopen(S,F,M) open(S,F,M) #endif -#define HDclose(F) close(F) +#define HDclose(F) close(F) -#ifdef _WIN32 -#define HDlseek(F,O,W) _lseeki64(F,O,W) +#ifdef H5_HAVE_WIN32_API +#define HDlseek(F,O,W) _lseeki64(F,O,W) #else -#define HDlseek(F,O,W) lseek(F,O,W) +#define HDlseek(F,O,W) lseek(F,O,W) #endif -#define HDwrite(F,M,Z) write(F,M,Z) +#define HDwrite(F,M,Z) write(F,M,Z) -#define HDread(F,M,Z) read(F,M,Z) +#define HDread(F,M,Z) read(F,M,Z) -#ifdef _WIN32 - #define HDstat(S,B) _stati64(S,B) +#ifdef H5_HAVE_WIN32_API + #define HDstat(S,B) _stati64(S,B) #else #define HDstat(S,B) stat(S,B) #endif -#ifdef _WIN32 -#define HDfstat(F,B) _fstati64(F,B) -typedef struct _stati64 h5_stat_t; -typedef __int64 h5_stat_size_t; +#ifdef H5_HAVE_WIN32_API +#define HDfstat(F,B) _fstati64(F,B) +typedef struct _stati64 h5_stat_t; +typedef __int64 h5_stat_size_t; #else #define HDfstat(F,B) fstat(F,B) -typedef struct stat h5_stat_t; +typedef struct stat h5_stat_t; typedef off_t h5_stat_size_t; #endif @@ -134,7 +134,7 @@ extern const char *opt_arg; /* flag argument (or value) */ enum { no_arg = 0, /* doesn't take an argument */ - require_arg, /* requires an argument */ + require_arg, /* requires an argument */ optional_arg /* argument is optional */ }; diff --git a/perform/sio_standalone.h b/perform/sio_standalone.h index 42f534f..677a8ae 100644 --- a/perform/sio_standalone.h +++ b/perform/sio_standalone.h @@ -129,11 +129,11 @@ #define HDfgetc(F) fgetc(F) #define HDfgetpos(F,P) fgetpos(F,P) #define HDfgets(S,N,F) fgets(S,N,F) -#ifdef _WIN32 /* H5_HAVE_VISUAL_STUDIO */ +#ifdef H5_HAVE_WIN32_API #define HDfileno(F) _fileno(F) -#else /* H5_HAVE_VISUAL_STUDIO */ +#else /* H5_HAVE_WIN32_API */ #define HDfileno(F) fileno(F) -#endif /* H5_HAVE_VISUAL_STUDIO */ +#endif /* H5_HAVE_WIN32_API */ #define HDfloor(X) floor(X) #define HDfmod(X,Y) fmod(X,Y) #define HDfopen(S,M) fopen(S,M) @@ -169,7 +169,7 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); * For Unix, if off_t is not 64bit big, try use the pseudo-standard * xxx64 versions if available. */ -#ifdef _WIN32 /* H5_HAVE_VISUAL_STUDIO */ +#ifdef H5_HAVE_WIN32_API #define HDfstat(F,B) _fstati64(F,B) #define HDlstat(S,B) _lstati64(S,B) #define HDstat(S,B) _stati64(S,B) @@ -202,7 +202,7 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #define HDgetgrgid(G) getgrgid(G) #define HDgetgrnam(S) getgrnam(S) #define HDgetgroups(Z,G) getgroups(Z,G) -#ifdef _MSC_VER /* H5_HAVE_VISUAL_STUDIO */ +#ifdef H5_HAVE_VISUAL_STUDIO #define HDgetlogin() Wgetlogin() #else /* H5_HAVE_VISUAL_STUDIO */ #define HDgetlogin() getlogin() @@ -239,7 +239,7 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #define HDlog(X) log(X) #define HDlog10(X) log10(X) #define HDlongjmp(J,N) longjmp(J,N) -#ifdef _WIN32 /* H5_HAVE_VISUAL_STUDIO */ +#ifdef H5_HAVE_WIN32_API #define HDlseek(F,O,W) _lseeki64(F,O,W) #else #ifdef H5_HAVE_LSEEK64 @@ -264,16 +264,16 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); /* * The (void*) cast just avoids a compiler warning in H5_HAVE_VISUAL_STUDIO */ -#ifdef _WIN32 /* H5_HAVE_VISUAL_STUDIO */ +#ifdef H5_HAVE_VISUAL_STUDIO #define HDmemset(X,C,Z) memset((void*)(X),C,Z) #else /* H5_HAVE_VISUAL_STUDIO */ #define HDmemset(X,C,Z) memset(X,C,Z) #endif /* H5_HAVE_VISUAL_STUDIO */ -#ifdef _WIN32 /* H5_HAVE_VISUAL_STUDIO */ +#ifdef H5_HAVE_WIN32_API #define HDmkdir(S,M) _mkdir(S) -#else /* H5_HAVE_VISUAL_STUDIO */ +#else /* H5_HAVE_WIN32_API */ #define HDmkdir(S,M) mkdir(S,M) -#endif /* H5_HAVE_VISUAL_STUDIO */ +#endif /* H5_HAVE_WIN32_API */ #define HDmkfifo(S,M) mkfifo(S,M) #define HDmktime(T) mktime(T) #define HDmodf(X,Y) modf(X,Y) @@ -354,7 +354,7 @@ int HDremove_all(const char * fname); #define HDsin(X) sin(X) #define HDsinh(X) sinh(X) #define HDsleep(N) sleep(N) -#ifdef _WIN32 /* H5_HAVE_VISUAL_STUDIO */ +#ifdef H5_HAVE_WIN32_API #define HDsnprintf _snprintf /*varargs*/ #else #define HDsnprintf snprintf /*varargs*/ @@ -419,7 +419,7 @@ H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base); #define HDumask(N) umask(N) #define HDuname(S) uname(S) #define HDungetc(C,F) ungetc(C,F) -#ifdef _WIN32 /* H5_HAVE_VISUAL_STUDIO */ +#ifdef H5_HAVE_WIN32_API #define HDunlink(S) _unlink(S) #else #define HDunlink(S) unlink(S) @@ -432,7 +432,7 @@ H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base); #define HDvfprintf(F,FMT,A) vfprintf(F,FMT,A) #define HDvprintf(FMT,A) vprintf(FMT,A) #define HDvsprintf(S,FMT,A) vsprintf(S,FMT,A) -#ifdef _WIN32 /* H5_HAVE_VISUAL_STUDIO */ +#ifdef H5_HAVE_WIN32_API # define HDvsnprintf(S,N,FMT,A) _vsnprintf(S,N,FMT,A) #else # define HDvsnprintf(S,N,FMT,A) vsnprintf(S,N,FMT,A) @@ -447,9 +447,9 @@ H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base); * And now for a couple non-Posix functions... Watch out for systems that * define these in terms of macros. */ -#ifdef _WIN32 /* H5_HAVE_VISUAL_STUDIO */ +#ifdef H5_HAVE_WIN32_API #define HDstrdup(S) _strdup(S) -#else /* H5_HAVE_VISUAL_STUDIO */ +#else /* H5_HAVE_WIN32_API */ #if !defined strdup && !defined H5_HAVE_STRDUP extern char *strdup(const char *s); @@ -457,7 +457,7 @@ extern char *strdup(const char *s); #define HDstrdup(S) strdup(S) -#endif /* H5_HAVE_VISUAL_STUDIO */ +#endif /* H5_HAVE_WIN32_API */ /* * HDF Boolean type. diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 2efcf6b..dcbe4a3 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -303,7 +303,9 @@ Bug Fixes since HDF5-1.8.0 release Library ------- - + - #ifdef _WIN32 instances changed to #ifdef H5_HAVE_WIN32_API and added + H5_HAVE_VISUAL_STUDIO checks where necessary. CMake only as configure + never set _WIN32. - CLANG compiler with the options -fcatch-undefined-behavior and -ftrapv discovered 3 problems in tests and tools' library (Issue 7674): 1. In dsets.c, left shifting an unsigned int for 32 bits or more diff --git a/src/H5FDcore.c b/src/H5FDcore.c index a978555..b9a7eee 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -53,7 +53,7 @@ typedef struct H5FD_core_t { hbool_t backing_store; /*write to file name on flush */ int fd; /*backing store file descriptor */ /* Information for determining uniqueness of a file with a backing store */ -#ifndef _WIN32 +#ifndef H5_HAVE_WIN32_API /* * On most systems the combination of device and i-node number uniquely * identify a file. @@ -66,7 +66,7 @@ typedef struct H5FD_core_t { #endif /*H5_VMS*/ #else /* - * On _WIN32 the low-order word of a unique identifier associated with the + * On H5_HAVE_WIN32_API the low-order word of a unique identifier associated with the * file and the volume serial number uniquely identify a file. This number * (which, both? -rpm) may change when the system is restarted or when the * file is opened. After a process opens a file, the identifier is @@ -416,7 +416,7 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, H5FD_core_t *file=NULL; H5FD_core_fapl_t *fa=NULL; H5P_genplist_t *plist; /* Property list pointer */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API HFILE filehandle; struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif @@ -473,12 +473,12 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, if(fd >= 0) { /* Retrieve information for determining uniqueness of file */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API filehandle = _get_osfhandle(fd); (void)GetFileInformationByHandle((HANDLE)filehandle, &fileinfo); file->fileindexhi = fileinfo.nFileIndexHigh; file->fileindexlo = fileinfo.nFileIndexLow; -#else /* _WIN32 */ +#else /* H5_HAVE_WIN32_API */ file->device = sb.st_dev; #ifdef H5_VMS file->inode[0] = sb.st_ino[0]; @@ -488,7 +488,7 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, file->inode = sb.st_ino; #endif /* H5_VMS */ -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ } /* end if */ /* If an existing file is opened, load the whole file into memory. */ @@ -598,7 +598,7 @@ H5FD_core_cmp(const H5FD_t *_f1, const H5FD_t *_f2) if(f1->fd >= 0 && f2->fd >= 0) { /* Compare low level file information for backing store */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API if (f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) if (f1->fileindexhi > f2->fileindexhi) HGOTO_DONE(1) @@ -626,7 +626,7 @@ H5FD_core_cmp(const H5FD_t *_f1, const H5FD_t *_f2) if(HDmemcmp(&(f1->inode),&(f2->inode),3*sizeof(ino_t))>0) HGOTO_DONE(1) #endif /* H5_VMS */ -#endif /*_WIN32*/ +#endif /*H5_HAVE_WIN32_API*/ } /* end if */ else { if (NULL==f1->name && NULL==f2->name) { diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 469fe9d..3cd40be 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -17,27 +17,27 @@ * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Purpose: The Direct I/O file driver forces the data to be written to - * the file directly without being copied into system kernel - * buffer. The main system support this feature is Linux. + * Purpose: The Direct I/O file driver forces the data to be written to + * the file directly without being copied into system kernel + * buffer. The main system support this feature is Linux. */ /* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_direct_init_interface +#define H5_INTERFACE_INIT_FUNC H5FD_direct_init_interface /* For system function posix_memalign - Commented it out because copper isn't able to compile * this file. */ /* #define _XOPEN_SOURCE 600 */ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5FDdirect.h" /* Direct file driver */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FDdirect.h" /* Direct file driver */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ #ifdef H5_HAVE_DIRECT @@ -45,15 +45,15 @@ static hid_t H5FD_DIRECT_g = 0; /* File operations */ -#define OP_UNKNOWN 0 -#define OP_READ 1 -#define OP_WRITE 2 +#define OP_UNKNOWN 0 +#define OP_READ 1 +#define OP_WRITE 2 /* Driver-specific file access properties */ typedef struct H5FD_direct_fapl_t { - size_t mboundary; /* Memory boundary for alignment */ - size_t fbsize; /* File system block size */ - size_t cbsize; /* Maximal buffer size for copying user data */ + size_t mboundary; /* Memory boundary for alignment */ + size_t fbsize; /* File system block size */ + size_t cbsize; /* Maximal buffer size for copying user data */ hbool_t must_align; /* Decides if data alignment is required */ } H5FD_direct_fapl_t; @@ -70,27 +70,27 @@ typedef struct H5FD_direct_fapl_t { * occurs), and `op' will be set to H5F_OP_UNKNOWN. */ typedef struct H5FD_direct_t { - H5FD_t pub; /*public stuff, must be first */ - int fd; /*the unix file */ - haddr_t eoa; /*end of allocated region */ - haddr_t eof; /*end of file; current file size*/ - haddr_t pos; /*current file I/O position */ - int op; /*last operation */ - H5FD_direct_fapl_t fa; /*file access properties */ -#ifndef _WIN32 + H5FD_t pub; /*public stuff, must be first */ + int fd; /*the unix file */ + haddr_t eoa; /*end of allocated region */ + haddr_t eof; /*end of file; current file size*/ + haddr_t pos; /*current file I/O position */ + int op; /*last operation */ + H5FD_direct_fapl_t fa; /*file access properties */ +#ifndef H5_HAVE_WIN32_API /* * On most systems the combination of device and i-node number uniquely * identify a file. */ - dev_t device; /*file device number */ + dev_t device; /*file device number */ #ifdef H5_VMS - ino_t inode[3]; /*file i-node number */ + ino_t inode[3]; /*file i-node number */ #else - ino_t inode; /*file i-node number */ + ino_t inode; /*file i-node number */ #endif /*H5_VMS*/ #else /* - * On _WIN32 the low-order word of a unique identifier associated with the + * On H5_HAVE_WIN32_API the low-order word of a unique identifier associated with the * file and the volume serial number uniquely identify a file. This number * (which, both? -rpm) may change when the system is restarted or when the * file is opened. After a process opens a file, the identifier is @@ -108,58 +108,58 @@ typedef struct H5FD_direct_t { * some macros here so we don't have to have conditional compilations later * throughout the code. * - * file_offset_t: The datatype for file offsets, the second argument of - * the lseek() or lseek64() call. + * file_offset_t: The datatype for file offsets, the second argument of + * the lseek() or lseek64() call. * - * file_seek: The function which adjusts the current file position, - * either lseek() or lseek64(). + * file_seek: The function which adjusts the current file position, + * either lseek() or lseek64(). */ /* adding for windows NT file system support. */ #ifdef H5_HAVE_LSEEK64 -# define file_offset_t off64_t -# define file_seek lseek64 -# define file_truncate ftruncate64 -#elif defined (_WIN32) +# define file_offset_t off64_t +# define file_seek lseek64 +# define file_truncate ftruncate64 +#elif defined (H5_HAVE_WIN32_API) # /*MSVC*/ # define file_offset_t __int64 # define file_seek _lseeki64 -# define file_truncate _chsize +# define file_truncate _chsize #else -# define file_offset_t off_t -# define file_seek lseek -# define file_truncate HDftruncate +# define file_offset_t off_t +# define file_seek lseek +# define file_truncate HDftruncate #endif /* * These macros check for overflow of various quantities. These macros * assume that file_offset_t is signed and haddr_t and size_t are unsigned. * - * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' - * is too large to be represented by the second argument - * of the file seek function. + * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' + * is too large to be represented by the second argument + * of the file seek function. * - * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too - * large to be represented by the `size_t' type. + * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too + * large to be represented by the `size_t' type. * - * REGION_OVERFLOW: Checks whether an address and size pair describe data - * which can be addressed entirely by the second - * argument of the file seek function. + * REGION_OVERFLOW: Checks whether an address and size pair describe data + * which can be addressed entirely by the second + * argument of the file seek function. */ #define MAXADDR (((haddr_t)1<<(8*sizeof(file_offset_t)-1))-1) -#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \ - ((A) & ~(haddr_t)MAXADDR)) -#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) -#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ - HADDR_UNDEF==(A)+(Z) || \ - (file_offset_t)((A)+(Z))<(file_offset_t)(A)) +#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \ + ((A) & ~(haddr_t)MAXADDR)) +#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) +#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ + HADDR_UNDEF==(A)+(Z) || \ + (file_offset_t)((A)+(Z))<(file_offset_t)(A)) /* Prototypes */ static herr_t H5FD_direct_term(void); static void *H5FD_direct_fapl_get(H5FD_t *file); static void *H5FD_direct_fapl_copy(const void *_old_fa); static H5FD_t *H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, - haddr_t maxaddr); + haddr_t maxaddr); static herr_t H5FD_direct_close(H5FD_t *_file); static int H5FD_direct_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static herr_t H5FD_direct_query(const H5FD_t *_f1, unsigned long *flags); @@ -168,44 +168,44 @@ static herr_t H5FD_direct_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); static haddr_t H5FD_direct_get_eof(const H5FD_t *_file); static herr_t H5FD_direct_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_direct_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, - size_t size, void *buf); + size_t size, void *buf); static herr_t H5FD_direct_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, - size_t size, const void *buf); + size_t size, const void *buf); static herr_t H5FD_direct_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static const H5FD_class_t H5FD_direct_g = { - "direct", /*name */ - MAXADDR, /*maxaddr */ - H5F_CLOSE_WEAK, /* fc_degree */ + "direct", /*name */ + MAXADDR, /*maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ H5FD_direct_term, /*terminate */ - NULL, /*sb_size */ - NULL, /*sb_encode */ - NULL, /*sb_decode */ - sizeof(H5FD_direct_fapl_t), /*fapl_size */ - H5FD_direct_fapl_get, /*fapl_get */ - H5FD_direct_fapl_copy, /*fapl_copy */ - NULL, /*fapl_free */ - 0, /*dxpl_size */ - NULL, /*dxpl_copy */ - NULL, /*dxpl_free */ - H5FD_direct_open, /*open */ - H5FD_direct_close, /*close */ - H5FD_direct_cmp, /*cmp */ - H5FD_direct_query, /*query */ - NULL, /*get_type_map */ - NULL, /*alloc */ - NULL, /*free */ - H5FD_direct_get_eoa, /*get_eoa */ - H5FD_direct_set_eoa, /*set_eoa */ - H5FD_direct_get_eof, /*get_eof */ + NULL, /*sb_size */ + NULL, /*sb_encode */ + NULL, /*sb_decode */ + sizeof(H5FD_direct_fapl_t), /*fapl_size */ + H5FD_direct_fapl_get, /*fapl_get */ + H5FD_direct_fapl_copy, /*fapl_copy */ + NULL, /*fapl_free */ + 0, /*dxpl_size */ + NULL, /*dxpl_copy */ + NULL, /*dxpl_free */ + H5FD_direct_open, /*open */ + H5FD_direct_close, /*close */ + H5FD_direct_cmp, /*cmp */ + H5FD_direct_query, /*query */ + NULL, /*get_type_map */ + NULL, /*alloc */ + NULL, /*free */ + H5FD_direct_get_eoa, /*get_eoa */ + H5FD_direct_set_eoa, /*set_eoa */ + H5FD_direct_get_eof, /*get_eof */ H5FD_direct_get_handle, /*get_handle */ - H5FD_direct_read, /*read */ - H5FD_direct_write, /*write */ - NULL, /*flush */ - H5FD_direct_truncate, /*truncate */ + H5FD_direct_read, /*read */ + H5FD_direct_write, /*write */ + NULL, /*flush */ + H5FD_direct_truncate, /*truncate */ NULL, /*lock */ NULL, /*unlock */ - H5FD_FLMAP_SINGLE /*fl_map */ + H5FD_FLMAP_SINGLE /*fl_map */ }; /* Declare a free list to manage the H5FD_direct_t struct */ @@ -235,16 +235,16 @@ H5FD_direct_init_interface(void) /*------------------------------------------------------------------------- - * Function: H5FD_direct_init + * Function: H5FD_direct_init * - * Purpose: Initialize this driver by registering the driver with the - * library. + * Purpose: Initialize this driver by registering the driver with the + * library. * - * Return: Success: The driver ID for the direct driver. + * Return: Success: The driver ID for the direct driver. * - * Failure: Negative. + * Failure: Negative. * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, 20 September 2006 * * Modifications: @@ -270,9 +270,9 @@ done: /*--------------------------------------------------------------------------- - * Function: H5FD_direct_term + * Function: H5FD_direct_term * - * Purpose: Shut down the VFD + * Purpose: Shut down the VFD * * Returns: Non-negative on success or negative on failure * @@ -294,16 +294,16 @@ H5FD_direct_term(void) /*------------------------------------------------------------------------- - * Function: H5Pset_fapl_direct + * Function: H5Pset_fapl_direct * - * Purpose: Modify the file access property list to use the H5FD_DIRECT - * driver defined in this source file. There are no driver - * specific properties. + * Purpose: Modify the file access property list to use the H5FD_DIRECT + * driver defined in this source file. There are no driver + * specific properties. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Wednesday, 20 September 2006 + * Programmer: Raymond Lu + * Wednesday, 20 September 2006 * * Modifications: * @@ -312,9 +312,9 @@ H5FD_direct_term(void) herr_t H5Pset_fapl_direct(hid_t fapl_id, size_t boundary, size_t block_size, size_t cbuf_size) { - H5P_genplist_t *plist; /* Property list pointer */ - H5FD_direct_fapl_t fa; - herr_t ret_value; + H5P_genplist_t *plist; /* Property list pointer */ + H5FD_direct_fapl_t fa; + herr_t ret_value; FUNC_ENTER_API(H5Pset_fapl_direct, FAIL) H5TRACE4("e", "izzz", fapl_id, boundary, block_size, cbuf_size); @@ -323,17 +323,17 @@ H5Pset_fapl_direct(hid_t fapl_id, size_t boundary, size_t block_size, size_t cbu HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") if(boundary != 0) - fa.mboundary = boundary; + fa.mboundary = boundary; else - fa.mboundary = MBOUNDARY_DEF; + fa.mboundary = MBOUNDARY_DEF; if(block_size != 0) - fa.fbsize = block_size; + fa.fbsize = block_size; else - fa.fbsize = FBSIZE_DEF; + fa.fbsize = FBSIZE_DEF; if(cbuf_size != 0) - fa.cbsize = cbuf_size; + fa.cbsize = cbuf_size; else - fa.cbsize = CBSIZE_DEF; + fa.cbsize = CBSIZE_DEF; /* Set the default to be true for data alignment */ fa.must_align = TRUE; @@ -350,16 +350,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_fapl_direct + * Function: H5Pget_fapl_direct * - * Purpose: Returns information about the direct file access property - * list though the function arguments. + * Purpose: Returns information about the direct file access property + * list though the function arguments. * - * Return: Success: Non-negative + * Return: Success: Non-negative * - * Failure: Negative + * Failure: Negative * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, October 18, 2006 * * Modifications: @@ -368,9 +368,9 @@ done: */ herr_t H5Pget_fapl_direct(hid_t fapl_id, size_t *boundary/*out*/, size_t *block_size/*out*/, - size_t *cbuf_size/*out*/) + size_t *cbuf_size/*out*/) { - H5FD_direct_fapl_t *fa; + H5FD_direct_fapl_t *fa; H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* Return value */ @@ -386,9 +386,9 @@ H5Pget_fapl_direct(hid_t fapl_id, size_t *boundary/*out*/, size_t *block_size/*o if (boundary) *boundary = fa->mboundary; if (block_size) - *block_size = fa->fbsize; + *block_size = fa->fbsize; if (cbuf_size) - *cbuf_size = fa->cbsize; + *cbuf_size = fa->cbsize; done: FUNC_LEAVE_API(ret_value) @@ -396,18 +396,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_fapl_get + * Function: H5FD_direct_fapl_get * - * Purpose: Returns a file access property list which indicates how the - * specified file is being accessed. The return list could be - * used to access another file the same way. + * Purpose: Returns a file access property list which indicates how the + * specified file is being accessed. The return list could be + * used to access another file the same way. * - * Return: Success: Ptr to new file access property list with all - * members copied from the file struct. + * Return: Success: Ptr to new file access property list with all + * members copied from the file struct. * - * Failure: NULL + * Failure: NULL * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, 18 October 2006 * * Modifications: @@ -417,7 +417,7 @@ done: static void * H5FD_direct_fapl_get(H5FD_t *_file) { - H5FD_direct_t *file = (H5FD_direct_t*)_file; + H5FD_direct_t *file = (H5FD_direct_t*)_file; void *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_direct_fapl_get, NULL) @@ -431,15 +431,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_fapl_copy + * Function: H5FD_direct_fapl_copy * - * Purpose: Copies the direct-specific file access properties. + * Purpose: Copies the direct-specific file access properties. * - * Return: Success: Ptr to a new property list + * Return: Success: Ptr to a new property list * - * Failure: NULL + * Failure: NULL * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, 18 October 2006 * * Modifications: @@ -469,17 +469,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_open + * Function: H5FD_direct_open * - * Purpose: Create and/or opens a Unix file for direct I/O as an HDF5 file. + * Purpose: Create and/or opens a Unix file for direct I/O as an HDF5 file. * - * Return: Success: A pointer to a new file data structure. The - * public fields will be initialized by the - * caller, which is always H5FD_open(). + * Return: Success: A pointer to a new file data structure. The + * public fields will be initialized by the + * caller, which is always H5FD_open(). * - * Failure: NULL + * Failure: NULL * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, 20 September 2006 * * Modifications: @@ -489,18 +489,18 @@ done: static H5FD_t * H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - int o_flags; - int fd=(-1); - H5FD_direct_t *file=NULL; - H5FD_direct_fapl_t *fa; -#ifdef _WIN32 - HFILE filehandle; + int o_flags; + int fd=(-1); + H5FD_direct_t *file=NULL; + H5FD_direct_fapl_t *fa; +#ifdef H5_HAVE_WIN32_API + HFILE filehandle; struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif - h5_stat_t sb; - H5P_genplist_t *plist; /* Property list */ + h5_stat_t sb; + H5P_genplist_t *plist; /* Property list */ int *buf1, *buf2; - H5FD_t *ret_value; + H5FD_t *ret_value; FUNC_ENTER_NOAPI(H5FD_direct_open, NULL) @@ -544,7 +544,7 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd H5_ASSIGN_OVERFLOW(file->eof,sb.st_size,h5_stat_size_t,haddr_t); file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API filehandle = _get_osfhandle(fd); (void)GetFileInformationByHandle((HANDLE)filehandle, &fileinfo); file->fileindexhi = fileinfo.nFileIndexHigh; @@ -558,7 +558,7 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd #else file->inode = sb.st_ino; #endif /*H5_VMS*/ -#endif /*_WIN32*/ +#endif /*H5_HAVE_WIN32_API*/ file->fa.mboundary = fa->mboundary; file->fa.fbsize = fa->fbsize; file->fa.cbsize = fa->cbsize; @@ -569,7 +569,7 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd */ buf1 = (int*)HDmalloc(sizeof(int)); if (HDposix_memalign(&buf2, file->fa.mboundary, file->fa.fbsize) != 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "HDposix_memalign failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "HDposix_memalign failed") if(o_flags & O_CREAT) { if(write(file->fd, (void*)buf1, sizeof(int))<0) { @@ -619,15 +619,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_close + * Function: H5FD_direct_close * - * Purpose: Closes the file. + * Purpose: Closes the file. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1, file not closed. + * Failure: -1, file not closed. * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, 20 September 2006 * * Modifications: @@ -637,8 +637,8 @@ done: static herr_t H5FD_direct_close(H5FD_t *_file) { - H5FD_direct_t *file = (H5FD_direct_t*)_file; - herr_t ret_value=SUCCEED; /* Return value */ + H5FD_direct_t *file = (H5FD_direct_t*)_file; + herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_direct_close, FAIL) @@ -653,17 +653,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_cmp + * Function: H5FD_direct_cmp * - * Purpose: Compares two files belonging to this driver using an - * arbitrary (but consistent) ordering. + * Purpose: Compares two files belonging to this driver using an + * arbitrary (but consistent) ordering. * - * Return: Success: A value like strcmp() + * Return: Success: A value like strcmp() * - * Failure: never fails (arguments were checked by the - * caller). + * Failure: never fails (arguments were checked by the + * caller). * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Thursday, 21 September 2006 * * Modifications: @@ -673,13 +673,13 @@ done: static int H5FD_direct_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { - const H5FD_direct_t *f1 = (const H5FD_direct_t*)_f1; - const H5FD_direct_t *f2 = (const H5FD_direct_t*)_f2; + const H5FD_direct_t *f1 = (const H5FD_direct_t*)_f1; + const H5FD_direct_t *f2 = (const H5FD_direct_t*)_f2; int ret_value=0; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_direct_cmp) -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API if (f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) if (f1->fileindexhi > f2->fileindexhi) HGOTO_DONE(1) @@ -715,16 +715,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_query + * Function: H5FD_direct_query * - * Purpose: Set the flags that this VFL driver is capable of supporting. + * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) * - * Return: Success: non-negative + * Return: Success: non-negative * - * Failure: negative + * Failure: negative * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Thursday, 21 September 2006 * * Modifications: @@ -753,17 +753,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_get_eoa + * Function: H5FD_direct_get_eoa * - * Purpose: Gets the end-of-address marker for the file. The EOA marker - * is the first address past the last byte allocated in the - * format address space. + * Purpose: Gets the end-of-address marker for the file. The EOA marker + * is the first address past the last byte allocated in the + * format address space. * - * Return: Success: The end-of-address marker. + * Return: Success: The end-of-address marker. * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, 20 September 2006 * * Modifications: @@ -776,7 +776,7 @@ done: static haddr_t H5FD_direct_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) { - const H5FD_direct_t *file = (const H5FD_direct_t*)_file; + const H5FD_direct_t *file = (const H5FD_direct_t*)_file; haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_direct_get_eoa, HADDR_UNDEF) @@ -790,17 +790,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_set_eoa + * Function: H5FD_direct_set_eoa * - * Purpose: Set the end-of-address marker for the file. This function is - * called shortly after an existing HDF5 file is opened in order - * to tell the driver where the end of the HDF5 data is located. + * Purpose: Set the end-of-address marker for the file. This function is + * called shortly after an existing HDF5 file is opened in order + * to tell the driver where the end of the HDF5 data is located. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, 20 September 2006 * * Modifications: @@ -813,7 +813,7 @@ done: static herr_t H5FD_direct_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr) { - H5FD_direct_t *file = (H5FD_direct_t*)_file; + H5FD_direct_t *file = (H5FD_direct_t*)_file; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_direct_set_eoa, FAIL) @@ -826,19 +826,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_get_eof + * Function: H5FD_direct_get_eof * - * Purpose: Returns the end-of-file marker, which is the greater of - * either the Unix end-of-file or the HDF5 end-of-address - * markers. + * Purpose: Returns the end-of-file marker, which is the greater of + * either the Unix end-of-file or the HDF5 end-of-address + * markers. * - * Return: Success: End of file address, the first address past - * the end of the "file", either the Unix file - * or the HDF5 file. + * Return: Success: End of file address, the first address past + * the end of the "file", either the Unix file + * or the HDF5 file. * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, 20 September 2006 * * Modifications: @@ -848,7 +848,7 @@ done: static haddr_t H5FD_direct_get_eof(const H5FD_t *_file) { - const H5FD_direct_t *file = (const H5FD_direct_t*)_file; + const H5FD_direct_t *file = (const H5FD_direct_t*)_file; haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_direct_get_eof, HADDR_UNDEF) @@ -893,18 +893,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_read + * Function: H5FD_direct_read * - * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR - * into buffer BUF according to data transfer properties in - * DXPL_ID. + * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR + * into buffer BUF according to data transfer properties in + * DXPL_ID. * - * Return: Success: Zero. Result is stored in caller-supplied - * buffer BUF. + * Return: Success: Zero. Result is stored in caller-supplied + * buffer BUF. * - * Failure: -1, Contents of buffer BUF are undefined. + * Failure: -1, Contents of buffer BUF are undefined. * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Thursday, 21 September 2006 * * Modifications: @@ -913,19 +913,19 @@ done: */ static herr_t H5FD_direct_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr_t addr, - size_t size, void *buf/*out*/) + size_t size, void *buf/*out*/) { - H5FD_direct_t *file = (H5FD_direct_t*)_file; - ssize_t nbytes; - hbool_t _must_align = TRUE; - herr_t ret_value=SUCCEED; /* Return value */ - size_t alloc_size; - void *copy_buf = NULL, *p2; - size_t _boundary; - size_t _fbsize; - size_t _cbsize; - haddr_t read_size; /* Size to read into copy buffer */ - size_t copy_size = size; /* Size remaining to read when using copy buffer */ + H5FD_direct_t *file = (H5FD_direct_t*)_file; + ssize_t nbytes; + hbool_t _must_align = TRUE; + herr_t ret_value=SUCCEED; /* Return value */ + size_t alloc_size; + void *copy_buf = NULL, *p2; + size_t _boundary; + size_t _fbsize; + size_t _cbsize; + haddr_t read_size; /* Size to read into copy buffer */ + size_t copy_size = size; /* Size remaining to read when using copy buffer */ size_t copy_offset; /* Offset into copy buffer of the requested data */ FUNC_ENTER_NOAPI(H5FD_direct_read, FAIL) @@ -958,44 +958,44 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, ha * and aligned data first, then copy the data into memory buffer. */ if(!_must_align || ((addr%_fbsize==0) && (size%_fbsize==0) && ((size_t)buf%_boundary==0))) { - /* Seek to the correct location */ - if ((addr!=file->pos || OP_READ!=file->op) && - file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0) - HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - /* Read the aligned data in file first, being careful of interrupted - * system calls and partial results. */ - while (size>0) { - do { - nbytes = HDread(file->fd, buf, size); - } while (-1==nbytes && EINTR==errno); - if (-1==nbytes) /* error */ - HSYS_GOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") - if (0==nbytes) { - /* end of file but not end of format address space */ - HDmemset(buf, 0, size); - break; - } - assert(nbytes>=0); - assert((size_t)nbytes<=size); - H5_CHECK_OVERFLOW(nbytes,ssize_t,size_t); - size -= (size_t)nbytes; - H5_CHECK_OVERFLOW(nbytes,ssize_t,haddr_t); - addr += (haddr_t)nbytes; - buf = (char*)buf + nbytes; - } + /* Seek to the correct location */ + if ((addr!=file->pos || OP_READ!=file->op) && + file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0) + HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") + /* Read the aligned data in file first, being careful of interrupted + * system calls and partial results. */ + while (size>0) { + do { + nbytes = HDread(file->fd, buf, size); + } while (-1==nbytes && EINTR==errno); + if (-1==nbytes) /* error */ + HSYS_GOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") + if (0==nbytes) { + /* end of file but not end of format address space */ + HDmemset(buf, 0, size); + break; + } + assert(nbytes>=0); + assert((size_t)nbytes<=size); + H5_CHECK_OVERFLOW(nbytes,ssize_t,size_t); + size -= (size_t)nbytes; + H5_CHECK_OVERFLOW(nbytes,ssize_t,haddr_t); + addr += (haddr_t)nbytes; + buf = (char*)buf + nbytes; + } } else { /* Calculate where we will begin copying from the copy buffer */ copy_offset = (size_t)(addr % _fbsize); - /* allocate memory needed for the Direct IO option up to the maximal - * copy buffer size. Make a bigger buffer for aligned I/O if size is - * smaller than maximal copy buffer. */ - alloc_size = ((copy_offset + size - 1) / _fbsize + 1) * _fbsize; - if(alloc_size > _cbsize) - alloc_size = _cbsize; - HDassert(!(alloc_size % _fbsize)); - if (HDposix_memalign(©_buf, _boundary, alloc_size) != 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "HDposix_memalign failed") + /* allocate memory needed for the Direct IO option up to the maximal + * copy buffer size. Make a bigger buffer for aligned I/O if size is + * smaller than maximal copy buffer. */ + alloc_size = ((copy_offset + size - 1) / _fbsize + 1) * _fbsize; + if(alloc_size > _cbsize) + alloc_size = _cbsize; + HDassert(!(alloc_size % _fbsize)); + if (HDposix_memalign(©_buf, _boundary, alloc_size) != 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "HDposix_memalign failed") /* look for the aligned position for reading the data */ HDassert(!(((addr / _fbsize) * _fbsize) % _fbsize)); @@ -1003,18 +1003,18 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, ha SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - /* - * Read the aligned data in file into aligned buffer first, then copy the data - * into the final buffer. If the data size is bigger than maximal copy buffer - * size, do the reading by segment (the outer while loop). If not, do one step - * reading. - */ - do { - /* Read the aligned data in file first. Not able to handle interrupted - * system calls and partial results like sec2 driver does because the - * data may no longer be aligned. It's expecially true when the data in - * file is smaller than ALLOC_SIZE. */ - HDmemset(copy_buf, 0, alloc_size); + /* + * Read the aligned data in file into aligned buffer first, then copy the data + * into the final buffer. If the data size is bigger than maximal copy buffer + * size, do the reading by segment (the outer while loop). If not, do one step + * reading. + */ + do { + /* Read the aligned data in file first. Not able to handle interrupted + * system calls and partial results like sec2 driver does because the + * data may no longer be aligned. It's expecially true when the data in + * file is smaller than ALLOC_SIZE. */ + HDmemset(copy_buf, 0, alloc_size); /* Calculate how much data we have to read in this iteration * (including unused parts of blocks) */ @@ -1025,23 +1025,23 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, ha read_size = alloc_size; HDassert(!(read_size % _fbsize)); - do { - nbytes = HDread(file->fd, copy_buf, read_size); - } while(-1==nbytes && EINTR==errno); + do { + nbytes = HDread(file->fd, copy_buf, read_size); + } while(-1==nbytes && EINTR==errno); - if (-1==nbytes) /* error */ - HSYS_GOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") + if (-1==nbytes) /* error */ + HSYS_GOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") - /* Copy the needed data from the copy buffer to the output - * buffer, and update copy_size. If the copy buffer does not + /* Copy the needed data from the copy buffer to the output + * buffer, and update copy_size. If the copy buffer does not * contain the rest of the data, just copy what's in the copy * buffer and also update read_addr and copy_offset to read the * next section of data. */ - p2 = (unsigned char*)copy_buf + copy_offset; - if((copy_size + copy_offset) <= alloc_size) { - HDmemcpy(buf, p2, copy_size); - buf = (unsigned char *)buf + copy_size; - copy_size = 0; + p2 = (unsigned char*)copy_buf + copy_offset; + if((copy_size + copy_offset) <= alloc_size) { + HDmemcpy(buf, p2, copy_size); + buf = (unsigned char *)buf + copy_size; + copy_size = 0; } /* end if */ else { HDmemcpy(buf, p2, alloc_size - copy_offset); @@ -1049,12 +1049,12 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, ha copy_size -= alloc_size - copy_offset; copy_offset = 0; } /* end else */ - } while (copy_size > 0); + } while (copy_size > 0); - /*Final step: update address*/ - addr = (haddr_t)(((addr + size - 1) / _fbsize + 1) * _fbsize); + /*Final step: update address*/ + addr = (haddr_t)(((addr + size - 1) / _fbsize + 1) * _fbsize); - if(copy_buf) { + if(copy_buf) { HDfree(copy_buf); copy_buf = NULL; } /* end if */ @@ -1079,17 +1079,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_write + * Function: H5FD_direct_write * - * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR - * from buffer BUF according to data transfer properties in - * DXPL_ID. + * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR + * from buffer BUF according to data transfer properties in + * DXPL_ID. * - * Return: Success: Zero + * Return: Success: Zero * - * Failure: -1 + * Failure: -1 * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Thursday, 21 September 2006 * * Modifications: @@ -1098,18 +1098,18 @@ done: */ static herr_t H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr_t addr, - size_t size, const void *buf) + size_t size, const void *buf) { - H5FD_direct_t *file = (H5FD_direct_t*)_file; - ssize_t nbytes; - hbool_t _must_align = TRUE; - herr_t ret_value=SUCCEED; /* Return value */ - size_t alloc_size; - void *copy_buf = NULL, *p1; - const void *p3; - size_t _boundary; - size_t _fbsize; - size_t _cbsize; + H5FD_direct_t *file = (H5FD_direct_t*)_file; + ssize_t nbytes; + hbool_t _must_align = TRUE; + herr_t ret_value=SUCCEED; /* Return value */ + size_t alloc_size; + void *copy_buf = NULL, *p1; + const void *p3; + size_t _boundary; + size_t _fbsize; + size_t _cbsize; haddr_t write_addr; /* Address to write copy buffer */ haddr_t write_size; /* Size to write from copy buffer */ haddr_t read_size; /* Size to read into copy buffer */ @@ -1146,49 +1146,49 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h * first, update buffer with user data, then write the data out. */ if(!_must_align || ((addr%_fbsize==0) && (size%_fbsize==0) && ((size_t)buf%_boundary==0))) { - /* Seek to the correct location */ - if ((addr!=file->pos || OP_WRITE!=file->op) && - file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0) - HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - - while (size>0) { - do { - nbytes = HDwrite(file->fd, buf, size); - } while (-1==nbytes && EINTR==errno); - if (-1==nbytes) /* error */ - HSYS_GOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") - assert(nbytes>0); - assert((size_t)nbytes<=size); - H5_CHECK_OVERFLOW(nbytes,ssize_t,size_t); - size -= (size_t)nbytes; - H5_CHECK_OVERFLOW(nbytes,ssize_t,haddr_t); - addr += (haddr_t)nbytes; - buf = (const char*)buf + nbytes; - } + /* Seek to the correct location */ + if ((addr!=file->pos || OP_WRITE!=file->op) && + file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0) + HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") + + while (size>0) { + do { + nbytes = HDwrite(file->fd, buf, size); + } while (-1==nbytes && EINTR==errno); + if (-1==nbytes) /* error */ + HSYS_GOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") + assert(nbytes>0); + assert((size_t)nbytes<=size); + H5_CHECK_OVERFLOW(nbytes,ssize_t,size_t); + size -= (size_t)nbytes; + H5_CHECK_OVERFLOW(nbytes,ssize_t,haddr_t); + addr += (haddr_t)nbytes; + buf = (const char*)buf + nbytes; + } } else { /* Calculate where we will begin reading from (on disk) and where we * will begin copying from the copy buffer */ write_addr = (addr / _fbsize) * _fbsize; copy_offset = (size_t)(addr % _fbsize); - /* allocate memory needed for the Direct IO option up to the maximal - * copy buffer size. Make a bigger buffer for aligned I/O if size is - * smaller than maximal copy buffer. - */ - alloc_size = ((copy_offset + size - 1) / _fbsize + 1) * _fbsize; + /* allocate memory needed for the Direct IO option up to the maximal + * copy buffer size. Make a bigger buffer for aligned I/O if size is + * smaller than maximal copy buffer. + */ + alloc_size = ((copy_offset + size - 1) / _fbsize + 1) * _fbsize; if(alloc_size > _cbsize) alloc_size = _cbsize; HDassert(!(alloc_size % _fbsize)); - if (HDposix_memalign(©_buf, _boundary, alloc_size) != 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "HDposix_memalign failed") + if (HDposix_memalign(©_buf, _boundary, alloc_size) != 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "HDposix_memalign failed") /* look for the right position for reading or writing the data */ if(file_seek(file->fd, (file_offset_t)write_addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - p3 = buf; - do { + p3 = buf; + do { /* Calculate how much data we have to write in this iteration * (including unused parts of blocks) */ if((copy_size + copy_offset) < alloc_size) @@ -1197,16 +1197,16 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h else write_size = alloc_size; - /* - * Read the aligned data first if the aligned region doesn't fall - * entirely in the range to be writen. Not able to handle interrupted - * system calls and partial results like sec2 driver does because the - * data may no longer be aligned. It's expecially true when the data in - * file is smaller than ALLOC_SIZE. Only read the entire section if + /* + * Read the aligned data first if the aligned region doesn't fall + * entirely in the range to be writen. Not able to handle interrupted + * system calls and partial results like sec2 driver does because the + * data may no longer be aligned. It's expecially true when the data in + * file is smaller than ALLOC_SIZE. Only read the entire section if * both ends are misaligned, otherwise only read the block on the * misaligned end. - */ - HDmemset(copy_buf, 0, _fbsize); + */ + HDmemset(copy_buf, 0, _fbsize); if(copy_offset > 0) { if((write_addr + write_size) > (addr + size)) { @@ -1244,14 +1244,14 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h HSYS_GOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") } /* end if */ - /* look for the right position and append or copy the data to be written to - * the aligned buffer. - * Consider all possible situations here: file address is not aligned on - * file block size; the end of data address is not aligned; the end of data - * address is aligned; data size is smaller or bigger than maximal copy size. - */ - p1 = (unsigned char *)copy_buf + copy_offset; - if((copy_size + copy_offset) <= alloc_size) { + /* look for the right position and append or copy the data to be written to + * the aligned buffer. + * Consider all possible situations here: file address is not aligned on + * file block size; the end of data address is not aligned; the end of data + * address is aligned; data size is smaller or bigger than maximal copy size. + */ + p1 = (unsigned char *)copy_buf + copy_offset; + if((copy_size + copy_offset) <= alloc_size) { HDmemcpy(p1, p3, copy_size); copy_size = 0; } /* end if */ @@ -1262,34 +1262,34 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h copy_offset = 0; } /* end else */ - /*look for the aligned position for writing the data*/ - HDassert(!(write_addr % _fbsize)); - if(file_seek(file->fd, (file_offset_t)write_addr, SEEK_SET) < 0) - HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - - /* - * Write the data. It doesn't truncate the extra data introduced by - * alignment because that step is done in H5FD_direct_flush. - */ - HDassert(!(write_size % _fbsize)); - do { - nbytes = HDwrite(file->fd, copy_buf, write_size); - } while (-1==nbytes && EINTR==errno); - - if (-1==nbytes) /* error */ - HSYS_GOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") - - /* update the write address */ - write_addr += write_size; - } while (copy_size > 0); - - /*Update the address and size*/ - addr = write_addr; - buf = (const char*)buf + size; - - if(copy_buf) { - HDfree(copy_buf); - copy_buf = NULL; + /*look for the aligned position for writing the data*/ + HDassert(!(write_addr % _fbsize)); + if(file_seek(file->fd, (file_offset_t)write_addr, SEEK_SET) < 0) + HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") + + /* + * Write the data. It doesn't truncate the extra data introduced by + * alignment because that step is done in H5FD_direct_flush. + */ + HDassert(!(write_size % _fbsize)); + do { + nbytes = HDwrite(file->fd, copy_buf, write_size); + } while (-1==nbytes && EINTR==errno); + + if (-1==nbytes) /* error */ + HSYS_GOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") + + /* update the write address */ + write_addr += write_size; + } while (copy_size > 0); + + /*Update the address and size*/ + addr = write_addr; + buf = (const char*)buf + size; + + if(copy_buf) { + HDfree(copy_buf); + copy_buf = NULL; } /* end if */ } @@ -1314,16 +1314,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_truncate + * Function: H5FD_direct_truncate * - * Purpose: Makes sure that the true file size is the same (or larger) - * than the end-of-address. + * Purpose: Makes sure that the true file size is the same (or larger) + * than the end-of-address. * - * Return: Success: Non-negative + * Return: Success: Non-negative * - * Failure: Negative + * Failure: Negative * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Thursday, 21 September 2006 * *------------------------------------------------------------------------- @@ -1331,8 +1331,8 @@ done: static herr_t H5FD_direct_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) { - H5FD_direct_t *file = (H5FD_direct_t*)_file; - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_direct_t *file = (H5FD_direct_t*)_file; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_direct_truncate, FAIL) @@ -1340,7 +1340,7 @@ H5FD_direct_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing /* Extend the file to make sure it's large enough */ if (file->eoa!=file->eof) { -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API HFILE filehandle; /* Windows file handle */ LARGE_INTEGER li; /* 64-bit integer for SetFilePointer() call */ @@ -1353,10 +1353,10 @@ H5FD_direct_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing (void)SetFilePointer((HANDLE)filehandle,li.LowPart,&li.HighPart,FILE_BEGIN); if(SetEndOfFile((HANDLE)filehandle)==0) HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") -#else /* _WIN32 */ +#else /* H5_HAVE_WIN32_API */ if (-1==file_truncate(file->fd, (file_offset_t)file->eoa)) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ /* Update the eof value */ file->eof = file->eoa; @@ -1366,9 +1366,9 @@ H5FD_direct_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing file->op = OP_UNKNOWN; } else if (file->fa.must_align){ - /*Even though eof is equal to eoa, file is still truncated because Direct I/O - *write introduces some extra data for alignment. - */ + /*Even though eof is equal to eoa, file is still truncated because Direct I/O + *write introduces some extra data for alignment. + */ if (-1==file_truncate(file->fd, (file_offset_t)file->eof)) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") } diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 8cbf293..cdcf8ba 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -85,7 +85,7 @@ typedef struct H5FD_log_t { haddr_t pos; /*current file I/O position */ H5FD_file_op_t op; /*last operation */ char filename[H5FD_MAX_FILENAME_LEN]; /* Copy of file name from open operation */ -#ifndef _WIN32 +#ifndef H5_HAVE_WIN32_API /* * On most systems the combination of device and i-node number uniquely * identify a file. @@ -98,7 +98,7 @@ typedef struct H5FD_log_t { #endif /*H5_VMS*/ #else /* - * On _WIN32 the low-order word of a unique identifier associated with the + * On H5_HAVE_WIN32_API the low-order word of a unique identifier associated with the * file and the volume serial number uniquely identify a file. This number * (which, both? -rpm) may change when the system is restarted or when the * file is opened. After a process opens a file, the identifier is @@ -473,7 +473,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) H5FD_log_fapl_t *fa; /* File access property list information */ int fd = (-1); /* File descriptor */ int o_flags; /* Flags for open() call */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API HFILE filehandle; struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif @@ -570,12 +570,12 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) H5_ASSIGN_OVERFLOW(file->eof, sb.st_size, h5_stat_size_t, haddr_t); file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API filehandle = _get_osfhandle(fd); (void)GetFileInformationByHandle((HANDLE)filehandle, &fileinfo); file->fileindexhi = fileinfo.nFileIndexHigh; file->fileindexlo = fileinfo.nFileIndexLow; -#else /* _WIN32 */ +#else /* H5_HAVE_WIN32_API */ file->device = sb.st_dev; #ifdef H5_VMS file->inode[0] = sb.st_ino[0]; @@ -585,7 +585,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) file->inode = sb.st_ino; #endif /*H5_VMS*/ -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ /* Retain a copy of the name used to open the file, for possible error reporting */ HDstrncpy(file->filename, name, sizeof(file->filename)); @@ -825,7 +825,7 @@ H5FD_log_cmp(const H5FD_t *_f1, const H5FD_t *_f2) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_log_cmp) -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API if(f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) if(f1->fileindexhi > f2->fileindexhi) HGOTO_DONE(1) @@ -1474,7 +1474,7 @@ H5FD_log_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) /* Extend the file to make sure it's large enough */ if(!H5F_addr_eq(file->eoa, file->eof)) { -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API HFILE filehandle; /* Windows file handle */ LARGE_INTEGER li; /* 64-bit integer for SetFilePointer() call */ @@ -1487,7 +1487,7 @@ H5FD_log_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) (void)SetFilePointer((HANDLE)filehandle, li.LowPart, &li.HighPart, FILE_BEGIN); if(SetEndOfFile((HANDLE)filehandle) == 0) HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") -#else /* _WIN32 */ +#else /* H5_HAVE_WIN32_API */ #ifdef H5_VMS /* Reset seek offset to the beginning of the file, so that the file isn't * re-extended later. This may happen on Open VMS. */ @@ -1497,7 +1497,7 @@ H5FD_log_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) if(-1 == HDftruncate(file->fd, (HDoff_t)file->eoa)) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ /* Log information about the truncate */ if(file->fa.flags & H5FD_LOG_NUM_TRUNCATE) diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c index bcedaed..496f474 100644 --- a/src/H5FDmpiposix.c +++ b/src/H5FDmpiposix.c @@ -17,7 +17,7 @@ * Programmer: Quincey Koziol * Thursday, July 11, 2002 * - * Purpose: This is a "combination" MPI-2 and posix I/O driver. + * Purpose: This is a "combination" MPI-2 and posix I/O driver. * It uses MPI for coordinating the actions of several processes * and posix I/O calls to do the actual I/O to the disk. * @@ -34,17 +34,17 @@ */ /* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_mpiposix_init_interface +#define H5_INTERFACE_INIT_FUNC H5FD_mpiposix_init_interface -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5FDmpi.h" /* MPI-based file drivers */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FDmpi.h" /* MPI-based file drivers */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ /* Features: @@ -72,9 +72,9 @@ static hid_t H5FD_MPIPOSIX_g = 0; /* File operations */ -#define OP_UNKNOWN 0 -#define OP_READ 1 -#define OP_WRITE 2 +#define OP_UNKNOWN 0 +#define OP_READ 1 +#define OP_WRITE 2 /* * The description of a file belonging to this driver. @@ -84,31 +84,31 @@ static hid_t H5FD_MPIPOSIX_g = 0; * doesn't bother to keep it updated since it's an expensive operation. */ typedef struct H5FD_mpiposix_t { - H5FD_t pub; /*public stuff, must be first */ - int fd; /*the unix file handle */ - MPI_Comm comm; /*communicator */ + H5FD_t pub; /*public stuff, must be first */ + int fd; /*the unix file handle */ + MPI_Comm comm; /*communicator */ int mpi_rank; /* This process's rank */ int mpi_size; /* Total number of processes */ - haddr_t eof; /*end-of-file marker */ - haddr_t eoa; /*end-of-address marker */ - haddr_t last_eoa; /* Last known end-of-address marker */ - haddr_t pos; /* Current file I/O position */ - int op; /* Last file I/O operation */ - hsize_t naccess; /* Number of (write) accesses to file */ + haddr_t eof; /*end-of-file marker */ + haddr_t eoa; /*end-of-address marker */ + haddr_t last_eoa; /* Last known end-of-address marker */ + haddr_t pos; /* Current file I/O position */ + int op; /* Last file I/O operation */ + hsize_t naccess; /* Number of (write) accesses to file */ #ifdef H5_HAVE_GPFS size_t blksize; /* Block size of file system */ #endif hbool_t use_gpfs; /* Use GPFS to write things */ -#ifndef _WIN32 +#ifndef H5_HAVE_WIN32_API /* * On most systems the combination of device and i-node number uniquely * identify a file. */ - dev_t device; /*file device number */ - ino_t inode; /*file i-node number */ + dev_t device; /*file device number */ + ino_t inode; /*file i-node number */ #else /* - * On _WIN32 the low-order word of a unique identifier associated with the + * On H5_HAVE_WIN32_API the low-order word of a unique identifier associated with the * file and the volume serial number uniquely identify a file. This number * (which, both? -rpm) may change when the system is restarted or when the * file is opened. After a process opens a file, the identifier is @@ -126,52 +126,52 @@ typedef struct H5FD_mpiposix_t { * some macros here so we don't have to have conditional compilations later * throughout the code. * - * file_offset_t: The datatype for file offsets, the second argument of - * the lseek() or lseek64() call. + * file_offset_t: The datatype for file offsets, the second argument of + * the lseek() or lseek64() call. * - * file_seek: The function which adjusts the current file position, - * either lseek() or lseek64(). + * file_seek: The function which adjusts the current file position, + * either lseek() or lseek64(). */ /* adding for windows NT file system support. */ #ifdef H5_HAVE_LSEEK64 -# define file_offset_t off64_t -# define file_seek lseek64 -# define file_truncate ftruncate64 -#elif defined (_WIN32) +# define file_offset_t off64_t +# define file_seek lseek64 +# define file_truncate ftruncate64 +#elif defined (H5_HAVE_WIN32_API) # /*MSVC*/ # define file_offset_t __int64 # define file_seek _lseeki64 -# define file_truncate _ftruncatei64 +# define file_truncate _ftruncatei64 #else -# define file_offset_t off_t -# define file_seek HDlseek -# define file_truncate HDftruncate +# define file_offset_t off_t +# define file_seek HDlseek +# define file_truncate HDftruncate #endif /* * These macros check for overflow of various quantities. These macros * assume that file_offset_t is signed and haddr_t and size_t are unsigned. * - * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' - * is too large to be represented by the second argument - * of the file seek function. + * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' + * is too large to be represented by the second argument + * of the file seek function. * - * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too - * large to be represented by the `size_t' type. + * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too + * large to be represented by the `size_t' type. * - * REGION_OVERFLOW: Checks whether an address and size pair describe data - * which can be addressed entirely by the second - * argument of the file seek function. + * REGION_OVERFLOW: Checks whether an address and size pair describe data + * which can be addressed entirely by the second + * argument of the file seek function. */ #define MAXADDR (((haddr_t)1<<(8*sizeof(file_offset_t)-1))-1) -#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \ - ((A) & ~(haddr_t)MAXADDR)) -#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) -#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ - sizeof(file_offset_t)comm, comm))) - HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code) + if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(fa->comm, comm))) + HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code) } if (use_gpfs) @@ -450,32 +450,32 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_fapl_get + * Function: H5FD_mpiposix_fapl_get * - * Purpose: Returns a file access property list which could be used to - * create another file the same as this one. + * Purpose: Returns a file access property list which could be used to + * create another file the same as this one. * - * Return: Success: Ptr to new file access property list with all - * fields copied from the file pointer. + * Return: Success: Ptr to new file access property list with all + * fields copied from the file pointer. * - * Failure: NULL + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: - * Albert Cheng, 2003-04-24 - * Duplicate the communicator object so that the new - * property list is insulated from the old one. + * Albert Cheng, 2003-04-24 + * Duplicate the communicator object so that the new + * property list is insulated from the old one. * *------------------------------------------------------------------------- */ static void * H5FD_mpiposix_fapl_get(H5FD_t *_file) { - H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; + H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; H5FD_mpiposix_fapl_t *fa = NULL; - int mpi_code; /* MPI return code */ + int mpi_code; /* MPI return code */ void *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpiposix_fapl_get, NULL) @@ -488,7 +488,7 @@ H5FD_mpiposix_fapl_get(H5FD_t *_file) /* Duplicate the communicator. */ if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(file->comm, &fa->comm))) - HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code) + HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code) fa->use_gpfs = file->use_gpfs; @@ -501,15 +501,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_fapl_copy + * Function: H5FD_mpiposix_fapl_copy * - * Purpose: Copies the mpiposix-specific file access properties. + * Purpose: Copies the mpiposix-specific file access properties. * - * Return: Success: Ptr to a new property list + * Return: Success: Ptr to a new property list * - * Failure: NULL + * Failure: NULL * - * Programmer: Albert Cheng + * Programmer: Albert Cheng * Apr 24, 2003 * * Modifications: @@ -519,10 +519,10 @@ done: static void * H5FD_mpiposix_fapl_copy(const void *_old_fa) { - void *ret_value = NULL; + void *ret_value = NULL; const H5FD_mpiposix_fapl_t *old_fa = (const H5FD_mpiposix_fapl_t*)_old_fa; - H5FD_mpiposix_fapl_t *new_fa = NULL; - int mpi_code; /* MPI return code */ + H5FD_mpiposix_fapl_t *new_fa = NULL; + int mpi_code; /* MPI return code */ FUNC_ENTER_NOAPI(H5FD_mpiposix_fapl_copy, NULL) @@ -534,16 +534,16 @@ H5FD_mpiposix_fapl_copy(const void *_old_fa) /* Duplicate communicator. */ if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(old_fa->comm, &new_fa->comm))) - HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code) + HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code) new_fa->use_gpfs = old_fa->use_gpfs; ret_value = new_fa; done: if (NULL == ret_value){ - /* cleanup */ - if (new_fa) - H5MM_xfree(new_fa); + /* cleanup */ + if (new_fa) + H5MM_xfree(new_fa); } FUNC_LEAVE_NOAPI(ret_value) @@ -551,15 +551,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_fapl_free + * Function: H5FD_mpiposix_fapl_free * - * Purpose: Frees the mpiposix-specific file access properties. + * Purpose: Frees the mpiposix-specific file access properties. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Albert Cheng + * Programmer: Albert Cheng * Apr 24, 2003 * * Modifications: @@ -569,8 +569,8 @@ done: static herr_t H5FD_mpiposix_fapl_free(void *_fa) { - herr_t ret_value = SUCCEED; - H5FD_mpiposix_fapl_t *fa = (H5FD_mpiposix_fapl_t*)_fa; + herr_t ret_value = SUCCEED; + H5FD_mpiposix_fapl_t *fa = (H5FD_mpiposix_fapl_t*)_fa; FUNC_ENTER_NOAPI(H5FD_mpiposix_fapl_free, FAIL) assert(fa); @@ -589,11 +589,11 @@ done: * Function: H5FD_mpiposix_open * * Purpose: Opens a file with name NAME. The FLAGS are a bit field with - * purpose similar to the second argument of open(2) and which - * are defined in H5Fpublic.h. The file access property list - * FAPL_ID contains the properties driver properties and MAXADDR - * is the largest address which this file will be expected to - * access. This is collective. + * purpose similar to the second argument of open(2) and which + * are defined in H5Fpublic.h. The file access property list + * FAPL_ID contains the properties driver properties and MAXADDR + * is the largest address which this file will be expected to + * access. This is collective. * * Return: Success: A new file pointer. * Failure: NULL @@ -602,27 +602,27 @@ done: * Thursday, July 11, 2002 * * Modifications: - * Albert Cheng, 2003-04-24 - * Duplicate the communicator so that file is insulated from the - * old one. + * Albert Cheng, 2003-04-24 + * Duplicate the communicator so that file is insulated from the + * old one. * *------------------------------------------------------------------------- */ static H5FD_t * H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id, - haddr_t maxaddr) + haddr_t maxaddr) { - H5FD_mpiposix_t *file=NULL; /* New MPIPOSIX file struct */ + H5FD_mpiposix_t *file=NULL; /* New MPIPOSIX file struct */ int o_flags; /* Flags for file open call */ - int fd=(-1); /* File handle for file opened */ - int mpi_rank; /* MPI rank of this process */ - int mpi_size; /* Total number of MPI processes */ - int mpi_code; /* mpi return code */ - const H5FD_mpiposix_fapl_t *fa=NULL; /* MPIPOSIX file access property list information */ - H5FD_mpiposix_fapl_t _fa; /* Private copy of default file access property list information */ + int fd=(-1); /* File handle for file opened */ + int mpi_rank; /* MPI rank of this process */ + int mpi_size; /* Total number of MPI processes */ + int mpi_code; /* mpi return code */ + const H5FD_mpiposix_fapl_t *fa=NULL; /* MPIPOSIX file access property list information */ + H5FD_mpiposix_fapl_t _fa; /* Private copy of default file access property list information */ H5P_genplist_t *plist; /* Property list pointer */ h5_stat_t sb; /* Portable 'stat' struct */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API HFILE filehandle; struct _BY_HANDLE_FILE_INFORMATION fileinfo; int results; @@ -644,18 +644,18 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id, if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") if (H5P_FILE_ACCESS_DEFAULT==fapl_id || H5FD_MPIPOSIX!=H5P_get_driver(plist)) { - _fa.comm = MPI_COMM_SELF; /*default*/ + _fa.comm = MPI_COMM_SELF; /*default*/ _fa.use_gpfs = FALSE; - fa = &_fa; + fa = &_fa; } /* end if */ else { - fa = H5P_get_driver_info(plist); - assert(fa); + fa = H5P_get_driver_info(plist); + assert(fa); } /* end else */ /* Duplicate the communicator for use by this file. */ if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(fa->comm, &comm_dup))) - HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code) + HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code) /* Get the MPI rank of this process and the total number of processes */ if (MPI_SUCCESS != (mpi_code=MPI_Comm_rank (comm_dup, &mpi_rank))) @@ -756,7 +756,7 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id, file->fd = fd; file->eof = sb.st_size; - /* for _WIN32 support. _WIN32 'stat' does not have st_blksize and st_blksize + /* for H5_HAVE_WIN32_API support. H5_HAVE_WIN32_API 'stat' does not have st_blksize and st_blksize is only used for the H5_HAVE_GPFS case */ #ifdef H5_HAVE_GPFS file->blksize = sb.st_blksize; @@ -775,7 +775,7 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id, file->op = OP_UNKNOWN; /* Set the information for the file's device and inode */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API filehandle = _get_osfhandle(fd); results = GetFileInformationByHandle((HANDLE)filehandle, &fileinfo); file->fileindexhi = fileinfo.nFileIndexHigh; @@ -794,8 +794,8 @@ done: /* Close the file if it was left open */ if(fd!=(-1)) HDclose(fd); - if (MPI_COMM_NULL != comm_dup) - MPI_Comm_free(&comm_dup); + if (MPI_COMM_NULL != comm_dup) + MPI_Comm_free(&comm_dup); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -807,21 +807,21 @@ done: * * Purpose: Closes a file. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: - * Albert Cheng, 2003-04-24 - * Free the communicator stored. + * Albert Cheng, 2003-04-24 + * Free the communicator stored. *------------------------------------------------------------------------- */ static herr_t H5FD_mpiposix_close(H5FD_t *_file) { - H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; + H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpiposix_close, FAIL) @@ -845,16 +845,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_cmp + * Function: H5FD_mpiposix_cmp * - * Purpose: Compares two files belonging to this driver using an - * arbitrary (but consistent) ordering. + * Purpose: Compares two files belonging to this driver using an + * arbitrary (but consistent) ordering. * - * Return: Success: A value like strcmp() - * Failure: never fails (arguments were checked by the - * caller). + * Return: Success: A value like strcmp() + * Failure: never fails (arguments were checked by the + * caller). * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: @@ -864,13 +864,13 @@ done: static int H5FD_mpiposix_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { - const H5FD_mpiposix_t *f1 = (const H5FD_mpiposix_t*)_f1; - const H5FD_mpiposix_t *f2 = (const H5FD_mpiposix_t*)_f2; + const H5FD_mpiposix_t *f1 = (const H5FD_mpiposix_t*)_f1; + const H5FD_mpiposix_t *f2 = (const H5FD_mpiposix_t*)_f2; int ret_value=0; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_mpiposix_cmp) -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API if (f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) if (f1->fileindexhi > f2->fileindexhi) HGOTO_DONE(1) @@ -900,15 +900,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_query + * Function: H5FD_mpiposix_query * - * Purpose: Set the flags that this VFL driver is capable of supporting. + * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: @@ -916,8 +916,8 @@ done: * John Mainzer -- 9/21/05 * Modified code to turn off the * H5FD_FEAT_ACCUMULATE_METADATA_WRITE flag. - * With the movement of all cache writes to process 0, - * this flag has become problematic in PHDF5. + * With the movement of all cache writes to process 0, + * this flag has become problematic in PHDF5. * *------------------------------------------------------------------------- */ @@ -943,16 +943,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_get_eoa + * Function: H5FD_mpiposix_get_eoa * - * Purpose: Gets the end-of-address marker for the file. The EOA marker - * is the first address past the last byte allocated in the - * format address space. + * Purpose: Gets the end-of-address marker for the file. The EOA marker + * is the first address past the last byte allocated in the + * format address space. * - * Return: Success: The end-of-address marker. - * Failure: HADDR_UNDEF + * Return: Success: The end-of-address marker. + * Failure: HADDR_UNDEF * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: @@ -982,16 +982,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_set_eoa + * Function: H5FD_mpiposix_set_eoa * - * Purpose: Set the end-of-address marker for the file. This function is - * called shortly after an existing HDF5 file is opened in order - * to tell the driver where the end of the HDF5 data is located. + * Purpose: Set the end-of-address marker for the file. This function is + * called shortly after an existing HDF5 file is opened in order + * to tell the driver where the end of the HDF5 data is located. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: @@ -1004,7 +1004,7 @@ done: static herr_t H5FD_mpiposix_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr) { - H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; + H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpiposix_set_eoa, FAIL) @@ -1020,21 +1020,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_get_eof + * Function: H5FD_mpiposix_get_eof * - * Purpose: Gets the end-of-file marker for the file. The EOF marker - * is the real size of the file. + * Purpose: Gets the end-of-file marker for the file. The EOF marker + * is the real size of the file. * - * The MPIPOSIX driver doesn't bother keeping this field updated - * since that's a relatively expensive operation. Fortunately - * the library only needs the EOF just after the file is opened - * in order to determine whether the file is empty, truncated, - * or okay. + * The MPIPOSIX driver doesn't bother keeping this field updated + * since that's a relatively expensive operation. Fortunately + * the library only needs the EOF just after the file is opened + * in order to determine whether the file is empty, truncated, + * or okay. * - * Return: Success: The end-of-address marker. - * Failure: HADDR_UNDEF + * Return: Success: The end-of-address marker. + * Failure: HADDR_UNDEF * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: @@ -1044,7 +1044,7 @@ done: static haddr_t H5FD_mpiposix_get_eof(const H5FD_t *_file) { - const H5FD_mpiposix_t *file = (const H5FD_mpiposix_t*)_file; + const H5FD_mpiposix_t *file = (const H5FD_mpiposix_t*)_file; haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpiposix_get_eof, HADDR_UNDEF) @@ -1093,21 +1093,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_read + * Function: H5FD_mpiposix_read * - * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR - * into buffer BUF according to data transfer properties in - * DXPL_ID using potentially complex file and buffer types to - * effect the transfer. + * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR + * into buffer BUF according to data transfer properties in + * DXPL_ID using potentially complex file and buffer types to + * effect the transfer. * - * Reading past the end of the file returns zeros instead of - * failing. + * Reading past the end of the file returns zeros instead of + * failing. * - * Return: Success: Non-negative. Result is stored in caller-supplied - * buffer BUF. - * Failure: Negative, Contents of buffer BUF are undefined. + * Return: Success: Non-negative. Result is stored in caller-supplied + * buffer BUF. + * Failure: Negative, Contents of buffer BUF are undefined. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: @@ -1116,11 +1116,11 @@ done: */ static herr_t H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr_t addr, size_t size, - void *buf/*out*/) + void *buf/*out*/) { - H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; - ssize_t nbytes; /* Number of bytes read each I/O call */ - herr_t ret_value=SUCCEED; + H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; + ssize_t nbytes; /* Number of bytes read each I/O call */ + herr_t ret_value=SUCCEED; FUNC_ENTER_NOAPI(H5FD_mpiposix_read, FAIL) @@ -1189,17 +1189,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_write + * Function: H5FD_mpiposix_write * - * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR - * from buffer BUF according to data transfer properties in - * DXPL_ID using potentially complex file and buffer types to - * effect the transfer. + * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR + * from buffer BUF according to data transfer properties in + * DXPL_ID using potentially complex file and buffer types to + * effect the transfer. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: @@ -1214,15 +1214,15 @@ done: */ static herr_t H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, - size_t size, const void *buf) + size_t size, const void *buf) { - H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; + H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; #if 0 /* JRM */ - int mpi_code; /* MPI return code */ + int mpi_code; /* MPI return code */ #endif /* JRM */ - ssize_t nbytes; /* Number of bytes written each I/O call */ + ssize_t nbytes; /* Number of bytes written each I/O call */ H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpiposix_write, FAIL) @@ -1251,10 +1251,10 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, * writes between processes, but we should really just flag an error * whenever any process other than process 0 attempts to write * metadata. - * -- JRM 9/1/05 + * -- JRM 9/1/05 */ if(type!=H5FD_MEM_DRAW) { - unsigned block_before_meta_write=0; /* Whether to block before a metadata write */ + unsigned block_before_meta_write=0; /* Whether to block before a metadata write */ /* Check if we need to syncronize all processes before attempting metadata write * (Prevents race condition where the process writing the metadata goes ahead @@ -1352,11 +1352,11 @@ done: } /* end if */ #if 0 /* JRM */ /* Since metadata writes are now done by process 0 only, this broadcast - * is no longer needed. I leave it in and commented out to remind us - * that we need to re-work this function to reflect this reallity. - * - * -- JRM 9/1/05 - */ + * is no longer needed. I leave it in and commented out to remind us + * that we need to re-work this function to reflect this reallity. + * + * -- JRM 9/1/05 + */ /* Guard against getting into metadata broadcast in failure cases */ else { @@ -1375,11 +1375,11 @@ done: /*------------------------------------------------------------------------- * Function: H5FD_mpiposix_truncate * - * Purpose: Makes sure that the true file size is the same (or larger) - * than the end-of-address. + * Purpose: Makes sure that the true file size is the same (or larger) + * than the end-of-address. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Thursday, July 11, 2002 @@ -1389,12 +1389,12 @@ done: static herr_t H5FD_mpiposix_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) { - H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; -#ifdef _WIN32 + H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; +#ifdef H5_HAVE_WIN32_API HFILE filehandle; /* Windows file handle */ LARGE_INTEGER li; /* 64-bit integer for SetFilePointer() call */ -#endif /* _WIN32 */ - int mpi_code; /* MPI return code */ +#endif /* H5_HAVE_WIN32_API */ + int mpi_code; /* MPI return code */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5FD_mpiposix_truncate, FAIL) @@ -1406,7 +1406,7 @@ H5FD_mpiposix_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closi if(file->eoa > file->last_eoa) { /* Use the round-robin process to truncate (extend) the file */ if(file->mpi_rank == H5_PAR_META_WRITE) { -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API /* Map the posix file handle to a Windows file handle */ filehandle = _get_osfhandle(file->fd); @@ -1416,10 +1416,10 @@ H5FD_mpiposix_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closi SetFilePointer((HANDLE)filehandle, li.LowPart, &li.HighPart, FILE_BEGIN); if(SetEndOfFile((HANDLE)filehandle) == 0) HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") -#else /* _WIN32 */ +#else /* H5_HAVE_WIN32_API */ if(-1==file_truncate(file->fd, (file_offset_t)file->eoa)) HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ } /* end if */ /* Don't let any proc return until all have extended the file. @@ -1446,14 +1446,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_mpi_rank + * Function: H5FD_mpiposix_mpi_rank * - * Purpose: Returns the MPI rank for a process + * Purpose: Returns the MPI rank for a process * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: @@ -1480,14 +1480,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_mpi_size + * Function: H5FD_mpiposix_mpi_size * - * Purpose: Returns the number of MPI processes + * Purpose: Returns the number of MPI processes * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: @@ -1514,15 +1514,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_communicator + * Function: H5FD_mpiposix_communicator * - * Purpose: Returns the MPI communicator for the file. + * Purpose: Returns the MPI communicator for the file. * - * Return: Success: The communicator + * Return: Success: The communicator * - * Failure: NULL + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 7908fd9..3618474 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -62,7 +62,7 @@ typedef struct H5FD_sec2_t { haddr_t pos; /*current file I/O position */ H5FD_file_op_t op; /*last operation */ char filename[H5FD_MAX_FILENAME_LEN]; /* Copy of file name from open operation */ -#ifndef _WIN32 +#ifndef H5_HAVE_WIN32_API /* * On most systems the combination of device and i-node number uniquely * identify a file. @@ -75,7 +75,7 @@ typedef struct H5FD_sec2_t { #endif /*H5_VMS*/ #else /* - * On _WIN32 the low-order word of a unique identifier associated with the + * On H5_HAVE_WIN32_API the low-order word of a unique identifier associated with the * file and the volume serial number uniquely identify a file. This number * (which, both? -rpm) may change when the system is restarted or when the * file is opened. After a process opens a file, the identifier is @@ -314,7 +314,7 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) H5FD_sec2_t *file = NULL; /* sec2 VFD info */ int fd = (-1); /* File descriptor */ int o_flags; /* Flags for open() call */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API HFILE filehandle; struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif @@ -360,12 +360,12 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) H5_ASSIGN_OVERFLOW(file->eof, sb.st_size, h5_stat_size_t, haddr_t); file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API filehandle = _get_osfhandle(fd); (void)GetFileInformationByHandle((HANDLE)filehandle, &fileinfo); file->fileindexhi = fileinfo.nFileIndexHigh; file->fileindexlo = fileinfo.nFileIndexLow; -#else /* _WIN32 */ +#else /* H5_HAVE_WIN32_API */ file->device = sb.st_dev; #ifdef H5_VMS file->inode[0] = sb.st_ino[0]; @@ -375,7 +375,7 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) file->inode = sb.st_ino; #endif /*H5_VMS*/ -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ /* Retain a copy of the name used to open the file, for possible error reporting */ HDstrncpy(file->filename, name, sizeof(file->filename)); @@ -474,7 +474,7 @@ H5FD_sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_sec2_cmp) -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API if(f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) if(f1->fileindexhi > f2->fileindexhi) HGOTO_DONE(1) @@ -861,7 +861,7 @@ H5FD_sec2_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) /* Extend the file to make sure it's large enough */ if(!H5F_addr_eq(file->eoa, file->eof)) { -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API HFILE filehandle; /* Windows file handle */ LARGE_INTEGER li; /* 64-bit integer for SetFilePointer() call */ @@ -874,7 +874,7 @@ H5FD_sec2_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) (void)SetFilePointer((HANDLE)filehandle, li.LowPart, &li.HighPart, FILE_BEGIN); if(SetEndOfFile((HANDLE)filehandle) == 0) HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") -#else /* _WIN32 */ +#else /* H5_HAVE_WIN32_API */ #ifdef H5_VMS /* Reset seek offset to the beginning of the file, so that the file isn't * re-extended later. This may happen on Open VMS. */ @@ -884,7 +884,7 @@ H5FD_sec2_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) if(-1 == HDftruncate(file->fd, (HDoff_t)file->eoa)) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ /* Update the eof value */ file->eof = file->eoa; diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 4c53769..b67e01e 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -14,12 +14,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Wednesday, October 22, 1997 + * Programmer: Robb Matzke + * Wednesday, October 22, 1997 * - * Purpose: This is the Posix stdio.h I/O subclass of H5Flow. - * It also serves as an example of coding a simple file driver, - * therefore, it should not use any non-public definitions. + * Purpose: This is the Posix stdio.h I/O subclass of H5Flow. + * It also serves as an example of coding a simple file driver, + * therefore, it should not use any non-public definitions. * * Notes: Ported to the new H5FD architecture on 10/18/99 - QAK * @@ -43,7 +43,7 @@ #include #endif -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API #include #include @@ -58,7 +58,7 @@ #ifdef MAX #undef MAX #endif /* MAX */ -#define MAX(X,Y) ((X)>(Y)?(X):(Y)) +#define MAX(X,Y) ((X)>(Y)?(X):(Y)) /* The driver identification number, initialized at runtime */ static hid_t H5FD_STDIO_g = 0; @@ -84,23 +84,23 @@ typedef enum { * occurs), and `op' will be set to H5F_OP_UNKNOWN. */ typedef struct H5FD_stdio_t { - H5FD_t pub; /*public stuff, must be first */ - FILE * fp; /*the file handle */ - haddr_t eoa; /*end of allocated region */ - haddr_t eof; /*end of file; current file size*/ - haddr_t pos; /*current file I/O position */ - H5FD_stdio_file_op op; /*last operation */ + H5FD_t pub; /*public stuff, must be first */ + FILE * fp; /*the file handle */ + haddr_t eoa; /*end of allocated region */ + haddr_t eof; /*end of file; current file size*/ + haddr_t pos; /*current file I/O position */ + H5FD_stdio_file_op op; /*last operation */ unsigned write_access; /* Flag to indicate the file was opened with write access */ -#ifndef _WIN32 +#ifndef H5_HAVE_WIN32_API /* * On most systems the combination of device and i-node number uniquely * identify a file. */ - dev_t device; /*file device number */ - ino_t inode; /*file i-node number */ + dev_t device; /*file device number */ + ino_t inode; /*file i-node number */ #else /* - * On _WIN32 the low-order word of a unique identifier associated with the + * On H5_HAVE_WIN32_API the low-order word of a unique identifier associated with the * file and the volume serial number uniquely identify a file. This number * (which, both? -rpm) may change when the system is restarted or when the * file is opened. After a process opens a file, the identifier is @@ -114,18 +114,11 @@ typedef struct H5FD_stdio_t { } H5FD_stdio_t; /* Use similar structure as in H5private.h by defining Windows stuff first. */ -#ifdef _WIN32 - #if _MSC_VER > 1310 /* Newer than VS.NET 2003 */ - # define file_fseek _fseeki64 - # define file_offset_t __int64 - # define file_ftruncate _chsize_s /* Supported in VS 2005 or newer */ - # define file_ftell _ftelli64 - #else - # define file_fseek fseek - # define file_offset_t long - # define file_ftruncate _chsize - # define file_ftell ftell - #endif +#ifdef H5_HAVE_WIN32_API + # define file_fseek _fseeki64 + # define file_offset_t __int64 + # define file_ftruncate _chsize_s /* Supported in VS 2005 or newer */ + # define file_ftell _ftelli64 #endif /* Use file_xxx to indicate these are local macros, avoiding confusing @@ -135,15 +128,15 @@ typedef struct H5FD_stdio_t { */ #ifndef file_fseek #ifdef H5_HAVE_FSEEKO64 - # define file_fseek fseeko64 - # define file_offset_t off64_t - # define file_ftruncate ftruncate64 - # define file_ftell ftello64 + # define file_fseek fseeko64 + # define file_offset_t off64_t + # define file_ftruncate ftruncate64 + # define file_ftell ftello64 #else - # define file_fseek fseeko - # define file_offset_t off_t - # define file_ftruncate ftruncate - # define file_ftell ftello + # define file_fseek fseeko + # define file_offset_t off_t + # define file_ftruncate ftruncate + # define file_ftell ftello #endif #endif @@ -151,22 +144,22 @@ typedef struct H5FD_stdio_t { * These macros check for overflow of various quantities. These macros * assume that file_offset_t is signed and haddr_t and size_t are unsigned. * - * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' - * is too large to be represented by the second argument - * of the file seek function. + * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' + * is too large to be represented by the second argument + * of the file seek function. * - * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too - * large to be represented by the `size_t' type. + * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too + * large to be represented by the `size_t' type. * - * REGION_OVERFLOW: Checks whether an address and size pair describe data - * which can be addressed entirely by the second - * argument of the file seek function. + * REGION_OVERFLOW: Checks whether an address and size pair describe data + * which can be addressed entirely by the second + * argument of the file seek function. */ /* adding for windows NT filesystem support. */ #define MAXADDR (((haddr_t)1<<(8*sizeof(file_offset_t)-1))-1) -#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR)) -#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) -#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ +#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR)) +#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) +#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ HADDR_UNDEF==(A)+(Z) || (file_offset_t)((A)+(Z))<(file_offset_t)(A)) /* Prototypes */ @@ -189,52 +182,52 @@ static herr_t H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); static herr_t H5FD_stdio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static const H5FD_class_t H5FD_stdio_g = { - "stdio", /*name */ - MAXADDR, /*maxaddr */ - H5F_CLOSE_WEAK, /* fc_degree */ + "stdio", /*name */ + MAXADDR, /*maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ H5FD_stdio_term, /*terminate */ - NULL, /*sb_size */ - NULL, /*sb_encode */ - NULL, /*sb_decode */ - 0, /*fapl_size */ - NULL, /*fapl_get */ - NULL, /*fapl_copy */ - NULL, /*fapl_free */ - 0, /*dxpl_size */ - NULL, /*dxpl_copy */ - NULL, /*dxpl_free */ - H5FD_stdio_open, /*open */ - H5FD_stdio_close, /*close */ - H5FD_stdio_cmp, /*cmp */ - H5FD_stdio_query, /*query */ - NULL, /*get_type_map */ - H5FD_stdio_alloc, /*alloc */ - NULL, /*free */ - H5FD_stdio_get_eoa, /*get_eoa */ - H5FD_stdio_set_eoa, /*set_eoa */ - H5FD_stdio_get_eof, /*get_eof */ + NULL, /*sb_size */ + NULL, /*sb_encode */ + NULL, /*sb_decode */ + 0, /*fapl_size */ + NULL, /*fapl_get */ + NULL, /*fapl_copy */ + NULL, /*fapl_free */ + 0, /*dxpl_size */ + NULL, /*dxpl_copy */ + NULL, /*dxpl_free */ + H5FD_stdio_open, /*open */ + H5FD_stdio_close, /*close */ + H5FD_stdio_cmp, /*cmp */ + H5FD_stdio_query, /*query */ + NULL, /*get_type_map */ + H5FD_stdio_alloc, /*alloc */ + NULL, /*free */ + H5FD_stdio_get_eoa, /*get_eoa */ + H5FD_stdio_set_eoa, /*set_eoa */ + H5FD_stdio_get_eof, /*get_eof */ H5FD_stdio_get_handle, /*get_handle */ - H5FD_stdio_read, /*read */ - H5FD_stdio_write, /*write */ - H5FD_stdio_flush, /*flush */ - H5FD_stdio_truncate, /*truncate */ + H5FD_stdio_read, /*read */ + H5FD_stdio_write, /*write */ + H5FD_stdio_flush, /*flush */ + H5FD_stdio_truncate, /*truncate */ NULL, /*lock */ NULL, /*unlock */ - H5FD_FLMAP_SINGLE /*fl_map */ + H5FD_FLMAP_SINGLE /*fl_map */ }; /*------------------------------------------------------------------------- - * Function: H5FD_stdio_init + * Function: H5FD_stdio_init * - * Purpose: Initialize this driver by registering the driver with the - * library. + * Purpose: Initialize this driver by registering the driver with the + * library. * - * Return: Success: The driver ID for the stdio driver. + * Return: Success: The driver ID for the stdio driver. * - * Failure: Negative. + * Failure: Negative. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * * Modifications: @@ -255,9 +248,9 @@ H5FD_stdio_init(void) /*--------------------------------------------------------------------------- - * Function: H5FD_stdio_term + * Function: H5FD_stdio_term * - * Purpose: Shut down the VFD + * Purpose: Shut down the VFD * * Returns: Non-negative on success or negative on failure * @@ -277,16 +270,16 @@ H5FD_stdio_term(void) /*------------------------------------------------------------------------- - * Function: H5Pset_fapl_stdio + * Function: H5Pset_fapl_stdio * - * Purpose: Modify the file access property list to use the H5FD_STDIO - * driver defined in this source file. There are no driver - * specific properties. + * Purpose: Modify the file access property list to use the H5FD_STDIO + * driver defined in this source file. There are no driver + * specific properties. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, February 19, 1998 + * Programmer: Robb Matzke + * Thursday, February 19, 1998 * * Modifications: * Stolen from the sec2 driver - QAK, 10/18/99 @@ -311,27 +304,27 @@ H5Pset_fapl_stdio(hid_t fapl_id) /*------------------------------------------------------------------------- - * Function: H5FD_stdio_open + * Function: H5FD_stdio_open * - * Purpose: Create and/or opens a Standard C file as an HDF5 file. + * Purpose: Create and/or opens a Standard C file as an HDF5 file. * - * Bugs: H5F_ACC_EXCL has a race condition. (? -QAK) + * Bugs: H5F_ACC_EXCL has a race condition. (? -QAK) * * Errors: - * IO CANTOPENFILE File doesn't exist and CREAT wasn't - * specified. - * IO CANTOPENFILE Fopen failed. - * IO FILEEXISTS File exists but CREAT and EXCL were - * specified. + * IO CANTOPENFILE File doesn't exist and CREAT wasn't + * specified. + * IO CANTOPENFILE Fopen failed. + * IO FILEEXISTS File exists but CREAT and EXCL were + * specified. * - * Return: Success: A pointer to a new file data structure. The - * public fields will be initialized by the - * caller, which is always H5FD_open(). + * Return: Success: A pointer to a new file data structure. The + * public fields will be initialized by the + * caller, which is always H5FD_open(). * - * Failure: NULL + * Failure: NULL * - * Programmer: Robb Matzke - * Wednesday, October 22, 1997 + * Programmer: Robb Matzke + * Wednesday, October 22, 1997 * * Modifications: * Ported to VFL/H5FD layer - QAK, 10/18/99 @@ -342,17 +335,17 @@ static H5FD_t * H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - FILE *f = NULL; + FILE *f = NULL; unsigned write_access=0; /* File opened with write access? */ - H5FD_stdio_t *file=NULL; + H5FD_stdio_t *file=NULL; static const char *func="H5FD_stdio_open"; /* Function Name for error reporting */ -#ifdef _WIN32 - HFILE filehandle; - struct _BY_HANDLE_FILE_INFORMATION fileinfo; +#ifdef H5_HAVE_WIN32_API + HFILE filehandle; + struct _BY_HANDLE_FILE_INFORMATION fileinfo; int fd; -#else /* _WIN32 */ - struct stat sb; -#endif /* _WIN32 */ +#else /* H5_HAVE_WIN32_API */ + struct stat sb; +#endif /* H5_HAVE_WIN32_API */ /* Sanity check on file offsets */ assert(sizeof(file_offset_t)>=sizeof(size_t)); @@ -410,7 +403,7 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id, } /* The unique key */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API /*#error "Needs correct fileindexhi & fileindexlo, code below is from sec2 driver"*/ fd = _fileno(f); filehandle = _get_osfhandle(fd); @@ -427,17 +420,17 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id, /*------------------------------------------------------------------------- - * Function: H5F_stdio_close + * Function: H5F_stdio_close * - * Purpose: Closes a file. + * Purpose: Closes a file. * * Errors: - * IO CLOSEERROR Fclose failed. + * IO CLOSEERROR Fclose failed. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, October 22, 1997 + * Programmer: Robb Matzke + * Wednesday, October 22, 1997 * * Modifications: * Ported to VFL/H5FD layer - QAK, 10/18/99 @@ -447,7 +440,7 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id, static herr_t H5FD_stdio_close(H5FD_t *_file) { - H5FD_stdio_t *file = (H5FD_stdio_t*)_file; + H5FD_stdio_t *file = (H5FD_stdio_t*)_file; static const char *func="H5FD_stdio_close"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -463,17 +456,17 @@ H5FD_stdio_close(H5FD_t *_file) /*------------------------------------------------------------------------- - * Function: H5FD_stdio_cmp + * Function: H5FD_stdio_cmp * - * Purpose: Compares two files belonging to this driver using an - * arbitrary (but consistent) ordering. + * Purpose: Compares two files belonging to this driver using an + * arbitrary (but consistent) ordering. * - * Return: Success: A value like strcmp() + * Return: Success: A value like strcmp() * - * Failure: never fails (arguments were checked by the - * caller). + * Failure: never fails (arguments were checked by the + * caller). * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * * Modifications: @@ -484,13 +477,13 @@ H5FD_stdio_close(H5FD_t *_file) static int H5FD_stdio_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { - const H5FD_stdio_t *f1 = (const H5FD_stdio_t*)_f1; - const H5FD_stdio_t *f2 = (const H5FD_stdio_t*)_f2; + const H5FD_stdio_t *f1 = (const H5FD_stdio_t*)_f1; + const H5FD_stdio_t *f2 = (const H5FD_stdio_t*)_f2; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API if (f1->fileindexhi < f2->fileindexhi) return -1; if (f1->fileindexhi > f2->fileindexhi) return 1; @@ -518,16 +511,16 @@ H5FD_stdio_cmp(const H5FD_t *_f1, const H5FD_t *_f2) /*------------------------------------------------------------------------- - * Function: H5FD_stdio_query + * Function: H5FD_stdio_query * - * Purpose: Set the flags that this VFL driver is capable of supporting. + * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) * - * Return: Success: non-negative + * Return: Success: non-negative * - * Failure: negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, August 25, 2000 * * Modifications: @@ -554,18 +547,18 @@ H5FD_stdio_query(const H5FD_t *_f, unsigned long *flags /* out */) /*------------------------------------------------------------------------- - * Function: H5FD_stdio_alloc + * Function: H5FD_stdio_alloc * - * Purpose: Allocates file memory. If fseeko isn't available, makes + * Purpose: Allocates file memory. If fseeko isn't available, makes * sure the file size isn't bigger than 2GB because the * parameter OFFSET of fseek is of the type LONG INT, limiting * the file size to 2GB. * - * Return: Success: Address of new memory + * Return: Success: Address of new memory * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 30 March 2007 * * Modifications: @@ -575,8 +568,8 @@ H5FD_stdio_query(const H5FD_t *_f, unsigned long *flags /* out */) static haddr_t H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxpl_id, hsize_t size) { - H5FD_stdio_t *file = (H5FD_stdio_t*)_file; - haddr_t addr; + H5FD_stdio_t *file = (H5FD_stdio_t*)_file; + haddr_t addr; haddr_t ret_value; /* Return value */ /* Shut compiler up */ @@ -606,17 +599,17 @@ H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxp /*------------------------------------------------------------------------- - * Function: H5FD_stdio_get_eoa + * Function: H5FD_stdio_get_eoa * - * Purpose: Gets the end-of-address marker for the file. The EOA marker - * is the first address past the last byte allocated in the - * format address space. + * Purpose: Gets the end-of-address marker for the file. The EOA marker + * is the first address past the last byte allocated in the + * format address space. * - * Return: Success: The end-of-address marker. + * Return: Success: The end-of-address marker. * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 2, 1999 * * Modifications: @@ -631,7 +624,7 @@ H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxp static haddr_t H5FD_stdio_get_eoa(const H5FD_t *_file, H5FD_mem_t /*unused*/ type) { - const H5FD_stdio_t *file = (const H5FD_stdio_t *)_file; + const H5FD_stdio_t *file = (const H5FD_stdio_t *)_file; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -644,17 +637,17 @@ H5FD_stdio_get_eoa(const H5FD_t *_file, H5FD_mem_t /*unused*/ type) /*------------------------------------------------------------------------- - * Function: H5FD_stdio_set_eoa + * Function: H5FD_stdio_set_eoa * - * Purpose: Set the end-of-address marker for the file. This function is - * called shortly after an existing HDF5 file is opened in order - * to tell the driver where the end of the HDF5 data is located. + * Purpose: Set the end-of-address marker for the file. This function is + * called shortly after an existing HDF5 file is opened in order + * to tell the driver where the end of the HDF5 data is located. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * * Modifications: @@ -668,7 +661,7 @@ H5FD_stdio_get_eoa(const H5FD_t *_file, H5FD_mem_t /*unused*/ type) static herr_t H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t /*unused*/ type, haddr_t addr) { - H5FD_stdio_t *file = (H5FD_stdio_t*)_file; + H5FD_stdio_t *file = (H5FD_stdio_t*)_file; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -683,19 +676,19 @@ H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t /*unused*/ type, haddr_t addr) /*------------------------------------------------------------------------- - * Function: H5FD_stdio_get_eof + * Function: H5FD_stdio_get_eof * - * Purpose: Returns the end-of-file marker, which is the greater of - * either the Unix end-of-file or the HDF5 end-of-address - * markers. + * Purpose: Returns the end-of-file marker, which is the greater of + * either the Unix end-of-file or the HDF5 end-of-address + * markers. * - * Return: Success: End of file address, the first address past - * the end of the "file", either the Unix file - * or the HDF5 file. + * Return: Success: End of file address, the first address past + * the end of the "file", either the Unix file + * or the HDF5 file. * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * * Modifications: @@ -706,7 +699,7 @@ H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t /*unused*/ type, haddr_t addr) static haddr_t H5FD_stdio_get_eof(const H5FD_t *_file) { - const H5FD_stdio_t *file = (const H5FD_stdio_t *)_file; + const H5FD_stdio_t *file = (const H5FD_stdio_t *)_file; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -749,24 +742,24 @@ H5FD_stdio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) /*------------------------------------------------------------------------- - * Function: H5F_stdio_read + * Function: H5F_stdio_read * - * Purpose: Reads SIZE bytes beginning at address ADDR in file LF and - * places them in buffer BUF. Reading past the logical or - * physical end of file returns zeros instead of failing. + * Purpose: Reads SIZE bytes beginning at address ADDR in file LF and + * places them in buffer BUF. Reading past the logical or + * physical end of file returns zeros instead of failing. * * Errors: - * IO READERROR Fread failed. - * IO SEEKERROR Fseek failed. + * IO READERROR Fread failed. + * IO SEEKERROR Fseek failed. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, October 22, 1997 + * Programmer: Robb Matzke + * Wednesday, October 22, 1997 * * Modifications: - * June 2, 1998 Albert Cheng - * Added xfer_mode argument + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * * Ported to VFL/H5FD layer - QAK, 10/18/99 * @@ -776,8 +769,8 @@ static herr_t H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf/*out*/) { - size_t n; - H5FD_stdio_t *file = (H5FD_stdio_t*)_file; + size_t n; + H5FD_stdio_t *file = (H5FD_stdio_t*)_file; static const char *func="H5FD_stdio_read"; /* Function Name for error reporting */ /* Shut compiler up */ @@ -849,23 +842,23 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz /*------------------------------------------------------------------------- - * Function: H5F_stdio_write + * Function: H5F_stdio_write * - * Purpose: Writes SIZE bytes from the beginning of BUF into file LF at - * file address ADDR. + * Purpose: Writes SIZE bytes from the beginning of BUF into file LF at + * file address ADDR. * * Errors: - * IO SEEKERROR Fseek failed. - * IO WRITEERROR Fwrite failed. + * IO SEEKERROR Fseek failed. + * IO WRITEERROR Fwrite failed. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, October 22, 1997 + * Programmer: Robb Matzke + * Wednesday, October 22, 1997 * * Modifications: - * June 2, 1998 Albert Cheng - * Added xfer_mode argument + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * * Ported to VFL/H5FD layer - QAK, 10/18/99 * @@ -873,9 +866,9 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz */ static herr_t H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, - size_t size, const void *buf) + size_t size, const void *buf) { - H5FD_stdio_t *file = (H5FD_stdio_t*)_file; + H5FD_stdio_t *file = (H5FD_stdio_t*)_file; static const char *func="H5FD_stdio_write"; /* Function Name for error reporting */ /* Shut compiler up */ @@ -932,25 +925,25 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, /*------------------------------------------------------------------------- - * Function: H5F_stdio_flush + * Function: H5F_stdio_flush * - * Purpose: Makes sure that all data is on disk. + * Purpose: Makes sure that all data is on disk. * * Errors: - * IO SEEKERROR fseek failed. - * IO WRITEERROR fflush or fwrite failed. + * IO SEEKERROR fseek failed. + * IO WRITEERROR fflush or fwrite failed. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, October 22, 1997 + * Programmer: Robb Matzke + * Wednesday, October 22, 1997 * *------------------------------------------------------------------------- */ static herr_t H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) { - H5FD_stdio_t *file = (H5FD_stdio_t*)_file; + H5FD_stdio_t *file = (H5FD_stdio_t*)_file; static const char *func = "H5FD_stdio_flush"; /* Function Name for error reporting */ /* Shut compiler up */ @@ -977,29 +970,29 @@ H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) /*------------------------------------------------------------------------- - * Function: H5F_stdio_truncate + * Function: H5F_stdio_truncate * - * Purpose: Makes sure that the true file size is the same (or larger) - * than the end-of-address. + * Purpose: Makes sure that the true file size is the same (or larger) + * than the end-of-address. * * Errors: - * IO SEEKERROR fseek failed. - * IO WRITEERROR fflush or fwrite failed. + * IO SEEKERROR fseek failed. + * IO WRITEERROR fflush or fwrite failed. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, January 31, 2008 + * Programmer: Quincey Koziol + * Thursday, January 31, 2008 * * Modifications: - * Vailin Choi; June 2010 - * Fix for window failures manifested from tests in mf.c. + * Vailin Choi; June 2010 + * Fix for window failures manifested from tests in mf.c. *------------------------------------------------------------------------- */ static herr_t H5FD_stdio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) { - H5FD_stdio_t *file = (H5FD_stdio_t*)_file; + H5FD_stdio_t *file = (H5FD_stdio_t*)_file; static const char *func = "H5FD_stdio_truncate"; /* Function Name for error reporting */ /* Shut compiler up */ @@ -1015,11 +1008,11 @@ H5FD_stdio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) if(file->eoa != file->eof) { int fd = fileno(file->fp); /* File descriptor for HDF5 file */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API HFILE filehandle; /* Windows file handle */ LARGE_INTEGER li; /* 64-bit integer for SetFilePointer() call */ - /* Reset seek offset to beginning of file, so that file isn't re-extended later */ + /* Reset seek offset to beginning of file, so that file isn't re-extended later */ rewind(file->fp); /* Map the posix file handle to a Windows file handle */ @@ -1031,14 +1024,14 @@ H5FD_stdio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) (void)SetFilePointer((HANDLE)filehandle, li.LowPart, &li.HighPart, FILE_BEGIN); if(SetEndOfFile((HANDLE)filehandle) == 0) H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "unable to truncate/extend file properly", -1) -#else /* _WIN32 */ +#else /* H5_HAVE_WIN32_API */ /* Reset seek offset to beginning of file, so that file isn't re-extended later */ rewind(file->fp); /* Truncate file to proper length */ if(-1 == file_ftruncate(fd, (file_offset_t)file->eoa)) H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "unable to truncate/extend file properly", -1) -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ /* Update the eof value */ file->eof = file->eoa; diff --git a/src/H5FDwindows.c b/src/H5FDwindows.c index de3fe33..fbd13ea 100644 --- a/src/H5FDwindows.c +++ b/src/H5FDwindows.c @@ -81,7 +81,7 @@ typedef struct H5FD_windows_t { int op; /*last operation */ unsigned write_access; /*flag to indicate the file was opened with write access */ /* - * On _WIN32 the low-order word of a unique identifier associated with the + * On H5_HAVE_WIN32_API the low-order word of a unique identifier associated with the * file and the volume serial number uniquely identify a file. This number * may change when the system is restarted or when the * file is opened. After a process opens a file, the identifier is diff --git a/src/H5TS.c b/src/H5TS.c index 1d7042a..5609d33 100644 --- a/src/H5TS.c +++ b/src/H5TS.c @@ -14,9 +14,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* private headers */ -#include "H5private.h" /*library */ -#include "H5Eprivate.h" /*error handling */ -#include "H5MMprivate.h" /*memory management functions */ +#include "H5private.h" /*library */ +#include "H5Eprivate.h" /*error handling */ +#include "H5MMprivate.h" /*memory management functions */ #ifdef H5_HAVE_THREADSAFE @@ -127,7 +127,7 @@ H5TS_pthread_first_thread_init(void) { H5_g.H5_libinit_g = FALSE; -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API # ifdef PTW32_STATIC_LIB pthread_win32_process_attach_np(); # endif @@ -177,7 +177,7 @@ H5TS_pthread_first_thread_init(void) herr_t H5TS_mutex_lock(H5TS_mutex_t *mutex) { -#ifdef H5_HAVE_WIN_THREADS +#ifdef H5_HAVE_WIN_THREADS EnterCriticalSection( &mutex->CriticalSection); return 0; #else /* H5_HAVE_WIN_THREADS */ @@ -232,7 +232,7 @@ H5TS_mutex_lock(H5TS_mutex_t *mutex) herr_t H5TS_mutex_unlock(H5TS_mutex_t *mutex) { -#ifdef H5_HAVE_WIN_THREADS +#ifdef H5_HAVE_WIN_THREADS /* Releases ownership of the specified critical section object. */ LeaveCriticalSection(&mutex->CriticalSection); return 0; @@ -291,7 +291,7 @@ H5TS_mutex_unlock(H5TS_mutex_t *mutex) herr_t H5TS_cancel_count_inc(void) { -#ifdef H5_HAVE_WIN_THREADS +#ifdef H5_HAVE_WIN_THREADS /* unsupported; just return 0 */ return SUCCEED; #else /* H5_HAVE_WIN_THREADS */ @@ -302,25 +302,25 @@ H5TS_cancel_count_inc(void) if (!cancel_counter) { /* - * First time thread calls library - create new counter and associate + * First time thread calls library - create new counter and associate * with key */ - cancel_counter = (H5TS_cancel_t *)H5MM_calloc(sizeof(H5TS_cancel_t)); + cancel_counter = (H5TS_cancel_t *)H5MM_calloc(sizeof(H5TS_cancel_t)); - if (!cancel_counter) { - H5E_push_stack(NULL, "H5TS_cancel_count_inc", - __FILE__, __LINE__, H5E_ERR_CLS_g, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed"); - return FAIL; - } + if (!cancel_counter) { + H5E_push_stack(NULL, "H5TS_cancel_count_inc", + __FILE__, __LINE__, H5E_ERR_CLS_g, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed"); + return FAIL; + } ret_value = pthread_setspecific(H5TS_cancel_key_g, - (void *)cancel_counter); + (void *)cancel_counter); } if (cancel_counter->cancel_count == 0) /* thread entering library */ ret_value = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, - &cancel_counter->previous_state); + &cancel_counter->previous_state); ++cancel_counter->cancel_count; @@ -358,7 +358,7 @@ H5TS_cancel_count_inc(void) herr_t H5TS_cancel_count_dec(void) { -#ifdef H5_HAVE_WIN_THREADS +#ifdef H5_HAVE_WIN_THREADS /* unsupported; will just return 0 */ return SUCCEED; #else /* H5_HAVE_WIN_THREADS */ @@ -397,7 +397,7 @@ H5TS_create_thread(void * func, H5TS_attr_t * attr, void*udata) { H5TS_thread_t ret_value; -#ifdef H5_HAVE_WIN_THREADS +#ifdef H5_HAVE_WIN_THREADS ret_value = CreateThread(NULL, 0, func, udata, 0, NULL); @@ -411,4 +411,4 @@ H5TS_create_thread(void * func, H5TS_attr_t * attr, void*udata) } /* H5TS_create_thread */ -#endif /* H5_HAVE_THREADSAFE */ +#endif /* H5_HAVE_THREADSAFE */ diff --git a/src/H5api_adpt.h b/src/H5api_adpt.h index fc0b467..845a9a0 100644 --- a/src/H5api_adpt.h +++ b/src/H5api_adpt.h @@ -303,10 +303,10 @@ * The Visual Studio project files will not be supported in the next major release of 1.10. */ -#if defined(_WIN32) +#if defined(H5_HAVE_WIN32_API) #if defined(_HDF5DLL_) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ +#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ #define H5_DLL __declspec(dllexport) #define H5_DLLVAR extern __declspec(dllexport) #elif defined(_HDF5USEDLL_) @@ -318,7 +318,7 @@ #endif /* _HDF5DLL_ */ #if defined(_HDF5TESTDLL_) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ +#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ #define H5TEST_DLL __declspec(dllexport) #define H5TEST_DLLVAR extern __declspec(dllexport) #elif defined(_HDF5TESTUSEDLL_) @@ -330,7 +330,7 @@ #endif /* _HDF5TESTDLL_ */ #if defined(_HDF5TOOLSDLL_) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ +#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ #define H5TOOLS_DLL __declspec(dllexport) #define H5TOOLS_DLLVAR extern __declspec(dllexport) #elif defined(_HDF5TOOLSUSEDLL_) @@ -342,7 +342,7 @@ #endif /* _HDF5TOOLSDLL_ */ #if defined(_HDF5_HLDLL_EXPORTS_) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ +#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ #define H5_HLDLL __declspec(dllexport) #elif defined(_HDF5USEHLDLL_) #define H5_HLDLL __declspec(dllimport) @@ -351,7 +351,7 @@ #endif /* _HDF5_HLDLL_EXPORTS */ #if defined(HDF5_HL_CPPDLL_EXPORTS) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ +#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ #define H5_HLCPPDLL __declspec(dllexport) #elif defined(HDF5USE_HLCPPDLL) #define H5_HLCPPDLL __declspec(dllimport) @@ -360,7 +360,7 @@ #endif /*HDF5_HL_CPPDLL_EXPORTS*/ #if defined(HDF5_HL_F90CSTUBDLL_EXPORTS) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ +#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ #define HDF5_HL_F90CSTUBDLL __declspec(dllexport) #elif defined(HDF5USE_HLF90CSTUBDLL) #define HDF5_HL_F90CSTUBDLL __declspec(dllimport) @@ -370,7 +370,7 @@ #if defined(HDF5FORT_CSTUB_DLL_EXPORTS) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ +#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ #define H5_FCDLL __declspec(dllexport) #define H5_FCDLLVAR extern __declspec(dllexport) #elif defined(HDF5FORT_CSTUB_USEDLL) @@ -382,7 +382,7 @@ #endif /* _HDF5_FORTRANDLL_EXPORTS_ */ #if defined(HDF5FORTTEST_CSTUB_DLL_EXPORTS) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ +#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ #define H5_FCTESTDLL __declspec(dllexport) #define H5_FCTESTDLLVAR extern __declspec(dllexport) #elif defined(HDF5FORTTEST_CSTUB_USEDLL) @@ -402,7 +402,7 @@ #define H5_DLLCPP #endif /* HDF5_CPPDLL_EXPORTS */ -#else /*_WIN32*/ +#else /*H5_HAVE_WIN32_API*/ #define H5_DLL #define H5_HLDLL #define H5_HLCPPDLL @@ -417,7 +417,7 @@ #define H5_FCDLLVAR extern #define H5_FCTESTDLL #define H5_FCTESTDLLVAR extern -#endif +#endif /*H5_HAVE_WIN32_API*/ #endif /* H5API_ADPT_H */ diff --git a/src/H5private.h b/src/H5private.h index d87ad90..e6ad056 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -13,34 +13,34 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke - * Friday, October 30, 1998 +/* Programmer: Robb Matzke + * Friday, October 30, 1998 * - * Purpose: This file is included by all HDF5 library source files to - * define common things which are not defined in the HDF5 API. - * The configuration constants like H5_HAVE_UNISTD_H etc. are - * defined in H5config.h which is included by H5public.h. + * Purpose: This file is included by all HDF5 library source files to + * define common things which are not defined in the HDF5 API. + * The configuration constants like H5_HAVE_UNISTD_H etc. are + * defined in H5config.h which is included by H5public.h. * */ #ifndef _H5private_H #define _H5private_H -#include "H5public.h" /* Include Public Definitions */ +#include "H5public.h" /* Include Public Definitions */ /* include the pthread header */ #ifdef H5_HAVE_THREADSAFE - #ifdef _WIN32 + #ifdef H5_HAVE_WIN32_API #ifndef H5_HAVE_WIN_THREADS -#ifdef H5_HAVE_PTHREAD_H -#include -#endif /* H5_HAVE_PTHREAD_H */ + #ifdef H5_HAVE_PTHREAD_H + #include + #endif /* H5_HAVE_PTHREAD_H */ #endif /* H5_HAVE_WIN_THREADS */ - #else /* _WIN32 */ + #else /* H5_HAVE_WIN32_API */ #ifdef H5_HAVE_PTHREAD_H #include #endif /* H5_HAVE_PTHREAD_H */ - #endif /* _WIN32 */ + #endif /* H5_HAVE_WIN32_API */ #endif /* H5_HAVE_THREADSAFE */ /* @@ -85,7 +85,7 @@ /* * The `struct stat' data type for stat() and fstat(). This is a Posix file - * but often apears on non-Posix systems also. The `struct stat' is required + * but often apears on non-Posix systems also. The `struct stat' is required * for hdf5 to compile, although only a few fields are actually used. */ #ifdef H5_HAVE_SYS_STAT_H @@ -127,7 +127,7 @@ #endif /* - * Unix ioctls. These are used by h5ls (and perhaps others) to determine a + * Unix ioctls. These are used by h5ls (and perhaps others) to determine a * resonable output width. */ #ifdef H5_HAVE_SYS_IOCTL_H @@ -150,8 +150,8 @@ #endif -#ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN /*Exclude rarely-used stuff from Windows headers */ +#ifdef H5_HAVE_WIN32_API +#define WIN32_LEAN_AND_MEAN /*Exclude rarely-used stuff from Windows headers */ #ifdef H5_HAVE_WINSOCK_H #include @@ -160,7 +160,7 @@ #include #include /* For _getcwd() */ -#endif /*_WIN32*/ +#endif /*H5_HAVE_WIN32_API*/ /* H5_inline */ #ifndef H5_inline @@ -169,7 +169,7 @@ #ifndef F_OK -# define F_OK 00 +# define F_OK 00 # define W_OK 02 # define R_OK 04 #endif @@ -207,14 +207,14 @@ * BEGIN_MPE_LOG_COLOR variant). -QAK */ #define BEGIN_MPE_LOG(func_name) \ - if (H5_MPEinit_g){ \ - if (eventa(func_name) == -1 && eventb(func_name) == -1) { \ - const char* p_color = "red"; \ + if (H5_MPEinit_g){ \ + if (eventa(func_name) == -1 && eventb(func_name) == -1) { \ + const char* p_color = "red"; \ eventa(func_name)=MPE_Log_get_event_number(); \ eventb(func_name)=MPE_Log_get_event_number(); \ MPE_Describe_state(eventa(func_name), eventb(func_name), (char *)p_end_funcname, (char *)p_color); \ } \ - MPE_Log_event(eventa(func_name), 0, (char *)p_event_start); \ + MPE_Log_event(eventa(func_name), 0, (char *)p_event_start); \ } @@ -250,23 +250,23 @@ * never be raised by the hdf5 library). */ #ifndef SIGBUS -# define SIGBUS SIGILL +# define SIGBUS SIGILL #endif /* * Does the compiler support the __attribute__(()) syntax? This is how gcc - * suppresses warnings about unused function arguments. It's no big deal if + * suppresses warnings about unused function arguments. It's no big deal if * we don't. */ #ifdef __cplusplus -# define __attribute__(X) /*void*/ -# define UNUSED /*void*/ +# define __attribute__(X) /*void*/ +# define UNUSED /*void*/ #else /* __cplusplus */ #ifdef H5_HAVE_ATTRIBUTE -# define UNUSED __attribute__((unused)) +# define UNUSED __attribute__((unused)) #else -# define __attribute__(X) /*void*/ -# define UNUSED /*void*/ +# define __attribute__(X) /*void*/ +# define UNUSED /*void*/ #endif #endif /* __cplusplus */ @@ -276,7 +276,7 @@ * string. */ #ifndef H5_HAVE_FUNCTION -# define __FUNCTION__ "NoFunctionName" +# define __FUNCTION__ "NoFunctionName" #endif /* @@ -288,48 +288,48 @@ * function, remember to compare against zero and not one of these two * values. */ -#define SUCCEED 0 -#define FAIL (-1) -#define UFAIL (unsigned)(-1) +#define SUCCEED 0 +#define FAIL (-1) +#define UFAIL (unsigned)(-1) /* number of members in an array */ #ifndef NELMTS -# define NELMTS(X) (sizeof(X)/sizeof(X[0])) +# define NELMTS(X) (sizeof(X)/sizeof(X[0])) #endif /* minimum of two, three, or four values */ #undef MIN -#define MIN(a,b) (((a)<(b)) ? (a) : (b)) -#define MIN2(a,b) MIN(a,b) -#define MIN3(a,b,c) MIN(a,MIN(b,c)) -#define MIN4(a,b,c,d) MIN(MIN(a,b),MIN(c,d)) +#define MIN(a,b) (((a)<(b)) ? (a) : (b)) +#define MIN2(a,b) MIN(a,b) +#define MIN3(a,b,c) MIN(a,MIN(b,c)) +#define MIN4(a,b,c,d) MIN(MIN(a,b),MIN(c,d)) /* maximum of two, three, or four values */ #undef MAX -#define MAX(a,b) (((a)>(b)) ? (a) : (b)) -#define MAX2(a,b) MAX(a,b) -#define MAX3(a,b,c) MAX(a,MAX(b,c)) -#define MAX4(a,b,c,d) MAX(MAX(a,b),MAX(c,d)) +#define MAX(a,b) (((a)>(b)) ? (a) : (b)) +#define MAX2(a,b) MAX(a,b) +#define MAX3(a,b,c) MAX(a,MAX(b,c)) +#define MAX4(a,b,c,d) MAX(MAX(a,b),MAX(c,d)) /* limit the middle value to be within a range (inclusive) */ -#define RANGE(LO,X,HI) MAX(LO,MIN(X,HI)) +#define RANGE(LO,X,HI) MAX(LO,MIN(X,HI)) /* absolute value */ #ifndef ABS -# define ABS(a) (((a)>=0) ? (a) : -(a)) +# define ABS(a) (((a)>=0) ? (a) : -(a)) #endif /* sign of argument */ #ifndef SIGN -# define SIGN(a) ((a)>0 ? 1 : (a)<0 ? -1 : 0) +# define SIGN(a) ((a)>0 ? 1 : (a)<0 ? -1 : 0) #endif /* test for number that is a power of 2 */ /* (from: http://graphics.stanford.edu/~seander/bithacks.html#DetermineIfPowerOf2) */ -# define POWER_OF_TWO(n) (!(n & (n - 1)) && n) +# define POWER_OF_TWO(n) (!(n & (n - 1)) && n) /* Raise an integer to a power of 2 */ -# define H5_EXP2(n) (1 << (n)) +# define H5_EXP2(n) (1 << (n)) /* * HDF Boolean type. @@ -342,7 +342,7 @@ #endif /* - * Numeric data types. Some of these might be defined in Posix.1g, otherwise + * Numeric data types. Some of these might be defined in Posix.1g, otherwise * we define them with the closest available type which is at least as large * as the number of bits indicated in the type name. The `int8' types *must* * be exactly one byte wide because we use it for pointer calculations to @@ -410,28 +410,28 @@ #endif /* - * Maximum and minimum values. These should be defined in for the + * Maximum and minimum values. These should be defined in for the * most part. */ #ifndef LLONG_MAX -# define LLONG_MAX ((long long)(((unsigned long long)1 \ - <<(8*sizeof(long long)-1))-1)) +# define LLONG_MAX ((long long)(((unsigned long long)1 \ + <<(8*sizeof(long long)-1))-1)) # define LLONG_MIN ((long long)(-LLONG_MAX)-1) #endif #ifndef ULLONG_MAX -# define ULLONG_MAX ((unsigned long long)((long long)(-1))) +# define ULLONG_MAX ((unsigned long long)((long long)(-1))) #endif #ifndef SIZET_MAX -# define SIZET_MAX ((size_t)(ssize_t)(-1)) -# define SSIZET_MAX ((ssize_t)(((size_t)1<<(8*sizeof(ssize_t)-1))-1)) +# define SIZET_MAX ((size_t)(ssize_t)(-1)) +# define SSIZET_MAX ((ssize_t)(((size_t)1<<(8*sizeof(ssize_t)-1))-1)) #endif /* * Maximum & minimum values for our typedefs. */ -#define HSIZET_MAX ((hsize_t)ULLONG_MAX) -#define HSSIZET_MAX ((hssize_t)LLONG_MAX) -#define HSSIZET_MIN (~(HSSIZET_MAX)) +#define HSIZET_MAX ((hsize_t)ULLONG_MAX) +#define HSSIZET_MAX ((hssize_t)LLONG_MAX) +#define HSSIZET_MIN (~(HSSIZET_MAX)) /* * A macro to portably increment enumerated types. @@ -451,15 +451,15 @@ * Data types and functions for timing certain parts of the library. */ typedef struct { - double utime; /*user time */ - double stime; /*system time */ - double etime; /*elapsed wall-clock time */ + double utime; /*user time */ + double stime; /*system time */ + double etime; /*elapsed wall-clock time */ } H5_timer_t; H5_DLL void H5_timer_reset (H5_timer_t *timer); H5_DLL void H5_timer_begin (H5_timer_t *timer); H5_DLL void H5_timer_end (H5_timer_t *sum/*in,out*/, - H5_timer_t *timer/*in,out*/); + H5_timer_t *timer/*in,out*/); H5_DLL void H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds); H5_DLL time_t H5_now(void); @@ -487,19 +487,19 @@ typedef struct { /* Put all platform-specific definitions in the following file */ /* so that the following definitions are platform free. */ -#include "H5win32defs.h" /* For Windows-specific definitions */ +#include "H5win32defs.h" /* For Windows-specific definitions */ #ifndef HDabort - #define HDabort() abort() + #define HDabort() abort() #endif /* HDabort */ #ifndef HDabs - #define HDabs(X) abs(X) + #define HDabs(X) abs(X) #endif /* HDabs */ #ifndef HDaccess - #define HDaccess(F,M) access(F, M) + #define HDaccess(F,M) access(F, M) #endif /* HDaccess */ #ifndef HDacos - #define HDacos(X) acos(X) + #define HDacos(X) acos(X) #endif /* HDacos */ #ifndef HDalarm #ifdef H5_HAVE_ALARM @@ -509,232 +509,232 @@ typedef struct { #endif /* H5_HAVE_ALARM */ #endif /* HDalarm */ #ifndef HDasctime - #define HDasctime(T) asctime(T) + #define HDasctime(T) asctime(T) #endif /* HDasctime */ #ifndef HDasin - #define HDasin(X) asin(X) + #define HDasin(X) asin(X) #endif /* HDasin */ #ifndef HDassert - #define HDassert(X) assert(X) + #define HDassert(X) assert(X) #endif /* HDassert */ #ifndef HDatan - #define HDatan(X) atan(X) + #define HDatan(X) atan(X) #endif /* HDatan */ #ifndef HDatan2 - #define HDatan2(X,Y) atan2(X,Y) + #define HDatan2(X,Y) atan2(X,Y) #endif /* HDatan2 */ #ifndef HDatexit - #define HDatexit(F) atexit(F) + #define HDatexit(F) atexit(F) #endif /* HDatexit */ #ifndef HDatof - #define HDatof(S) atof(S) + #define HDatof(S) atof(S) #endif /* HDatof */ #ifndef HDatoi - #define HDatoi(S) atoi(S) + #define HDatoi(S) atoi(S) #endif /* HDatoi */ #ifndef HDatol - #define HDatol(S) atol(S) + #define HDatol(S) atol(S) #endif /* HDatol */ #ifndef HDBSDgettimeofday - #define HDBSDgettimeofday(S,P) BSDgettimeofday(S,P) + #define HDBSDgettimeofday(S,P) BSDgettimeofday(S,P) #endif /* HDBSDgettimeofday */ #ifndef HDbsearch - #define HDbsearch(K,B,N,Z,F) bsearch(K,B,N,Z,F) + #define HDbsearch(K,B,N,Z,F) bsearch(K,B,N,Z,F) #endif /* HDbsearch */ #ifndef HDcalloc - #define HDcalloc(N,Z) calloc(N,Z) + #define HDcalloc(N,Z) calloc(N,Z) #endif /* HDcalloc */ #ifndef HDceil - #define HDceil(X) ceil(X) + #define HDceil(X) ceil(X) #endif /* HDceil */ #ifndef HDcfgetispeed - #define HDcfgetispeed(T) cfgetispeed(T) + #define HDcfgetispeed(T) cfgetispeed(T) #endif /* HDcfgetispeed */ #ifndef HDcfgetospeed - #define HDcfgetospeed(T) cfgetospeed(T) + #define HDcfgetospeed(T) cfgetospeed(T) #endif /* HDcfgetospeed */ #ifndef HDcfsetispeed - #define HDcfsetispeed(T,S) cfsetispeed(T,S) + #define HDcfsetispeed(T,S) cfsetispeed(T,S) #endif /* HDcfsetispeed */ #ifndef HDcfsetospeed - #define HDcfsetospeed(T,S) cfsetospeed(T,S) + #define HDcfsetospeed(T,S) cfsetospeed(T,S) #endif /* HDcfsetospeed */ #ifndef HDchdir - #define HDchdir(S) chdir(S) + #define HDchdir(S) chdir(S) #endif /* HDchdir */ #ifndef HDchmod - #define HDchmod(S,M) chmod(S,M) + #define HDchmod(S,M) chmod(S,M) #endif /* HDchmod */ #ifndef HDchown - #define HDchown(S,O,G) chown(S,O,G) + #define HDchown(S,O,G) chown(S,O,G) #endif /* HDchown */ #ifndef HDclearerr - #define HDclearerr(F) clearerr(F) + #define HDclearerr(F) clearerr(F) #endif /* HDclearerr */ #ifndef HDclock - #define HDclock() clock() + #define HDclock() clock() #endif /* HDclock */ #ifndef HDclose - #define HDclose(F) close(F) + #define HDclose(F) close(F) #endif /* HDclose */ #ifndef HDclosedir - #define HDclosedir(D) closedir(D) + #define HDclosedir(D) closedir(D) #endif /* HDclosedir */ #ifndef HDcos - #define HDcos(X) cos(X) + #define HDcos(X) cos(X) #endif /* HDcos */ #ifndef HDcosh - #define HDcosh(X) cosh(X) + #define HDcosh(X) cosh(X) #endif /* HDcosh */ #ifndef HDcreat - #define HDcreat(S,M) creat(S,M) + #define HDcreat(S,M) creat(S,M) #endif /* HDcreat */ #ifndef HDctermid - #define HDctermid(S) ctermid(S) + #define HDctermid(S) ctermid(S) #endif /* HDctermid */ #ifndef HDctime - #define HDctime(T) ctime(T) + #define HDctime(T) ctime(T) #endif /* HDctime */ #ifndef HDcuserid - #define HDcuserid(S) cuserid(S) + #define HDcuserid(S) cuserid(S) #endif /* HDcuserid */ #ifndef HDdifftime #ifdef H5_HAVE_DIFFTIME - #define HDdifftime(X,Y) difftime(X,Y) + #define HDdifftime(X,Y) difftime(X,Y) #else /* H5_HAVE_DIFFTIME */ - #define HDdifftime(X,Y) ((double)(X)-(double)(Y)) + #define HDdifftime(X,Y) ((double)(X)-(double)(Y)) #endif /* H5_HAVE_DIFFTIME */ #endif /* HDdifftime */ #ifndef HDdiv - #define HDdiv(X,Y) div(X,Y) + #define HDdiv(X,Y) div(X,Y) #endif /* HDdiv */ #ifndef HDdup - #define HDdup(F) dup(F) + #define HDdup(F) dup(F) #endif /* HDdup */ #ifndef HDdup2 - #define HDdup2(F,I) dup2(F,I) + #define HDdup2(F,I) dup2(F,I) #endif /* HDdup2 */ /* execl() variable arguments */ /* execle() variable arguments */ /* execlp() variable arguments */ #ifndef HDexecv - #define HDexecv(S,AV) execv(S,AV) + #define HDexecv(S,AV) execv(S,AV) #endif /* HDexecv */ #ifndef HDexecve - #define HDexecve(S,AV,E) execve(S,AV,E) + #define HDexecve(S,AV,E) execve(S,AV,E) #endif /* HDexecve */ #ifndef HDexecvp - #define HDexecvp(S,AV) execvp(S,AV) + #define HDexecvp(S,AV) execvp(S,AV) #endif /* HDexecvp */ #ifndef HDexit - #define HDexit(N) exit(N) + #define HDexit(N) exit(N) #endif /* HDexit */ #ifndef HD_exit - #define HD_exit(N) _exit(N) + #define HD_exit(N) _exit(N) #endif /* HD_exit */ #ifndef HDexp - #define HDexp(X) exp(X) + #define HDexp(X) exp(X) #endif /* HDexp */ #ifndef HDexp2 - #define HDexp2(X) exp2(X) + #define HDexp2(X) exp2(X) #endif /* HDexp2 */ #ifndef HDfabs - #define HDfabs(X) fabs(X) + #define HDfabs(X) fabs(X) #endif /* HDfabs */ /* use ABS() because fabsf() fabsl() are not common yet. */ #ifndef HDfabsf - #define HDfabsf(X) ABS(X) + #define HDfabsf(X) ABS(X) #endif /* HDfabsf */ #ifndef HDfabsl - #define HDfabsl(X) ABS(X) + #define HDfabsl(X) ABS(X) #endif /* HDfabsl */ #ifndef HDfclose - #define HDfclose(F) fclose(F) + #define HDfclose(F) fclose(F) #endif /* HDfclose */ /* fcntl() variable arguments */ #ifndef HDfdopen - #define HDfdopen(N,S) fdopen(N,S) + #define HDfdopen(N,S) fdopen(N,S) #endif /* HDfdopen */ #ifndef HDfeof - #define HDfeof(F) feof(F) + #define HDfeof(F) feof(F) #endif /* HDfeof */ #ifndef HDferror - #define HDferror(F) ferror(F) + #define HDferror(F) ferror(F) #endif /* HDferror */ #ifndef HDfflush - #define HDfflush(F) fflush(F) + #define HDfflush(F) fflush(F) #endif /* HDfflush */ #ifndef HDfgetc - #define HDfgetc(F) fgetc(F) + #define HDfgetc(F) fgetc(F) #endif /* HDfgetc */ #ifndef HDfgetpos - #define HDfgetpos(F,P) fgetpos(F,P) + #define HDfgetpos(F,P) fgetpos(F,P) #endif /* HDfgetpos */ #ifndef HDfgets - #define HDfgets(S,N,F) fgets(S,N,F) + #define HDfgets(S,N,F) fgets(S,N,F) #endif /* HDfgets */ #ifndef HDfileno - #define HDfileno(F) fileno(F) + #define HDfileno(F) fileno(F) #endif /* HDfileno */ #ifndef HDfloor - #define HDfloor(X) floor(X) + #define HDfloor(X) floor(X) #endif /* HDfloor */ #ifndef HDfmod - #define HDfmod(X,Y) fmod(X,Y) + #define HDfmod(X,Y) fmod(X,Y) #endif /* HDfmod */ #ifndef HDfopen - #define HDfopen(S,M) fopen(S,M) + #define HDfopen(S,M) fopen(S,M) #endif /* HDfopen */ #ifndef HDfork - #define HDfork() fork() + #define HDfork() fork() #endif /* HDfork */ #ifndef HDfpathconf - #define HDfpathconf(F,N) fpathconf(F,N) + #define HDfpathconf(F,N) fpathconf(F,N) #endif /* HDfpathconf */ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #ifndef HDfputc - #define HDfputc(C,F) fputc(C,F) + #define HDfputc(C,F) fputc(C,F) #endif /* HDfputc */ #ifndef HDfputs - #define HDfputs(S,F) fputs(S,F) + #define HDfputs(S,F) fputs(S,F) #endif /* HDfputs */ #ifndef HDfread - #define HDfread(M,Z,N,F) fread(M,Z,N,F) + #define HDfread(M,Z,N,F) fread(M,Z,N,F) #endif /* HDfread */ #ifndef HDfree - #define HDfree(M) free(M) + #define HDfree(M) free(M) #endif /* HDfree */ #ifndef HDfreopen - #define HDfreopen(S,M,F) freopen(S,M,F) + #define HDfreopen(S,M,F) freopen(S,M,F) #endif /* HDfreopen */ #ifndef HDfrexp - #define HDfrexp(X,N) frexp(X,N) + #define HDfrexp(X,N) frexp(X,N) #endif /* HDfrexp */ /* Check for Cray-specific 'frexpf()' and 'frexpl()' routines */ #ifndef HDfrexpf #ifdef H5_HAVE_FREXPF - #define HDfrexpf(X,N) frexpf(X,N) + #define HDfrexpf(X,N) frexpf(X,N) #else /* H5_HAVE_FREXPF */ - #define HDfrexpf(X,N) frexp(X,N) + #define HDfrexpf(X,N) frexp(X,N) #endif /* H5_HAVE_FREXPF */ #endif /* HDfrexpf */ #ifndef HDfrexpl #ifdef H5_HAVE_FREXPL - #define HDfrexpl(X,N) frexpl(X,N) + #define HDfrexpl(X,N) frexpl(X,N) #else /* H5_HAVE_FREXPL */ - #define HDfrexpl(X,N) frexp(X,N) + #define HDfrexpl(X,N) frexp(X,N) #endif /* H5_HAVE_FREXPL */ #endif /* HDfrexpl */ /* fscanf() variable arguments */ #ifndef HDfseek #ifdef H5_HAVE_FSEEKO - #define HDfseek(F,O,W) fseeko(F,O,W) + #define HDfseek(F,O,W) fseeko(F,O,W) #else /* H5_HAVE_FSEEKO */ - #define HDfseek(F,O,W) fseek(F,O,W) + #define HDfseek(F,O,W) fseek(F,O,W) #endif /* H5_HAVE_FSEEKO */ #endif /* HDfseek */ #ifndef HDfsetpos - #define HDfsetpos(F,P) fsetpos(F,P) + #define HDfsetpos(F,P) fsetpos(F,P) #endif /* HDfsetpos */ /* definitions related to the file stat utilities. * For Unix, if off_t is not 64bit big, try use the pseudo-standard @@ -746,10 +746,10 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #define HDfstat(F,B) fstat64(F,B) #endif /* HDfstat */ #ifndef HDlstat - #define HDlstat(S,B) lstat64(S,B) + #define HDlstat(S,B) lstat64(S,B) #endif /* HDlstat */ #ifndef HDstat - #define HDstat(S,B) stat64(S,B) + #define HDstat(S,B) stat64(S,B) #endif /* HDstat */ typedef struct stat64 h5_stat_t; typedef off64_t h5_stat_size_t; @@ -759,10 +759,10 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #define HDfstat(F,B) fstat(F,B) #endif /* HDfstat */ #ifndef HDlstat - #define HDlstat(S,B) lstat(S,B) + #define HDlstat(S,B) lstat(S,B) #endif /* HDlstat */ #ifndef HDstat - #define HDstat(S,B) stat(S,B) + #define HDstat(S,B) stat(S,B) #endif /* HDstat */ typedef struct stat h5_stat_t; typedef off_t h5_stat_size_t; @@ -771,7 +771,7 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #endif /* !defined(HDfstat) || !defined(HDstat) */ #ifndef HDftell - #define HDftell(F) ftell(F) + #define HDftell(F) ftell(F) #endif /* HDftell */ #ifndef HDftruncate #ifdef H5_HAVE_FTRUNCATE64 @@ -781,273 +781,273 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #endif #endif /* HDftruncate */ #ifndef HDfwrite - #define HDfwrite(M,Z,N,F) fwrite(M,Z,N,F) + #define HDfwrite(M,Z,N,F) fwrite(M,Z,N,F) #endif /* HDfwrite */ #ifndef HDgetc - #define HDgetc(F) getc(F) + #define HDgetc(F) getc(F) #endif /* HDgetc */ #ifndef HDgetchar - #define HDgetchar() getchar() + #define HDgetchar() getchar() #endif /* HDgetchar */ #ifndef HDgetcwd - #define HDgetcwd(S,Z) getcwd(S,Z) + #define HDgetcwd(S,Z) getcwd(S,Z) #endif /* HDgetcwd */ #ifndef HDgetdcwd - #define HDgetdcwd(D,S,Z) getcwd(S,Z) + #define HDgetdcwd(D,S,Z) getcwd(S,Z) #endif /* HDgetdcwd */ #ifndef HDgetdrive - #define HDgetdrive() 0 + #define HDgetdrive() 0 #endif /* HDgetdrive */ #ifndef HDgetegid - #define HDgetegid() getegid() + #define HDgetegid() getegid() #endif /* HDgetegid() */ #ifndef HDgetenv - #define HDgetenv(S) getenv(S) + #define HDgetenv(S) getenv(S) #endif /* HDgetenv */ #ifndef HDgeteuid - #define HDgeteuid() geteuid() + #define HDgeteuid() geteuid() #endif /* HDgeteuid */ #ifndef HDgetgid - #define HDgetgid() getgid() + #define HDgetgid() getgid() #endif /* HDgetgid */ #ifndef HDgetgrgid - #define HDgetgrgid(G) getgrgid(G) + #define HDgetgrgid(G) getgrgid(G) #endif /* HDgetgrgid */ #ifndef HDgetgrnam - #define HDgetgrnam(S) getgrnam(S) + #define HDgetgrnam(S) getgrnam(S) #endif /* HDgetgrnam */ #ifndef HDgetgroups - #define HDgetgroups(Z,G) getgroups(Z,G) + #define HDgetgroups(Z,G) getgroups(Z,G) #endif /* HDgetgroups */ #ifndef HDgetlogin - #define HDgetlogin() getlogin() + #define HDgetlogin() getlogin() #endif /* HDgetlogin */ #ifndef HDgetpgrp - #define HDgetpgrp() getpgrp() + #define HDgetpgrp() getpgrp() #endif /* HDgetpgrp */ #ifndef HDgetpid - #define HDgetpid() getpid() + #define HDgetpid() getpid() #endif /* HDgetpid */ #ifndef HDgetppid - #define HDgetppid() getppid() + #define HDgetppid() getppid() #endif /* HDgetppid */ #ifndef HDgetpwnam - #define HDgetpwnam(S) getpwnam(S) + #define HDgetpwnam(S) getpwnam(S) #endif /* HDgetpwnam */ #ifndef HDgetpwuid - #define HDgetpwuid(U) getpwuid(U) + #define HDgetpwuid(U) getpwuid(U) #endif /* HDgetpwuid */ #ifndef HDgetrusage - #define HDgetrusage(X,S) getrusage(X,S) + #define HDgetrusage(X,S) getrusage(X,S) #endif /* HDgetrusage */ #ifndef HDgets - #define HDgets(S) gets(S) + #define HDgets(S) gets(S) #endif /* HDgets */ #ifndef HDgettimeofday - #define HDgettimeofday(S,P) gettimeofday(S,P) + #define HDgettimeofday(S,P) gettimeofday(S,P) #endif /* HDgettimeofday */ #ifndef HDgetuid - #define HDgetuid() getuid() + #define HDgetuid() getuid() #endif /* HDgetuid */ #ifndef HDgmtime - #define HDgmtime(T) gmtime(T) + #define HDgmtime(T) gmtime(T) #endif /* HDgmtime */ #ifndef HDisalnum - #define HDisalnum(C) isalnum((int)(C)) /*cast for solaris warning*/ + #define HDisalnum(C) isalnum((int)(C)) /*cast for solaris warning*/ #endif /* HDisalnum */ #ifndef HDisalpha - #define HDisalpha(C) isalpha((int)(C)) /*cast for solaris warning*/ + #define HDisalpha(C) isalpha((int)(C)) /*cast for solaris warning*/ #endif /* HDisalpha */ #ifndef HDisatty - #define HDisatty(F) isatty(F) + #define HDisatty(F) isatty(F) #endif /* HDisatty */ #ifndef HDiscntrl - #define HDiscntrl(C) iscntrl((int)(C)) /*cast for solaris warning*/ + #define HDiscntrl(C) iscntrl((int)(C)) /*cast for solaris warning*/ #endif /* HDiscntrl */ #ifndef HDisdigit - #define HDisdigit(C) isdigit((int)(C)) /*cast for solaris warning*/ + #define HDisdigit(C) isdigit((int)(C)) /*cast for solaris warning*/ #endif /* HDisdigit */ #ifndef HDisgraph - #define HDisgraph(C) isgraph((int)(C)) /*cast for solaris warning*/ + #define HDisgraph(C) isgraph((int)(C)) /*cast for solaris warning*/ #endif /* HDisgraph */ #ifndef HDislower - #define HDislower(C) islower((int)(C)) /*cast for solaris warning*/ + #define HDislower(C) islower((int)(C)) /*cast for solaris warning*/ #endif /* HDislower */ #ifndef HDisprint - #define HDisprint(C) isprint((int)(C)) /*cast for solaris warning*/ + #define HDisprint(C) isprint((int)(C)) /*cast for solaris warning*/ #endif /* HDisprint */ #ifndef HDispunct - #define HDispunct(C) ispunct((int)(C)) /*cast for solaris warning*/ + #define HDispunct(C) ispunct((int)(C)) /*cast for solaris warning*/ #endif /* HDispunct */ #ifndef HDisspace - #define HDisspace(C) isspace((int)(C)) /*cast for solaris warning*/ + #define HDisspace(C) isspace((int)(C)) /*cast for solaris warning*/ #endif /* HDisspace */ #ifndef HDisupper - #define HDisupper(C) isupper((int)(C)) /*cast for solaris warning*/ + #define HDisupper(C) isupper((int)(C)) /*cast for solaris warning*/ #endif /* HDisupper */ #ifndef HDisxdigit - #define HDisxdigit(C) isxdigit((int)(C)) /*cast for solaris warning*/ + #define HDisxdigit(C) isxdigit((int)(C)) /*cast for solaris warning*/ #endif /* HDisxdigit */ #ifndef HDkill - #define HDkill(P,S) kill(P,S) + #define HDkill(P,S) kill(P,S) #endif /* HDkill */ #ifndef HDlabs - #define HDlabs(X) labs(X) + #define HDlabs(X) labs(X) #endif /* HDlabs */ #ifndef HDldexp - #define HDldexp(X,N) ldexp(X,N) + #define HDldexp(X,N) ldexp(X,N) #endif /* HDldexp */ #ifndef HDldiv - #define HDldiv(X,Y) ldiv(X,Y) + #define HDldiv(X,Y) ldiv(X,Y) #endif /* HDldiv */ #ifndef HDlink - #define HDlink(OLD,NEW) link(OLD,NEW) + #define HDlink(OLD,NEW) link(OLD,NEW) #endif /* HDlink */ #ifndef HDlocaleconv - #define HDlocaleconv() localeconv() + #define HDlocaleconv() localeconv() #endif /* HDlocaleconv */ #ifndef HDlocaltime - #define HDlocaltime(T) localtime(T) + #define HDlocaltime(T) localtime(T) #endif /* HDlocaltime */ #ifndef HDlog - #define HDlog(X) log(X) + #define HDlog(X) log(X) #endif /* HDlog */ #ifndef HDlog10 - #define HDlog10(X) log10(X) + #define HDlog10(X) log10(X) #endif /* HDlog10 */ #ifndef HDlongjmp - #define HDlongjmp(J,N) longjmp(J,N) + #define HDlongjmp(J,N) longjmp(J,N) #endif /* HDlongjmp */ /* HDlseek and HDoff_t must be defined together for consistency. */ #ifndef HDlseek #ifdef H5_HAVE_LSEEK64 - #define HDlseek(F,O,W) lseek64(F,O,W) - #define HDoff_t off64_t + #define HDlseek(F,O,W) lseek64(F,O,W) + #define HDoff_t off64_t #else - #define HDlseek(F,O,W) lseek(F,O,W) - #define HDoff_t off_t + #define HDlseek(F,O,W) lseek(F,O,W) + #define HDoff_t off_t #endif #endif /* HDlseek */ #ifndef HDmalloc - #define HDmalloc(Z) malloc(Z) + #define HDmalloc(Z) malloc(Z) #endif /* HDmalloc */ #ifndef HDposix_memalign #define HDposix_memalign(P,A,Z) posix_memalign(P,A,Z) #endif /* HDposix_memalign */ #ifndef HDmblen - #define HDmblen(S,N) mblen(S,N) + #define HDmblen(S,N) mblen(S,N) #endif /* HDmblen */ #ifndef HDmbstowcs - #define HDmbstowcs(P,S,Z) mbstowcs(P,S,Z) + #define HDmbstowcs(P,S,Z) mbstowcs(P,S,Z) #endif /* HDmbstowcs */ #ifndef HDmbtowc - #define HDmbtowc(P,S,Z) mbtowc(P,S,Z) + #define HDmbtowc(P,S,Z) mbtowc(P,S,Z) #endif /* HDmbtowc */ #ifndef HDmemchr - #define HDmemchr(S,C,Z) memchr(S,C,Z) + #define HDmemchr(S,C,Z) memchr(S,C,Z) #endif /* HDmemchr */ #ifndef HDmemcmp - #define HDmemcmp(X,Y,Z) memcmp(X,Y,Z) + #define HDmemcmp(X,Y,Z) memcmp(X,Y,Z) #endif /* HDmemcmp */ /* * The (char*) casts are required for the DEC when optimizations are turned * on and the source and/or destination are not aligned. */ #ifndef HDmemcpy - #define HDmemcpy(X,Y,Z) memcpy((char*)(X),(const char*)(Y),Z) + #define HDmemcpy(X,Y,Z) memcpy((char*)(X),(const char*)(Y),Z) #endif /* HDmemcpy */ #ifndef HDmemmove - #define HDmemmove(X,Y,Z) memmove((char*)(X),(const char*)(Y),Z) + #define HDmemmove(X,Y,Z) memmove((char*)(X),(const char*)(Y),Z) #endif /* HDmemmove */ #ifndef HDmemset - #define HDmemset(X,C,Z) memset(X,C,Z) + #define HDmemset(X,C,Z) memset(X,C,Z) #endif /* HDmemset */ #ifndef HDmkdir - #define HDmkdir(S,M) mkdir(S,M) + #define HDmkdir(S,M) mkdir(S,M) #endif /* HDmkdir */ #ifndef HDmkfifo - #define HDmkfifo(S,M) mkfifo(S,M) + #define HDmkfifo(S,M) mkfifo(S,M) #endif /* HDmkfifo */ #ifndef HDmktime - #define HDmktime(T) mktime(T) + #define HDmktime(T) mktime(T) #endif /* HDmktime */ #ifndef HDmodf - #define HDmodf(X,Y) modf(X,Y) + #define HDmodf(X,Y) modf(X,Y) #endif /* HDmodf */ #ifndef HDopen #ifdef _O_BINARY - #define HDopen(S,F,M) open(S,F|_O_BINARY,M) + #define HDopen(S,F,M) open(S,F|_O_BINARY,M) #else - #define HDopen(S,F,M) open(S,F,M) + #define HDopen(S,F,M) open(S,F,M) #endif #endif /* HDopen */ #ifndef HDopendir - #define HDopendir(S) opendir(S) + #define HDopendir(S) opendir(S) #endif /* HDopendir */ #ifndef HDpathconf - #define HDpathconf(S,N) pathconf(S,N) + #define HDpathconf(S,N) pathconf(S,N) #endif /* HDpathconf */ #ifndef HDpause - #define HDpause() pause() + #define HDpause() pause() #endif /* HDpause */ #ifndef HDperror - #define HDperror(S) perror(S) + #define HDperror(S) perror(S) #endif /* HDperror */ #ifndef HDpipe - #define HDpipe(F) pipe(F) + #define HDpipe(F) pipe(F) #endif /* HDpipe */ #ifndef HDpow - #define HDpow(X,Y) pow(X,Y) + #define HDpow(X,Y) pow(X,Y) #endif /* HDpow */ /* printf() variable arguments */ #ifndef HDputc - #define HDputc(C,F) putc(C,F) + #define HDputc(C,F) putc(C,F) #endif /* HDputc*/ #ifndef HDputchar - #define HDputchar(C) putchar(C) + #define HDputchar(C) putchar(C) #endif /* HDputchar */ #ifndef HDputs - #define HDputs(S) puts(S) + #define HDputs(S) puts(S) #endif /* HDputs */ #ifndef HDqsort - #define HDqsort(M,N,Z,F) qsort(M,N,Z,F) + #define HDqsort(M,N,Z,F) qsort(M,N,Z,F) #endif /* HDqsort*/ #ifndef HDraise - #define HDraise(N) raise(N) + #define HDraise(N) raise(N) #endif /* HDraise */ #ifdef H5_HAVE_RAND_R #ifndef HDrandom - #define HDrandom() HDrand() + #define HDrandom() HDrand() #endif /* HDrandom */ H5_DLL int HDrand(void); #elif H5_HAVE_RANDOM #ifndef HDrand - #define HDrand() random() + #define HDrand() random() #endif /* HDrand */ #ifndef HDrandom - #define HDrandom() random() + #define HDrandom() random() #endif /* HDrandom */ #else /* H5_HAVE_RANDOM */ #ifndef HDrand - #define HDrand() rand() + #define HDrand() rand() #endif /* HDrand */ #ifndef HDrandom - #define HDrandom() rand() + #define HDrandom() rand() #endif /* HDrandom */ #endif /* H5_HAVE_RANDOM */ #ifndef HDread - #define HDread(F,M,Z) read(F,M,Z) + #define HDread(F,M,Z) read(F,M,Z) #endif /* HDread */ #ifndef HDreaddir - #define HDreaddir(D) readdir(D) + #define HDreaddir(D) readdir(D) #endif /* HDreaddir */ #ifndef HDrealloc - #define HDrealloc(M,Z) realloc(M,Z) + #define HDrealloc(M,Z) realloc(M,Z) #endif /* HDrealloc */ #ifndef HDrealpath - #define HDrealpath(F1,F2) realpath(F1,F2) + #define HDrealpath(F1,F2) realpath(F1,F2) #endif /* HDrealloc */ #ifdef H5_VMS #ifdef __cplusplus @@ -1058,126 +1058,126 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); } #endif /* __cplusplus */ #ifndef HDremove - #define HDremove(S) HDremove_all(S) + #define HDremove(S) HDremove_all(S) #endif /* HDremove */ #else /* H5_VMS */ #ifndef HDremove - #define HDremove(S) remove(S) + #define HDremove(S) remove(S) #endif /* HDremove */ #endif /*H5_VMS*/ #ifndef HDrename - #define HDrename(OLD,NEW) rename(OLD,NEW) + #define HDrename(OLD,NEW) rename(OLD,NEW) #endif /* HDrename */ #ifndef HDrewind - #define HDrewind(F) rewind(F) + #define HDrewind(F) rewind(F) #endif /* HDrewind */ #ifndef HDrewinddir - #define HDrewinddir(D) rewinddir(D) + #define HDrewinddir(D) rewinddir(D) #endif /* HDrewinddir */ #ifndef HDrmdir - #define HDrmdir(S) rmdir(S) + #define HDrmdir(S) rmdir(S) #endif /* HDrmdir */ /* scanf() variable arguments */ #ifndef HDsetbuf - #define HDsetbuf(F,S) setbuf(F,S) + #define HDsetbuf(F,S) setbuf(F,S) #endif /* HDsetbuf */ #ifndef HDsetgid - #define HDsetgid(G) setgid(G) + #define HDsetgid(G) setgid(G) #endif /* HDsetgid */ #ifndef HDsetjmp - #define HDsetjmp(J) setjmp(J) + #define HDsetjmp(J) setjmp(J) #endif /* HDsetjmp */ #ifndef HDsetlocale - #define HDsetlocale(N,S) setlocale(N,S) + #define HDsetlocale(N,S) setlocale(N,S) #endif /* HDsetlocale */ #ifndef HDsetpgid - #define HDsetpgid(P,PG) setpgid(P,PG) + #define HDsetpgid(P,PG) setpgid(P,PG) #endif /* HDsetpgid */ #ifndef HDsetsid - #define HDsetsid() setsid() + #define HDsetsid() setsid() #endif /* HDsetsid */ #ifndef HDsetuid - #define HDsetuid(U) setuid(U) + #define HDsetuid(U) setuid(U) #endif /* HDsetuid */ #ifndef HDsetvbuf - #define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,Z) + #define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,Z) #endif /* HDsetvbuf */ #ifndef HDsigaddset - #define HDsigaddset(S,N) sigaddset(S,N) + #define HDsigaddset(S,N) sigaddset(S,N) #endif /* HDsigaddset */ #ifndef HDsigdelset - #define HDsigdelset(S,N) sigdelset(S,N) + #define HDsigdelset(S,N) sigdelset(S,N) #endif /* HDsigdelset */ #ifndef HDsigemptyset - #define HDsigemptyset(S) sigemptyset(S) + #define HDsigemptyset(S) sigemptyset(S) #endif /* HDsigemptyset */ #ifndef HDsigfillset - #define HDsigfillset(S) sigfillset(S) + #define HDsigfillset(S) sigfillset(S) #endif /* HDsigfillset */ #ifndef HDsigismember - #define HDsigismember(S,N) sigismember(S,N) + #define HDsigismember(S,N) sigismember(S,N) #endif /* HDsigismember */ #ifndef HDsiglongjmp - #define HDsiglongjmp(J,N) siglongjmp(J,N) + #define HDsiglongjmp(J,N) siglongjmp(J,N) #endif /* HDsiglongjmp */ #ifndef HDsignal - #define HDsignal(N,F) signal(N,F) + #define HDsignal(N,F) signal(N,F) #endif /* HDsignal */ #ifndef HDsigpending - #define HDsigpending(S) sigpending(S) + #define HDsigpending(S) sigpending(S) #endif /* HDsigpending */ #ifndef HDsigprocmask - #define HDsigprocmask(H,S,O) sigprocmask(H,S,O) + #define HDsigprocmask(H,S,O) sigprocmask(H,S,O) #endif /* HDsigprocmask */ #ifndef HDsigsetjmp - #define HDsigsetjmp(J,N) sigsetjmp(J,N) + #define HDsigsetjmp(J,N) sigsetjmp(J,N) #endif /* HDsigsetjmp */ #ifndef HDsigsuspend - #define HDsigsuspend(S) sigsuspend(S) + #define HDsigsuspend(S) sigsuspend(S) #endif /* HDsigsuspend */ #ifndef HDsin - #define HDsin(X) sin(X) + #define HDsin(X) sin(X) #endif /* HDsin */ #ifndef HDsinh - #define HDsinh(X) sinh(X) + #define HDsinh(X) sinh(X) #endif /* HDsinh */ #ifndef HDsleep - #define HDsleep(N) sleep(N) + #define HDsleep(N) sleep(N) #endif /* HDsleep */ #ifndef HDsnprintf - #define HDsnprintf snprintf /*varargs*/ + #define HDsnprintf snprintf /*varargs*/ #endif /* HDsnprintf */ /* sprintf() variable arguments */ #ifndef HDsqrt - #define HDsqrt(X) sqrt(X) + #define HDsqrt(X) sqrt(X) #endif /* HDsqrt */ #ifdef H5_HAVE_RAND_R H5_DLL void HDsrand(unsigned int seed); #ifndef HDsrandom - #define HDsrandom(S) HDsrand(S) + #define HDsrandom(S) HDsrand(S) #endif /* HDsrandom */ #elif H5_HAVE_RANDOM #ifndef HDsrand - #define HDsrand(S) srandom(S) + #define HDsrand(S) srandom(S) #endif /* HDsrand */ #ifndef HDsrandom - #define HDsrandom(S) srandom(S) + #define HDsrandom(S) srandom(S) #endif /* HDsrandom */ #else /* H5_HAVE_RAND_R */ #ifndef HDsrand - #define HDsrand(S) srand(S) + #define HDsrand(S) srand(S) #endif /* HDsrand */ #ifndef HDsrandom - #define HDsrandom(S) srand(S) + #define HDsrandom(S) srand(S) #endif /* HDsrandom */ #endif /* H5_HAVE_RAND_R */ /* sscanf() variable arguments */ #ifndef HDstrcat - #define HDstrcat(X,Y) strcat(X,Y) + #define HDstrcat(X,Y) strcat(X,Y) #endif /* HDstrcat */ #ifndef HDstrchr - #define HDstrchr(S,C) strchr(S,C) + #define HDstrchr(S,C) strchr(S,C) #endif /* HDstrchr */ #ifndef HDstrcmp #define HDstrcmp(X,Y) strcmp(X,Y) @@ -1186,181 +1186,181 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #define HDstrcasecmp(X,Y) strcasecmp(X,Y) #endif /* HDstrcasecmp */ #ifndef HDstrcoll - #define HDstrcoll(X,Y) strcoll(X,Y) + #define HDstrcoll(X,Y) strcoll(X,Y) #endif /* HDstrcoll */ #ifndef HDstrcpy - #define HDstrcpy(X,Y) strcpy(X,Y) + #define HDstrcpy(X,Y) strcpy(X,Y) #endif /* HDstrcpy */ #ifndef HDstrcspn - #define HDstrcspn(X,Y) strcspn(X,Y) + #define HDstrcspn(X,Y) strcspn(X,Y) #endif /* HDstrcspn */ #ifndef HDstrerror - #define HDstrerror(N) strerror(N) + #define HDstrerror(N) strerror(N) #endif /* HDstrerror */ #ifndef HDstrftime - #define HDstrftime(S,Z,F,T) strftime(S,Z,F,T) + #define HDstrftime(S,Z,F,T) strftime(S,Z,F,T) #endif /* HDstrftime */ #ifndef HDstrlen - #define HDstrlen(S) strlen(S) + #define HDstrlen(S) strlen(S) #endif /* HDstrlen */ #ifndef HDstrncat - #define HDstrncat(X,Y,Z) strncat(X,Y,Z) + #define HDstrncat(X,Y,Z) strncat(X,Y,Z) #endif /* HDstrncat */ #ifndef HDstrncmp - #define HDstrncmp(X,Y,Z) strncmp(X,Y,Z) + #define HDstrncmp(X,Y,Z) strncmp(X,Y,Z) #endif /* HDstrncmp */ #ifndef HDstrncpy - #define HDstrncpy(X,Y,Z) strncpy(X,Y,Z) + #define HDstrncpy(X,Y,Z) strncpy(X,Y,Z) #endif /* HDstrncpy */ #ifndef HDstrpbrk - #define HDstrpbrk(X,Y) strpbrk(X,Y) + #define HDstrpbrk(X,Y) strpbrk(X,Y) #endif /* HDstrpbrk */ #ifndef HDstrrchr - #define HDstrrchr(S,C) strrchr(S,C) + #define HDstrrchr(S,C) strrchr(S,C) #endif /* HDstrrchr */ #ifndef HDstrspn - #define HDstrspn(X,Y) strspn(X,Y) + #define HDstrspn(X,Y) strspn(X,Y) #endif /* HDstrspn */ #ifndef HDstrstr - #define HDstrstr(X,Y) strstr(X,Y) + #define HDstrstr(X,Y) strstr(X,Y) #endif /* HDstrstr */ #ifndef HDstrtod - #define HDstrtod(S,R) strtod(S,R) + #define HDstrtod(S,R) strtod(S,R) #endif /* HDstrtod */ #ifndef HDstrtok - #define HDstrtok(X,Y) strtok(X,Y) + #define HDstrtok(X,Y) strtok(X,Y) #endif /* HDstrtok */ #ifndef HDstrtol - #define HDstrtol(S,R,N) strtol(S,R,N) + #define HDstrtol(S,R,N) strtol(S,R,N) #endif /* HDstrtol */ H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base); #ifndef HDstrtoul - #define HDstrtoul(S,R,N) strtoul(S,R,N) + #define HDstrtoul(S,R,N) strtoul(S,R,N) #endif /* HDstrtoul */ #ifndef HDstrtoull - #define HDstrtoull(S,R,N) strtoull(S,R,N) + #define HDstrtoull(S,R,N) strtoull(S,R,N) #endif /* HDstrtoul */ #ifndef HDstrxfrm - #define HDstrxfrm(X,Y,Z) strxfrm(X,Y,Z) + #define HDstrxfrm(X,Y,Z) strxfrm(X,Y,Z) #endif /* HDstrxfrm */ #ifdef H5_HAVE_SYMLINK #ifndef HDsymlink - #define HDsymlink(F1,F2) symlink(F1,F2) + #define HDsymlink(F1,F2) symlink(F1,F2) #endif /* HDsymlink */ #endif /* H5_HAVE_SYMLINK */ #ifndef HDsysconf - #define HDsysconf(N) sysconf(N) + #define HDsysconf(N) sysconf(N) #endif /* HDsysconf */ #ifndef HDsystem - #define HDsystem(S) system(S) + #define HDsystem(S) system(S) #endif /* HDsystem */ #ifndef HDtan - #define HDtan(X) tan(X) + #define HDtan(X) tan(X) #endif /* HDtan */ #ifndef HDtanh - #define HDtanh(X) tanh(X) + #define HDtanh(X) tanh(X) #endif /* HDtanh */ #ifndef HDtcdrain - #define HDtcdrain(F) tcdrain(F) + #define HDtcdrain(F) tcdrain(F) #endif /* HDtcdrain */ #ifndef HDtcflow - #define HDtcflow(F,A) tcflow(F,A) + #define HDtcflow(F,A) tcflow(F,A) #endif /* HDtcflow */ #ifndef HDtcflush - #define HDtcflush(F,N) tcflush(F,N) + #define HDtcflush(F,N) tcflush(F,N) #endif /* HDtcflush */ #ifndef HDtcgetattr - #define HDtcgetattr(F,T) tcgetattr(F,T) + #define HDtcgetattr(F,T) tcgetattr(F,T) #endif /* HDtcgetattr */ #ifndef HDtcgetpgrp - #define HDtcgetpgrp(F) tcgetpgrp(F) + #define HDtcgetpgrp(F) tcgetpgrp(F) #endif /* HDtcgetpgrp */ #ifndef HDtcsendbreak - #define HDtcsendbreak(F,N) tcsendbreak(F,N) + #define HDtcsendbreak(F,N) tcsendbreak(F,N) #endif /* HDtcsendbreak */ #ifndef HDtcsetattr - #define HDtcsetattr(F,O,T) tcsetattr(F,O,T) + #define HDtcsetattr(F,O,T) tcsetattr(F,O,T) #endif /* HDtcsetattr */ #ifndef HDtcsetpgrp - #define HDtcsetpgrp(F,N) tcsetpgrp(F,N) + #define HDtcsetpgrp(F,N) tcsetpgrp(F,N) #endif /* HDtcsetpgrp */ #ifndef HDtime - #define HDtime(T) time(T) + #define HDtime(T) time(T) #endif /* HDtime */ #ifndef HDtimes - #define HDtimes(T) times(T) + #define HDtimes(T) times(T) #endif /* HDtimes*/ #ifndef HDtmpfile - #define HDtmpfile() tmpfile() + #define HDtmpfile() tmpfile() #endif /* HDtmpfile */ #ifndef HDtmpnam - #define HDtmpnam(S) tmpnam(S) + #define HDtmpnam(S) tmpnam(S) #endif /* HDtmpnam */ #ifndef HDtolower - #define HDtolower(C) tolower(C) + #define HDtolower(C) tolower(C) #endif /* HDtolower */ #ifndef HDtoupper - #define HDtoupper(C) toupper(C) + #define HDtoupper(C) toupper(C) #endif /* HDtoupper */ #ifndef HDttyname - #define HDttyname(F) ttyname(F) + #define HDttyname(F) ttyname(F) #endif /* HDttyname */ #ifndef HDtzset - #define HDtzset() tzset() + #define HDtzset() tzset() #endif /* HDtzset */ #ifndef HDumask - #define HDumask(N) umask(N) + #define HDumask(N) umask(N) #endif /* HDumask */ #ifndef HDuname - #define HDuname(S) uname(S) + #define HDuname(S) uname(S) #endif /* HDuname */ #ifndef HDungetc - #define HDungetc(C,F) ungetc(C,F) + #define HDungetc(C,F) ungetc(C,F) #endif /* HDungetc */ #ifndef HDunlink - #define HDunlink(S) unlink(S) + #define HDunlink(S) unlink(S) #endif /* HDunlink */ #ifndef HDutime - #define HDutime(S,T) utime(S,T) + #define HDutime(S,T) utime(S,T) #endif /* HDutime */ #ifndef HDva_arg - #define HDva_arg(A,T) va_arg(A,T) + #define HDva_arg(A,T) va_arg(A,T) #endif /* HDva_arg */ #ifndef HDva_end - #define HDva_end(A) va_end(A) + #define HDva_end(A) va_end(A) #endif /* HDva_end */ #ifndef HDva_start - #define HDva_start(A,P) va_start(A,P) + #define HDva_start(A,P) va_start(A,P) #endif /* HDva_start */ #ifndef HDvasprintf #define HDvasprintf(RET,FMT,A) vasprintf(RET,FMT,A) #endif /* HDvasprintf */ #ifndef HDvfprintf - #define HDvfprintf(F,FMT,A) vfprintf(F,FMT,A) + #define HDvfprintf(F,FMT,A) vfprintf(F,FMT,A) #endif /* HDvfprintf */ #ifndef HDvprintf - #define HDvprintf(FMT,A) vprintf(FMT,A) + #define HDvprintf(FMT,A) vprintf(FMT,A) #endif /* HDvprintf */ #ifndef HDvsprintf - #define HDvsprintf(S,FMT,A) vsprintf(S,FMT,A) + #define HDvsprintf(S,FMT,A) vsprintf(S,FMT,A) #endif /* HDvsprintf */ #ifndef HDvsnprintf #define HDvsnprintf(S,N,FMT,A) vsnprintf(S,N,FMT,A) #endif /* HDvsnprintf */ #ifndef HDwait - #define HDwait(W) wait(W) + #define HDwait(W) wait(W) #endif /* HDwait */ #ifndef HDwaitpid - #define HDwaitpid(P,W,O) waitpid(P,W,O) + #define HDwaitpid(P,W,O) waitpid(P,W,O) #endif /* HDwaitpid */ #ifndef HDwcstombs - #define HDwcstombs(S,P,Z) wcstombs(S,P,Z) + #define HDwcstombs(S,P,Z) wcstombs(S,P,Z) #endif /* HDwcstombs */ #ifndef HDwctomb - #define HDwctomb(S,C) wctomb(S,C) + #define HDwctomb(S,C) wctomb(S,C) #endif /* HDwctomb */ #ifndef HDwrite - #define HDwrite(F,M,Z) write(F,M,Z) + #define HDwrite(F,M,Z) write(F,M,Z) #endif /* HDwrite */ /* @@ -1459,9 +1459,9 @@ extern char *strdup(const char *s); #if defined(H5_HAVE_WINDOW_PATH) /* directory delimiter for Windows: slash and backslash are acceptable on Windows */ -#define DIR_SLASH_SEPC '/' -#define DIR_SEPC '\\' -#define DIR_SEPS "\\" +#define DIR_SLASH_SEPC '/' +#define DIR_SEPC '\\' +#define DIR_SEPS "\\" #define CHECK_DELIMITER(SS) ((SS == DIR_SEPC)||(SS == DIR_SLASH_SEPC)) #define CHECK_ABSOLUTE(NAME) ((isalpha(NAME[0])) && (NAME[1] == ':') && (CHECK_DELIMITER(NAME[2]))) #define CHECK_ABS_DRIVE(NAME) ((isalpha(NAME[0])) && (NAME[1] == ':')) @@ -1491,49 +1491,49 @@ extern char *strdup(const char *s); #else -#define DIR_SEPC '/' -#define DIR_SEPS "/" +#define DIR_SEPC '/' +#define DIR_SEPS "/" #define CHECK_DELIMITER(SS) (SS == DIR_SEPC) #define CHECK_ABSOLUTE(NAME) (CHECK_DELIMITER(*NAME)) -#define CHECK_ABS_DRIVE(NAME) (0) -#define CHECK_ABS_PATH(NAME) (0) +#define CHECK_ABS_DRIVE(NAME) (0) +#define CHECK_ABS_PATH(NAME) (0) #define GET_LAST_DELIMITER(NAME, ptr) ptr = strrchr(NAME, DIR_SEPC); #endif -#define COLON_SEPC ':' +#define COLON_SEPC ':' /* * These macros check whether debugging has been requested for a certain - * package at run-time. Code for debugging is conditionally compiled by - * defining constants like `H5X_DEBUG'. In order to see the output though + * package at run-time. Code for debugging is conditionally compiled by + * defining constants like `H5X_DEBUG'. In order to see the output though * the code must be enabled at run-time with an environment variable * HDF5_DEBUG which is a list of packages to debug. * * Note: If you add/remove items from this enum then be sure to update the - * information about the package in H5_init_library(). + * information about the package in H5_init_library(). */ typedef enum { - H5_PKG_A, /*Attributes */ - H5_PKG_AC, /*Meta data cache */ - H5_PKG_B, /*B-trees */ - H5_PKG_D, /*Datasets */ - H5_PKG_E, /*Error handling */ - H5_PKG_F, /*Files */ - H5_PKG_G, /*Groups */ - H5_PKG_HG, /*Global heap */ - H5_PKG_HL, /*Local heap */ - H5_PKG_I, /*Interface */ - H5_PKG_MF, /*File memory management */ - H5_PKG_MM, /*Core memory management */ - H5_PKG_O, /*Object headers */ - H5_PKG_P, /*Property lists */ - H5_PKG_S, /*Data spaces */ - H5_PKG_T, /*Data types */ - H5_PKG_V, /*Vector functions */ - H5_PKG_Z, /*Raw data filters */ - H5_NPKGS /*Must be last */ + H5_PKG_A, /*Attributes */ + H5_PKG_AC, /*Meta data cache */ + H5_PKG_B, /*B-trees */ + H5_PKG_D, /*Datasets */ + H5_PKG_E, /*Error handling */ + H5_PKG_F, /*Files */ + H5_PKG_G, /*Groups */ + H5_PKG_HG, /*Global heap */ + H5_PKG_HL, /*Local heap */ + H5_PKG_I, /*Interface */ + H5_PKG_MF, /*File memory management */ + H5_PKG_MM, /*Core memory management */ + H5_PKG_O, /*Object headers */ + H5_PKG_P, /*Property lists */ + H5_PKG_S, /*Data spaces */ + H5_PKG_T, /*Data types */ + H5_PKG_V, /*Vector functions */ + H5_PKG_Z, /*Raw data filters */ + H5_NPKGS /*Must be last */ } H5_pkg_t; typedef struct H5_debug_open_stream_t { @@ -1542,58 +1542,58 @@ typedef struct H5_debug_open_stream_t { } H5_debug_open_stream_t; typedef struct H5_debug_t { - FILE *trace; /*API trace output stream */ + FILE *trace; /*API trace output stream */ hbool_t ttop; /*Show only top-level calls? */ hbool_t ttimes; /*Show trace event times? */ struct { - const char *name; /*package name */ - FILE *stream; /*output stream or NULL */ + const char *name; /*package name */ + FILE *stream; /*output stream or NULL */ } pkg[H5_NPKGS]; H5_debug_open_stream_t *open_stream; /* Stack of open output streams */ } H5_debug_t; -extern H5_debug_t H5_debug_g; -#define H5DEBUG(X) (H5_debug_g.pkg[H5_PKG_##X].stream) +extern H5_debug_t H5_debug_g; +#define H5DEBUG(X) (H5_debug_g.pkg[H5_PKG_##X].stream) /* Do not use const else AIX strings does not show it. */ extern char H5libhdf5_settings[]; /* embedded library information */ /*------------------------------------------------------------------------- - * Purpose: These macros are inserted automatically just after the - * FUNC_ENTER() macro of API functions and are used to trace - * application program execution. Unless H5_DEBUG_API has been - * defined they are no-ops. + * Purpose: These macros are inserted automatically just after the + * FUNC_ENTER() macro of API functions and are used to trace + * application program execution. Unless H5_DEBUG_API has been + * defined they are no-ops. * - * Arguments: R - Return type encoded as a string - * T - Argument types encoded as a string - * A0-An - Arguments. The number at the end of the macro name - * indicates the number of arguments. + * Arguments: R - Return type encoded as a string + * T - Argument types encoded as a string + * A0-An - Arguments. The number at the end of the macro name + * indicates the number of arguments. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * * Modifications: *------------------------------------------------------------------------- */ #ifdef H5_DEBUG_API -#define H5TRACE_DECL const char *RTYPE=NULL; \ +#define H5TRACE_DECL const char *RTYPE=NULL; \ double CALLTIME; -#define H5TRACE0(R,T) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T) -#define H5TRACE1(R,T,A0) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0) -#define H5TRACE2(R,T,A0,A1) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1) -#define H5TRACE3(R,T,A0,A1,A2) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2) -#define H5TRACE4(R,T,A0,A1,A2,A3) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3) -#define H5TRACE5(R,T,A0,A1,A2,A3,A4) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ +#define H5TRACE0(R,T) RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T) +#define H5TRACE1(R,T,A0) RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0) +#define H5TRACE2(R,T,A0,A1) RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1) +#define H5TRACE3(R,T,A0,A1,A2) RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2) +#define H5TRACE4(R,T,A0,A1,A2,A3) RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3) +#define H5TRACE5(R,T,A0,A1,A2,A3,A4) RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ #A4,A4) -#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ +#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ #A4,A4,#A5,A5) #define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ #A4,A4,#A5,A5,#A6,A6) #define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) RTYPE=R; \ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ @@ -1608,46 +1608,46 @@ extern char H5libhdf5_settings[]; /* embedded library information */ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ #A4,A4,#A5,A5,#A6,A6,#A7,A7,#A8,A8,#A9,A9, \ #A10,A10) -#define H5TRACE_RETURN(V) if (RTYPE) { \ - H5_trace(&CALLTIME,FUNC,RTYPE,NULL,V); \ - RTYPE=NULL; \ - } +#define H5TRACE_RETURN(V) if (RTYPE) { \ + H5_trace(&CALLTIME,FUNC,RTYPE,NULL,V); \ + RTYPE=NULL; \ + } #else -#define H5TRACE_DECL /*void*/ -#define H5TRACE0(R,T) /*void*/ -#define H5TRACE1(R,T,A0) /*void*/ -#define H5TRACE2(R,T,A0,A1) /*void*/ -#define H5TRACE3(R,T,A0,A1,A2) /*void*/ -#define H5TRACE4(R,T,A0,A1,A2,A3) /*void*/ -#define H5TRACE5(R,T,A0,A1,A2,A3,A4) /*void*/ -#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) /*void*/ +#define H5TRACE_DECL /*void*/ +#define H5TRACE0(R,T) /*void*/ +#define H5TRACE1(R,T,A0) /*void*/ +#define H5TRACE2(R,T,A0,A1) /*void*/ +#define H5TRACE3(R,T,A0,A1,A2) /*void*/ +#define H5TRACE4(R,T,A0,A1,A2,A3) /*void*/ +#define H5TRACE5(R,T,A0,A1,A2,A3,A4) /*void*/ +#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) /*void*/ #define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) /*void*/ #define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) /*void*/ #define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) /*void*/ #define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) /*void*/ #define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) /*void*/ -#define H5TRACE_RETURN(V) /*void*/ +#define H5TRACE_RETURN(V) /*void*/ #endif H5_DLL double H5_trace(const double *calltime, const char *func, const char *type, ...); /*------------------------------------------------------------------------- - * Purpose: Register function entry for library initialization and code - * profiling. + * Purpose: Register function entry for library initialization and code + * profiling. * - * Notes: Every file must have a file-scope variable called - * `initialize_interface_g' of type hbool_t which is initialized - * to FALSE. + * Notes: Every file must have a file-scope variable called + * `initialize_interface_g' of type hbool_t which is initialized + * to FALSE. * - * Don't use local variable initializers which contain - * calls to other library functions since the initializer - * would happen before the FUNC_ENTER() gets called. Don't - * use initializers that require special cleanup code to - * execute if FUNC_ENTER() fails since a failing FUNC_ENTER() - * returns immediately without branching to the `done' label. + * Don't use local variable initializers which contain + * calls to other library functions since the initializer + * would happen before the FUNC_ENTER() gets called. Don't + * use initializers that require special cleanup code to + * execute if FUNC_ENTER() fails since a failing FUNC_ENTER() + * returns immediately without branching to the `done' label. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * * Modifications: * @@ -1659,7 +1659,7 @@ H5_DLL double H5_trace(const double *calltime, const char *func, const char *typ #define H5_IS_API(S) ('_'!=((const char *)S)[2] && '_'!=((const char *)S)[3] && (!((const char *)S)[4] || '_'!=((const char *)S)[4])) /* global library version information string */ -extern char H5_lib_vers_info_g[]; +extern char H5_lib_vers_info_g[]; /* Lock headers */ #ifdef H5_HAVE_THREADSAFE @@ -1746,17 +1746,17 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */ /* Macros for defining interface initialization routines */ #ifdef H5_INTERFACE_INIT_FUNC -static int H5_interface_initialize_g = 0; -static herr_t H5_INTERFACE_INIT_FUNC(void); -#define H5_INTERFACE_INIT(err) \ - /* Initialize this interface or bust */ \ - if (!H5_interface_initialize_g) { \ - H5_interface_initialize_g = 1; \ - if (H5_INTERFACE_INIT_FUNC()<0) { \ - H5_interface_initialize_g = 0; \ - HGOTO_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ - "interface initialization failed") \ - } \ +static int H5_interface_initialize_g = 0; +static herr_t H5_INTERFACE_INIT_FUNC(void); +#define H5_INTERFACE_INIT(err) \ + /* Initialize this interface or bust */ \ + if (!H5_interface_initialize_g) { \ + H5_interface_initialize_g = 1; \ + if (H5_INTERFACE_INIT_FUNC()<0) { \ + H5_interface_initialize_g = 0; \ + HGOTO_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ + "interface initialization failed") \ + } \ } #else /* H5_INTERFACE_INIT_FUNC */ #define H5_INTERFACE_INIT(err) @@ -1765,17 +1765,17 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); #ifndef NDEBUG #define FUNC_ENTER_COMMON_NOFUNC(func_name,asrt) \ - static hbool_t func_check = FALSE; \ - \ - if(!func_check) { \ - /* Check API status */ \ - HDassert(asrt); \ - \ - /* Check function name */ \ - H5_CHECK_FUNCNAME(func_name); \ - \ - /* Don't check again */ \ - func_check = TRUE; \ + static hbool_t func_check = FALSE; \ + \ + if(!func_check) { \ + /* Check API status */ \ + HDassert(asrt); \ + \ + /* Check function name */ \ + H5_CHECK_FUNCNAME(func_name); \ + \ + /* Don't check again */ \ + func_check = TRUE; \ } /* end if */ #else /* NDEBUG */ #define FUNC_ENTER_COMMON_NOFUNC(func_name,asrt) @@ -1783,7 +1783,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); #define FUNC_ENTER_COMMON(func_name, asrt) \ static const char FUNC[] = #func_name; \ - hbool_t err_occurred = FALSE; \ + hbool_t err_occurred = FALSE; \ FUNC_ENTER_COMMON_NOFUNC(func_name, asrt); #define FUNC_ENTER_COMMON_NOERR(func_name, asrt) \ @@ -1792,10 +1792,10 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); /* Threadsafety initialization code for API routines */ #define FUNC_ENTER_API_THREADSAFE \ - /* Initialize the thread-safe code */ \ + /* Initialize the thread-safe code */ \ H5_FIRST_THREAD_INIT \ - \ - /* Grab the mutex for the library */ \ + \ + /* Grab the mutex for the library */ \ H5_API_UNSET_CANCEL \ H5_API_LOCK @@ -1804,22 +1804,22 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); MPE_LOG_VARS(func_name) \ H5TRACE_DECL -#define FUNC_ENTER_API_COMMON(func_name) \ +#define FUNC_ENTER_API_COMMON(func_name) \ FUNC_ENTER_API_VARS(func_name) \ FUNC_ENTER_COMMON(func_name, H5_IS_API(#func_name)); \ FUNC_ENTER_API_THREADSAFE; -#define FUNC_ENTER_API_INIT(func_name,err) \ - /* Initialize the library */ \ +#define FUNC_ENTER_API_INIT(func_name,err) \ + /* Initialize the library */ \ if(!(H5_INIT_GLOBAL)) { \ H5_INIT_GLOBAL = TRUE; \ - if(H5_init_library() < 0) \ - HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, err, \ - "library initialization failed") \ - } \ + if(H5_init_library() < 0) \ + HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, err, \ + "library initialization failed") \ + } \ \ - /* Initialize the interface, if appropriate */ \ - H5_INTERFACE_INIT(err) \ + /* Initialize the interface, if appropriate */ \ + H5_INTERFACE_INIT(err) \ \ /* Push the name of this function on the function stack */ \ H5_PUSH_FUNC(#func_name) \ @@ -1829,9 +1829,9 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); /* Use this macro for all "normal" API functions */ #define FUNC_ENTER_API(func_name,err) {{ \ FUNC_ENTER_API_COMMON(func_name) \ - FUNC_ENTER_API_INIT(func_name,err); \ - /* Clear thread error stack entering public functions */ \ - H5E_clear_stack(NULL); \ + FUNC_ENTER_API_INIT(func_name,err); \ + /* Clear thread error stack entering public functions */ \ + H5E_clear_stack(NULL); \ { /* @@ -1840,7 +1840,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); */ #define FUNC_ENTER_API_NOCLEAR(func_name,err) {{ \ FUNC_ENTER_API_COMMON(func_name) \ - FUNC_ENTER_API_INIT(func_name,err); \ + FUNC_ENTER_API_INIT(func_name,err); \ { /* @@ -1865,14 +1865,14 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); #define FUNC_ENTER_API_NOINIT_NOERR_NOFS(func_name) {{ \ FUNC_ENTER_API_VARS(func_name) \ FUNC_ENTER_COMMON_NOERR(func_name, H5_IS_API(#func_name)); \ - FUNC_ENTER_API_THREADSAFE; \ + FUNC_ENTER_API_THREADSAFE; \ BEGIN_MPE_LOG(func_name); \ { /* Note: this macro only works when there's _no_ interface initialization routine for the module */ -#define FUNC_ENTER_NOAPI_INIT(func_name,err) \ - /* Initialize the interface, if appropriate */ \ - H5_INTERFACE_INIT(err) \ +#define FUNC_ENTER_NOAPI_INIT(func_name,err) \ + /* Initialize the interface, if appropriate */ \ + H5_INTERFACE_INIT(err) \ \ /* Push the name of this function on the function stack */ \ H5_PUSH_FUNC(#func_name) @@ -1880,19 +1880,19 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); /* Use this macro for all "normal" non-API functions */ #define FUNC_ENTER_NOAPI(func_name,err) { \ FUNC_ENTER_COMMON(func_name, !H5_IS_API(#func_name)); \ - FUNC_ENTER_NOAPI_INIT(func_name,err) \ + FUNC_ENTER_NOAPI_INIT(func_name,err) \ { /* Use this macro for all non-API functions, which propagate errors, but don't issue them */ #define FUNC_ENTER_NOAPI_NOERR(func_name,err) { \ FUNC_ENTER_COMMON_NOERR(func_name, !H5_IS_API(#func_name)); \ - FUNC_ENTER_NOAPI_INIT(func_name,err) \ + FUNC_ENTER_NOAPI_INIT(func_name,err) \ { /* Use this macro for all non-API functions which don't issue errors */ #define FUNC_ENTER_NOAPI_NOFUNC(func_name) { \ FUNC_ENTER_COMMON_NOFUNC(func_name,!H5_IS_API(#func_name)); \ - FUNC_ENTER_NOAPI_INIT(func_name,err) \ + FUNC_ENTER_NOAPI_INIT(func_name,err) \ { /* @@ -1961,7 +1961,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); FUNC_ENTER_COMMON(func_name, !H5_IS_API(#func_name)); \ if(H5AC_tag(tag_dxpl_id, tag, &prev_tag)<0) \ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ - FUNC_ENTER_NOAPI_INIT(func_name,err) \ + FUNC_ENTER_NOAPI_INIT(func_name,err) \ { #define FUNC_ENTER_NOAPI_NOINIT_TAG(func_name, dxpl_id, tag, err) { \ @@ -1975,10 +1975,10 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); /*------------------------------------------------------------------------- - * Purpose: Register function exit for code profiling. This should be - * the last statement executed by a function. + * Purpose: Register function exit for code profiling. This should be + * the last statement executed by a function. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * *------------------------------------------------------------------------- */ @@ -1989,33 +1989,33 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); #define FUNC_LEAVE_API(ret_value) \ FINISH_MPE_LOG; \ - H5TRACE_RETURN(ret_value); \ + H5TRACE_RETURN(ret_value); \ H5_POP_FUNC \ - if(err_occurred) \ - (void)H5E_dump_api_stack(TRUE); \ + if(err_occurred) \ + (void)H5E_dump_api_stack(TRUE); \ FUNC_LEAVE_API_THREADSAFE \ - return(ret_value); \ + return(ret_value); \ } /*end scope from end of FUNC_ENTER*/ \ }} /*end scope from beginning of FUNC_ENTER*/ /* Use this macro to match the FUNC_ENTER_API_NOFS macro */ #define FUNC_LEAVE_API_NOFS(ret_value) \ FINISH_MPE_LOG; \ - H5TRACE_RETURN(ret_value); \ + H5TRACE_RETURN(ret_value); \ FUNC_LEAVE_API_THREADSAFE \ - return(ret_value); \ + return(ret_value); \ } /*end scope from end of FUNC_ENTER*/ \ }} /*end scope from beginning of FUNC_ENTER*/ #define FUNC_LEAVE_NOAPI(ret_value) \ H5_POP_FUNC \ - return(ret_value); \ + return(ret_value); \ } /*end scope from end of FUNC_ENTER*/ \ } /*end scope from beginning of FUNC_ENTER*/ #define FUNC_LEAVE_NOAPI_VOID \ H5_POP_FUNC \ - return; \ + return; \ } /*end scope from end of FUNC_ENTER*/ \ } /*end scope from beginning of FUNC_ENTER*/ @@ -2025,7 +2025,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); * (so far, just the H5CS routines themselves) */ #define FUNC_LEAVE_NOAPI_NOFS(ret_value) \ - return(ret_value); \ + return(ret_value); \ } /*end scope from end of FUNC_ENTER*/ \ } /*end scope from beginning of FUNC_ENTER*/ @@ -2034,7 +2034,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); if(H5AC_tag(tag_dxpl_id, prev_tag, NULL)<0) \ HDONE_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ H5_POP_FUNC \ - return(ret_value); \ + return(ret_value); \ } /*end scope from end of FUNC_ENTER*/ \ } /*end scope from beginning of FUNC_ENTER*/ @@ -2061,17 +2061,17 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); ((HDisdigit(S[3]) || HDisupper(S[3])) && '_' == S[4] && '_' == S[5] && HDislower(S[6]))) #ifndef NDEBUG -#define FUNC_ENTER_NAME_CHECK(asrt) \ - { \ - static hbool_t func_check = FALSE; \ +#define FUNC_ENTER_NAME_CHECK(asrt) \ + { \ + static hbool_t func_check = FALSE; \ \ - if(!func_check) { \ - /* Check function naming status */ \ - HDassert(asrt); \ + if(!func_check) { \ + /* Check function naming status */ \ + HDassert(asrt); \ \ - /* Don't check again */ \ - func_check = TRUE; \ - } /* end if */ \ + /* Don't check again */ \ + func_check = TRUE; \ + } /* end if */ \ } /* end scope */ #else /* NDEBUG */ #define FUNC_ENTER_NAME_CHECK(asrt) @@ -2088,14 +2088,14 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); #define H5_CHECK_PACKAGE_INIT_INIT_NO(asrt) /* Macros to initialize package, if a package initialization routine is defined */ -#define H5_PKG_YES_INIT(pkg) \ - if(!H5_PACKAGE_INIT_VAR(pkg)) { \ - if(H5_GLUE(pkg, _pkg_init)() < 0) { \ - /* (Can't use H5E_THROW here) */ \ +#define H5_PKG_YES_INIT(pkg) \ + if(!H5_PACKAGE_INIT_VAR(pkg)) { \ + if(H5_GLUE(pkg, _pkg_init)() < 0) { \ + /* (Can't use H5E_THROW here) */ \ H5E_PRINTF(H5E_CANTINIT, "interface initialization failed"); \ - ret_value = fail_value; \ - goto func_init_failed; \ - } /* end if */ \ + ret_value = fail_value; \ + goto func_init_failed; \ + } /* end if */ \ } /* end if */ #define H5_PKG_NO_INIT(pkg) @@ -2126,103 +2126,103 @@ extern hbool_t H5_api_entered_g; /* Has library already been entered through #endif /* Macros for entering different scopes of routines */ -#define H5_PACKAGE_ENTER(pkg, pkg_init, init) \ - FUNC_ENTER_NAME_CHECK(H5_IS_PKG(FUNCNAME)) \ +#define H5_PACKAGE_ENTER(pkg, pkg_init, init) \ + FUNC_ENTER_NAME_CHECK(H5_IS_PKG(FUNCNAME)) \ \ - /* The library should be initialized already */ \ - HDassert(H5_INIT_GLOBAL); \ + /* The library should be initialized already */ \ + HDassert(H5_INIT_GLOBAL); \ \ - /* This interface should be initialized already */ \ - /* (except for package initialization routines :-) */ \ - H5_GLUE4(H5_CHECK_PACKAGE_INIT_, init, _, pkg_init)(pkg) \ + /* This interface should be initialized already */ \ + /* (except for package initialization routines :-) */ \ + H5_GLUE4(H5_CHECK_PACKAGE_INIT_, init, _, pkg_init)(pkg) \ \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC(FUNCNAME) \ + /* Push the name of this function on the function stack */ \ + H5_PUSH_FUNC(FUNCNAME) \ \ - /* Enter scope for this type of function */ \ + /* Enter scope for this type of function */ \ { -#define H5_PRIVATE_ENTER(pkg, pkg_init) \ - FUNC_ENTER_NAME_CHECK(H5_IS_PRIV(FUNCNAME)) \ +#define H5_PRIVATE_ENTER(pkg, pkg_init) \ + FUNC_ENTER_NAME_CHECK(H5_IS_PRIV(FUNCNAME)) \ \ - /* The library should be initialized already */ \ - HDassert(H5_INIT_GLOBAL); \ + /* The library should be initialized already */ \ + HDassert(H5_INIT_GLOBAL); \ \ - /* Initialize this interface if desired */ \ - H5_GLUE3(H5_PKG_, pkg_init, _INIT)(pkg) \ + /* Initialize this interface if desired */ \ + H5_GLUE3(H5_PKG_, pkg_init, _INIT)(pkg) \ \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC(FUNCNAME) \ + /* Push the name of this function on the function stack */ \ + H5_PUSH_FUNC(FUNCNAME) \ \ - /* Enter scope for this type of function */ \ + /* Enter scope for this type of function */ \ {{ -#define H5_PUBLIC_ENTER(pkg, pkg_init) \ - FUNC_ENTER_API_VARS(FUNCNAME) \ +#define H5_PUBLIC_ENTER(pkg, pkg_init) \ + FUNC_ENTER_API_VARS(FUNCNAME) \ FUNC_ENTER_API_THREADSAFE; \ - FUNC_ENTER_NAME_CHECK(H5_IS_PUB(FUNCNAME)) \ + FUNC_ENTER_NAME_CHECK(H5_IS_PUB(FUNCNAME)) \ \ - /* Clear thread error stack when entering public functions */ \ - H5E_clear_stack(NULL); \ + /* Clear thread error stack when entering public functions */ \ + H5E_clear_stack(NULL); \ \ - /* Initialize the library or bust */ \ - if(!(H5_INIT_GLOBAL)) { \ + /* Initialize the library or bust */ \ + if(!(H5_INIT_GLOBAL)) { \ H5_INIT_GLOBAL = TRUE; \ - if(H5_init_library() < 0) { \ - /* (Can't use H5E_THROW here) */ \ + if(H5_init_library() < 0) { \ + /* (Can't use H5E_THROW here) */ \ H5E_PRINTF(H5E_CANTINIT, "interface initialization failed"); \ - ret_value = fail_value; \ - goto func_init_failed; \ - } /* end if */ \ - } /* end if */ \ + ret_value = fail_value; \ + goto func_init_failed; \ + } /* end if */ \ + } /* end if */ \ \ - /* Initialize this interface if desired */ \ - H5_GLUE3(H5_PKG_, pkg_init, _INIT)(pkg) \ + /* Initialize this interface if desired */ \ + H5_GLUE3(H5_PKG_, pkg_init, _INIT)(pkg) \ \ - /* Check for re-entering API routine */ \ - HDassert(!H5_api_entered_g); \ - H5_api_entered_g = TRUE; \ + /* Check for re-entering API routine */ \ + HDassert(!H5_api_entered_g); \ + H5_api_entered_g = TRUE; \ \ - /* Start logging MPI's MPE information */ \ - BEGIN_MPE_LOG(FUNCNAME) \ + /* Start logging MPI's MPE information */ \ + BEGIN_MPE_LOG(FUNCNAME) \ \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC(FUNCNAME) \ + /* Push the name of this function on the function stack */ \ + H5_PUSH_FUNC(FUNCNAME) \ \ - /* Enter scope for this type of function */ \ + /* Enter scope for this type of function */ \ {{{ /* Macros for substituting the package name */ -#define FUNC_ENTER_STATIC H5_PACKAGE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT, REG) -#define FUNC_ENTER_PKGINIT H5_PACKAGE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT, INIT) -#define FUNC_ENTER_PKG H5_PACKAGE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT, REG) -#define FUNC_ENTER_PRIV H5_PRIVATE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT) -#define FUNC_ENTER_PUB H5_PUBLIC_ENTER(H5_MY_PKG, H5_MY_PKG_INIT) +#define FUNC_ENTER_STATIC H5_PACKAGE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT, REG) +#define FUNC_ENTER_PKGINIT H5_PACKAGE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT, INIT) +#define FUNC_ENTER_PKG H5_PACKAGE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT, REG) +#define FUNC_ENTER_PRIV H5_PRIVATE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT) +#define FUNC_ENTER_PUB H5_PUBLIC_ENTER(H5_MY_PKG, H5_MY_PKG_INIT) /* Macros for substituting a function prefix */ -#define FUNC_PREFIX_STATIC static +#define FUNC_PREFIX_STATIC static #define FUNC_PREFIX_PKGINIT #define FUNC_PREFIX_PKG #define FUNC_PREFIX_PRIV #define FUNC_PREFIX_PUB /* Macros for declaring error variables */ -#define FUNC_ERR_VAR_ERR(ret_typ, err) \ - hbool_t past_catch = FALSE; \ +#define FUNC_ERR_VAR_ERR(ret_typ, err) \ + hbool_t past_catch = FALSE; \ ret_typ fail_value = err; -#define FUNC_ERR_VAR_ERRCATCH(ret_typ, err) \ +#define FUNC_ERR_VAR_ERRCATCH(ret_typ, err) \ hbool_t past_catch = FALSE; #define FUNC_ERR_VAR_NOERR(ret_typ, err) /* Use this macro when entering all functions */ -#define BEGIN_FUNC(scope, use_err, ret_typ, ret_init, err, func) \ -H5_GLUE(FUNC_PREFIX_, scope) \ -ret_typ \ -func \ -/* Open function */ \ -{ \ - ret_typ ret_value = ret_init; \ - H5_GLUE(FUNC_ERR_VAR_, use_err)(ret_typ, err) \ +#define BEGIN_FUNC(scope, use_err, ret_typ, ret_init, err, func) \ +H5_GLUE(FUNC_PREFIX_, scope) \ +ret_typ \ +func \ +/* Open function */ \ +{ \ + ret_typ ret_value = ret_init; \ + H5_GLUE(FUNC_ERR_VAR_, use_err)(ret_typ, err) \ H5_GLUE(FUNC_ENTER_, scope) /* Macros for label when a function initialization can fail */ @@ -2231,73 +2231,73 @@ func \ #define H5_PRIV_FUNC_INIT_FAILED(pkg_init) H5_GLUE3(H5_PRIV_, pkg_init, _FUNC_INIT_FAILED) /* Macros for leaving different scopes of routines */ -#define FUNC_LEAVE_PKGINIT \ - /* Leave scope for this type of function */ \ - } \ +#define FUNC_LEAVE_PKGINIT \ + /* Leave scope for this type of function */ \ + } \ \ - /* Pop the name of this function off the function stack */ \ + /* Pop the name of this function off the function stack */ \ H5_POP_FUNC -#define FUNC_LEAVE_STATIC \ - /* Leave scope for this type of function */ \ - } \ +#define FUNC_LEAVE_STATIC \ + /* Leave scope for this type of function */ \ + } \ \ - /* Pop the name of this function off the function stack */ \ + /* Pop the name of this function off the function stack */ \ H5_POP_FUNC -#define FUNC_LEAVE_PKG \ - /* Leave scope for this type of function */ \ - } \ +#define FUNC_LEAVE_PKG \ + /* Leave scope for this type of function */ \ + } \ \ - /* Pop the name of this function off the function stack */ \ + /* Pop the name of this function off the function stack */ \ H5_POP_FUNC -#define FUNC_LEAVE_PRIV \ - /* Leave scope for this type of function */ \ - }} \ +#define FUNC_LEAVE_PRIV \ + /* Leave scope for this type of function */ \ + }} \ \ - /* Label for errors during FUNC_ENTER */ \ - H5_PRIV_FUNC_INIT_FAILED(H5_MY_PKG_INIT) \ + /* Label for errors during FUNC_ENTER */ \ + H5_PRIV_FUNC_INIT_FAILED(H5_MY_PKG_INIT) \ \ - /* Pop the name of this function off the function stack */ \ + /* Pop the name of this function off the function stack */ \ H5_POP_FUNC -#define FUNC_LEAVE_PUB \ - /* Leave scope for this type of function */ \ - }}} \ +#define FUNC_LEAVE_PUB \ + /* Leave scope for this type of function */ \ + }}} \ \ - /* Label for errors during FUNC_ENTER */ \ -func_init_failed: \ + /* Label for errors during FUNC_ENTER */ \ +func_init_failed: \ \ - /* Dump error stack if an error occurred during API routine */ \ - if(ret_value == fail_value) \ - (void)H5E_dump_api_stack(TRUE); \ + /* Dump error stack if an error occurred during API routine */ \ + if(ret_value == fail_value) \ + (void)H5E_dump_api_stack(TRUE); \ \ - /* Finish the API tracing info */ \ - H5TRACE_RETURN(ret_value); \ + /* Finish the API tracing info */ \ + H5TRACE_RETURN(ret_value); \ \ - /* Pop the name of this function off the function stack */ \ - H5_POP_FUNC \ + /* Pop the name of this function off the function stack */ \ + H5_POP_FUNC \ \ - /* Finish the MPE tracing info */ \ - FINISH_MPE_LOG; \ + /* Finish the MPE tracing info */ \ + FINISH_MPE_LOG; \ \ - /* Check for leaving API routine */ \ - HDassert(H5_api_entered_g); \ - H5_api_entered_g = FALSE; \ + /* Check for leaving API routine */ \ + HDassert(H5_api_entered_g); \ + H5_api_entered_g = FALSE; \ \ - /* Release thread-safety semaphore */ \ + /* Release thread-safety semaphore */ \ FUNC_LEAVE_API_THREADSAFE /* Use this macro when leaving all functions */ -#define END_FUNC(scope) \ - /* Scope-specific function conclusion */ \ - H5_GLUE(FUNC_LEAVE_, scope) \ +#define END_FUNC(scope) \ + /* Scope-specific function conclusion */ \ + H5_GLUE(FUNC_LEAVE_, scope) \ \ - /* Leave routine */ \ - return(ret_value); \ + /* Leave routine */ \ + return(ret_value); \ \ - /* Close Function */ \ + /* Close Function */ \ } /* Macro to begin/end tagging (when FUNC_ENTER_*TAG macros are insufficient) */ diff --git a/src/H5system.c b/src/H5system.c index e46b7c3..1f0ad29 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -604,7 +604,7 @@ HDremove_all(const char *fname) * *------------------------------------------------------------------------- */ -#ifdef _WIN32 /* H5_HAVE_VISUAL_STUDIO */ +#ifdef H5_HAVE_VISUAL_STUDIO /* Offset between 1/1/1601 and 1/1/1970 in 100 nanosecond units */ #define _W32_FT_OFFSET (116444736000000000ULL) diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 743ceaa..5daef23 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -23,7 +23,7 @@ * */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API typedef struct _stati64 h5_stat_t; typedef __int64 h5_stat_size_t; @@ -33,17 +33,35 @@ typedef __int64 h5_stat_size_t; #define HDdup(F) _dup(F) #define HDfdopen(N,S) _fdopen(N,S) #define HDfileno(F) _fileno(F) -#if _MSC_VER > 1310 /* Newer than VS.NET 2003 */ #define HDftruncate(F,L) _chsize_s(F,L) -#else -#define HDftruncate(F,L) chsize(F,L) -#endif #define HDfstat(F,B) _fstati64(F,B) #define HDisatty(F) _isatty(F) -#define HDlstat(S,B) _lstati64(S,B) -#define HDstat(S,B) _stati64(S,B) #define HDgetcwd(S,Z) _getcwd(S,Z) #define HDgetdcwd(D,S,Z) _getdcwd(D,S,Z) +#define HDgetdrive() _getdrive() +#define HDlseek(F,O,W) _lseeki64(F,O,W) +#define HDlstat(S,B) _lstati64(S,B) +#define HDmkdir(S,M) _mkdir(S) +#define HDoff_t __int64 +#define HDopen(S,F,M) _open(S,F|_O_BINARY,M) +#define HDread(F,M,Z) _read(F,M,Z) +#define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,(Z>1?Z:2)) +#define HDsleep(S) Sleep(S*1000) +#define HDstat(S,B) _stati64(S,B) +#define HDstrcasecmp(A,B) _stricmp(A,B) +#define HDstrtoull(S,R,N) _strtoui64(S,R,N) +#define HDstrdup(S) _strdup(S) +#define HDsnprintf _snprintf /*varargs*/ +#define HDtzset() _tzset() +#define HDunlink(S) _unlink(S) +#define HDvsnprintf(S,N,FMT,A) _vsnprintf(S,N,FMT,A) +#define HDwrite(F,M,Z) _write(F,M,Z) + +#ifdef H5_HAVE_VISUAL_STUDIO +/* + * The (void*) cast just avoids a compiler warning in H5_HAVE_VISUAL_STUDIO + */ +#define HDmemset(X,C,Z) memset((void*)(X),C,Z) struct timezone { int tz_minuteswest; @@ -60,24 +78,8 @@ struct timezone { #endif /* __cplusplus */ #define HDgettimeofday(V,Z) Wgettimeofday(V,Z) #define HDgetlogin() Wgetlogin() - -#define HDgetdrive() _getdrive() -#define HDlseek(F,O,W) _lseeki64(F,O,W) -#define HDoff_t __int64 -#define HDmemset(X,C,Z) memset((void*)(X),C,Z) -#define HDmkdir(S,M) _mkdir(S) -#define HDopen(S,F,M) _open(S,F|_O_BINARY,M) -#define HDread(F,M,Z) _read(F,M,Z) -#define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,(Z>1?Z:2)) -#define HDsleep(S) Sleep(S*1000) -#define HDstrcasecmp(A,B) _stricmp(A,B) -#define HDstrtoull(S,R,N) _strtoui64(S,R,N) -#define HDstrdup(S) _strdup(S) -#define HDsnprintf _snprintf /*varargs*/ -#define HDtzset() _tzset() -#define HDunlink(S) _unlink(S) -#define HDvsnprintf(S,N,FMT,A) _vsnprintf(S,N,FMT,A) -#define HDwrite(F,M,Z) _write(F,M,Z) + +#endif /* H5_HAVE_VISUAL_STUDIO */ /* Non-POSIX functions */ @@ -85,5 +87,4 @@ struct timezone { * type cannot be cast as a ulong like other systems. */ #define HDpthread_self_ulong() ((unsigned long)GetCurrentThreadId()) - -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ diff --git a/test/flush2.c b/test/flush2.c index 5675856..06dd086 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -186,7 +186,7 @@ main(void) PASSED() else { -#if defined _WIN32 && defined _HDF5USEDLL_ +#if defined H5_HAVE_WIN32_API && defined _HDF5USEDLL_ SKIPPED(); puts(" DLL will flush the file even when calling _exit, skip this test temporarily"); #elif defined H5_VMS @@ -209,7 +209,7 @@ main(void) PASSED() else { -#if defined _WIN32 && defined _HDF5USEDLL_ +#if defined H5_HAVE_WIN32_API && defined _HDF5USEDLL_ SKIPPED(); puts(" DLL will flush the file even when calling _exit, skip this test temporarily"); #elif defined H5_VMS diff --git a/test/h5test.c b/test/h5test.c index ae864f0..f8c3d9c 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -17,11 +17,11 @@ * Programmer: Robb Matzke * Thursday, November 19, 1998 * - * Purpose: Provides support functions for most of the hdf5 tests cases. + * Purpose: Provides support functions for most of the hdf5 tests cases. * */ -#undef NDEBUG /*override -DNDEBUG */ +#undef NDEBUG /*override -DNDEBUG */ #include #include #include "h5test.h" @@ -32,35 +32,33 @@ #define H5G_TESTING #include "H5Gpkg.h" -#ifdef H5_HAVE_WINSOCK_H +#ifdef H5_HAVE_WIN32_API #include -#include -#include -#endif /* H5_HAVE_WINSOCK_H */ +#endif /* H5_HAVE_WIN32_API */ /* * Define these environment variables or constants to influence functions in * this test support library. The environment variable is used in preference * to the cpp constant. If neither is defined then use some default value. * - * HDF5_DRIVER: This string describes what low level file driver to - * use for HDF5 file access. The first word in the - * value is the name of the driver and subsequent data - * is interpreted according to the driver. See - * h5_fileaccess() for details. - * - * HDF5_PREFIX: A string to add to the beginning of all serial test - * file names. This can be used to run tests in a - * different file system (e.g., "/tmp" or "/tmp/myname"). - * The prefix will be separated from the base file name - * by a slash. See h5_fixname() for details. - * - * HDF5_PARAPREFIX: A string to add to the beginning of all parallel test - * file names. This can be used to tell MPIO what driver - * to use (e.g., "gfs:", "ufs:", or "nfs:") or to use a - * different file system (e.g., "/tmp" or "/tmp/myname"). - * The prefix will be separated from the base file name - * by a slash. See h5_fixname() for details. + * HDF5_DRIVER: This string describes what low level file driver to + * use for HDF5 file access. The first word in the + * value is the name of the driver and subsequent data + * is interpreted according to the driver. See + * h5_fileaccess() for details. + * + * HDF5_PREFIX: A string to add to the beginning of all serial test + * file names. This can be used to run tests in a + * different file system (e.g., "/tmp" or "/tmp/myname"). + * The prefix will be separated from the base file name + * by a slash. See h5_fixname() for details. + * + * HDF5_PARAPREFIX: A string to add to the beginning of all parallel test + * file names. This can be used to tell MPIO what driver + * to use (e.g., "gfs:", "ufs:", or "nfs:") or to use a + * different file system (e.g., "/tmp" or "/tmp/myname"). + * The prefix will be separated from the base file name + * by a slash. See h5_fixname() for details. * */ /* @@ -72,7 +70,7 @@ #ifndef HDF5_PARAPREFIX #define HDF5_PARAPREFIX "" #endif -char *paraprefix = NULL; /* for command line option para-prefix */ +char *paraprefix = NULL; /* for command line option para-prefix */ #ifdef H5_HAVE_PARALLEL MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ #endif @@ -84,13 +82,13 @@ MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ * These are the letters that are appended to the file name when generating * names for the split and multi drivers. They are: * - * m: All meta data when using the split driver. - * s: The userblock, superblock, and driver info block - * b: B-tree nodes - * r: Dataset raw data - * g: Global heap - * l: local heap (object names) - * o: object headers + * m: All meta data when using the split driver. + * s: The userblock, superblock, and driver info block + * b: B-tree nodes + * r: Dataset raw data + * g: Global heap + * l: local heap (object names) + * o: object headers */ static const char *multi_letters = "msbrglo"; @@ -98,16 +96,16 @@ static herr_t h5_errors(hid_t estack, void *client_data); /*------------------------------------------------------------------------- - * Function: h5_errors + * Function: h5_errors * - * Purpose: Displays the error stack after printing "*FAILED*". + * Purpose: Displays the error stack after printing "*FAILED*". * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke - * Wednesday, March 4, 1998 + * Programmer: Robb Matzke + * Wednesday, March 4, 1998 * * Modifications: * @@ -123,50 +121,50 @@ h5_errors(hid_t estack, void UNUSED *client_data) /*------------------------------------------------------------------------- - * Function: h5_cleanup + * Function: h5_cleanup * - * Purpose: Cleanup temporary test files. - * base_name contains the list of test file names. - * The file access property list is also closed. + * Purpose: Cleanup temporary test files. + * base_name contains the list of test file names. + * The file access property list is also closed. * - * Return: Non-zero if cleanup actions were performed; zero otherwise. + * Return: Non-zero if cleanup actions were performed; zero otherwise. * - * Programmer: Albert Cheng + * Programmer: Albert Cheng * May 28, 1998 * * Modifications: - * Albert Cheng, 2000-09-09 - * Added the explicite base_name argument to replace the - * global variable FILENAME. + * Albert Cheng, 2000-09-09 + * Added the explicite base_name argument to replace the + * global variable FILENAME. * *------------------------------------------------------------------------- */ int h5_cleanup(const char *base_name[], hid_t fapl) { - char filename[1024]; - char temp[2048]; - int i, j; - int retval=0; - hid_t driver; + char filename[1024]; + char temp[2048]; + int i, j; + int retval=0; + hid_t driver; if (GetTestCleanup()){ - for (i = 0; base_name[i]; i++) { - if (h5_fixname(base_name[i], fapl, filename, sizeof(filename)) == NULL) - continue; + for (i = 0; base_name[i]; i++) { + if (h5_fixname(base_name[i], fapl, filename, sizeof(filename)) == NULL) + continue; driver = H5Pget_driver(fapl); - if (driver == H5FD_FAMILY) { - for (j = 0; /*void*/; j++) { - HDsnprintf(temp, sizeof temp, filename, j); + if (driver == H5FD_FAMILY) { + for (j = 0; /*void*/; j++) { + HDsnprintf(temp, sizeof temp, filename, j); - if (HDaccess(temp, F_OK) < 0) + if (HDaccess(temp, F_OK) < 0) break; - HDremove(temp); - } - } else if (driver == H5FD_CORE) { + HDremove(temp); + } + } else if (driver == H5FD_CORE) { hbool_t backing; /* Whether the core file has backing store */ H5Pget_fapl_core(fapl,NULL,&backing); @@ -175,21 +173,21 @@ h5_cleanup(const char *base_name[], hid_t fapl) if(backing) HDremove(filename); - } else if (driver == H5FD_MULTI) { - H5FD_mem_t mt; - assert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); - - for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { - HDsnprintf(temp, sizeof temp, "%s-%c.h5", - filename, multi_letters[mt]); - HDremove(temp); /*don't care if it fails*/ - } - } else { - HDremove(filename); - } - } - - retval = 1; + } else if (driver == H5FD_MULTI) { + H5FD_mem_t mt; + assert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); + + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { + HDsnprintf(temp, sizeof temp, "%s-%c.h5", + filename, multi_letters[mt]); + HDremove(temp); /*don't care if it fails*/ + } + } else { + HDremove(filename); + } + } + + retval = 1; } H5Pclose(fapl); @@ -198,13 +196,13 @@ h5_cleanup(const char *base_name[], hid_t fapl) /*------------------------------------------------------------------------- - * Function: h5_reset + * Function: h5_reset * - * Purpose: Reset the library by closing it. + * Purpose: Reset the library by closing it. * - * Return: void + * Return: void * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, November 20, 1998 * * Modifications: @@ -230,7 +228,7 @@ h5_reset(void) */ #ifdef OLD_WAY { - char filename[1024]; + char filename[1024]; /* * Cause the library to emit some diagnostics early so they don't @@ -238,12 +236,12 @@ h5_reset(void) */ sprintf(filename, "/tmp/h5emit-%05d.h5", HDgetpid()); H5E_BEGIN_TRY { - hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, - H5P_DEFAULT); - hid_t grp = H5Gcreate2(file, "emit", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Gclose(grp); - H5Fclose(file); - HDunlink(filename); + hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, + H5P_DEFAULT); + hid_t grp = H5Gcreate2(file, "emit", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Gclose(grp); + H5Fclose(file); + HDunlink(filename); } H5E_END_TRY; } #endif /* OLD_WAY */ @@ -251,34 +249,34 @@ h5_reset(void) /*------------------------------------------------------------------------- - * Function: h5_fixname + * Function: h5_fixname * - * Purpose: Create a file name from a file base name like `test' and - * return it through the FULLNAME (at most SIZE characters - * counting the null terminator). The full name is created by - * prepending the contents of HDF5_PREFIX (separated from the - * base name by a slash) and appending a file extension based on - * the driver supplied, resulting in something like - * `ufs:/u/matzke/test.h5'. + * Purpose: Create a file name from a file base name like `test' and + * return it through the FULLNAME (at most SIZE characters + * counting the null terminator). The full name is created by + * prepending the contents of HDF5_PREFIX (separated from the + * base name by a slash) and appending a file extension based on + * the driver supplied, resulting in something like + * `ufs:/u/matzke/test.h5'. * - * Return: Success: The FULLNAME pointer. + * Return: Success: The FULLNAME pointer. * - * Failure: NULL if BASENAME or FULLNAME is the null - * pointer or if FULLNAME isn't large enough for - * the result. + * Failure: NULL if BASENAME or FULLNAME is the null + * pointer or if FULLNAME isn't large enough for + * the result. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, November 19, 1998 * * Modifications: - * Robb Matzke, 1999-08-03 - * Modified to use the virtual file layer. + * Robb Matzke, 1999-08-03 + * Modified to use the virtual file layer. * - * Albert Cheng, 2000-01-25 - * Added prefix for parallel test files. + * Albert Cheng, 2000-01-25 + * Added prefix for parallel test files. * - * Albert Cheng, 2003-05-08 - * Changed the default parallel prefix back to NULL but added + * Albert Cheng, 2003-05-08 + * Changed the default parallel prefix back to NULL but added * an explanation remark of $HDF5_PARAPREFIX. *------------------------------------------------------------------------- */ @@ -290,7 +288,7 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) char *ptr, last = '\0'; size_t i, j; hid_t driver = -1; - int isppdriver = 0; /* if the driver is MPI parallel */ + int isppdriver = 0; /* if the driver is MPI parallel */ if (!base_name || !fullname || size < 1) return NULL; @@ -299,20 +297,20 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) /* figure out the suffix */ if (H5P_DEFAULT != fapl) { - if ((driver = H5Pget_driver(fapl)) < 0) + if ((driver = H5Pget_driver(fapl)) < 0) return NULL; - if (H5FD_FAMILY == driver) - suffix = "%05d.h5"; - else if (H5FD_MULTI == driver) - suffix = NULL; + if (H5FD_FAMILY == driver) + suffix = "%05d.h5"; + else if (H5FD_MULTI == driver) + suffix = NULL; } /* Must first check fapl is not H5P_DEFAULT (-1) because H5FD_XXX * could be of value -1 if it is not defined. */ isppdriver = H5P_DEFAULT != fapl && - (H5FD_MPIO==driver || H5FD_MPIPOSIX==driver); + (H5FD_MPIO==driver || H5FD_MPIPOSIX==driver); /* Check HDF5_NOCLEANUP environment setting. * (The #ifdef is needed to prevent compile failure in case MPI is not @@ -320,12 +318,12 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) */ if (isppdriver){ #ifdef H5_HAVE_PARALLEL - if (getenv_all(MPI_COMM_WORLD, 0, "HDF5_NOCLEANUP")) - SetTestNoCleanup(); + if (getenv_all(MPI_COMM_WORLD, 0, "HDF5_NOCLEANUP")) + SetTestNoCleanup(); #endif /* H5_HAVE_PARALLEL */ }else{ - if (HDgetenv("HDF5_NOCLEANUP")) - SetTestNoCleanup(); + if (HDgetenv("HDF5_NOCLEANUP")) + SetTestNoCleanup(); } /* Check what prefix to use for test files. Process HDF5_PARAPREFIX and @@ -336,52 +334,52 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) */ if (isppdriver){ #ifdef H5_HAVE_PARALLEL - /* + /* * For parallel: * First use command line option, then the environment * variable, then try the constant - */ + */ static int explained = 0; - prefix = (paraprefix ? paraprefix : getenv_all(MPI_COMM_WORLD, 0, "HDF5_PARAPREFIX")); + prefix = (paraprefix ? paraprefix : getenv_all(MPI_COMM_WORLD, 0, "HDF5_PARAPREFIX")); - if (!prefix && !explained) { - /* print hint by process 0 once. */ - int mpi_rank; + if (!prefix && !explained) { + /* print hint by process 0 once. */ + int mpi_rank; - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); - if (mpi_rank == 0) - printf("*** Hint ***\n" - "You can use environment variable HDF5_PARAPREFIX to " - "run parallel test files in a\n" - "different directory or to add file type prefix. E.g.,\n" - " HDF5_PARAPREFIX=pfs:/PFS/user/me\n" - " export HDF5_PARAPREFIX\n" - "*** End of Hint ***\n"); + if (mpi_rank == 0) + printf("*** Hint ***\n" + "You can use environment variable HDF5_PARAPREFIX to " + "run parallel test files in a\n" + "different directory or to add file type prefix. E.g.,\n" + " HDF5_PARAPREFIX=pfs:/PFS/user/me\n" + " export HDF5_PARAPREFIX\n" + "*** End of Hint ***\n"); - explained = TRUE; + explained = TRUE; #ifdef HDF5_PARAPREFIX prefix = HDF5_PARAPREFIX; #endif /* HDF5_PARAPREFIX */ - } + } #endif /* H5_HAVE_PARALLEL */ } else { - /* + /* * For serial: * First use the environment variable, then try the constant - */ - prefix = HDgetenv("HDF5_PREFIX"); + */ + prefix = HDgetenv("HDF5_PREFIX"); #ifdef HDF5_PREFIX - if (!prefix) + if (!prefix) prefix = HDF5_PREFIX; #endif /* HDF5_PREFIX */ } /* Prepend the prefix value to the base name */ if (prefix && *prefix) { - if (isppdriver){ + if (isppdriver){ /* This is a parallel system */ char *subdir; @@ -441,18 +439,18 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) return NULL; } } else if (HDstrlen(base_name) >= size) { - /* Buffer is too small */ - return NULL; + /* Buffer is too small */ + return NULL; } else { - HDstrcpy(fullname, base_name); + HDstrcpy(fullname, base_name); } /* Append a suffix */ if (suffix) { - if (HDstrlen(fullname) + HDstrlen(suffix) >= size) + if (HDstrlen(fullname) + HDstrlen(suffix) >= size) return NULL; - HDstrcat(fullname, suffix); + HDstrcat(fullname, suffix); } /* Remove any double slashes in the filename */ @@ -468,19 +466,19 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) /*------------------------------------------------------------------------- - * Function: h5_rmprefix + * Function: h5_rmprefix * - * Purpose: This "removes" the MPIO driver prefix part of the file name - * by returning a pointer that points at the non-prefix component + * Purpose: This "removes" the MPIO driver prefix part of the file name + * by returning a pointer that points at the non-prefix component * part of the file name. E.g., - * Input Return - * pfs:/scratch1/dataX /scratch1/dataX - * /scratch2/dataY /scratch2/dataY - * Note that there is no change to the original file name. + * Input Return + * pfs:/scratch1/dataX /scratch1/dataX + * /scratch2/dataY /scratch2/dataY + * Note that there is no change to the original file name. * - * Return: Success: a pointer at the non-prefix part. + * Return: Success: a pointer at the non-prefix part. * - * Programmer: Albert Cheng; Jun 1, 2006 + * Programmer: Albert Cheng; Jun 1, 2006 * *------------------------------------------------------------------------- */ @@ -490,26 +488,26 @@ h5_rmprefix(const char *filename) const char *ret_ptr; if ((ret_ptr = HDstrstr(filename, ":")) == NULL) - ret_ptr = filename; + ret_ptr = filename; else - ret_ptr++; + ret_ptr++; return(ret_ptr); } /*------------------------------------------------------------------------- - * Function: h5_fileaccess + * Function: h5_fileaccess * - * Purpose: Returns a file access template which is the default template - * but with a file driver set according to the constant or - * environment variable HDF5_DRIVER + * Purpose: Returns a file access template which is the default template + * but with a file driver set according to the constant or + * environment variable HDF5_DRIVER * - * Return: Success: A file access property list + * Return: Success: A file access property list * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, November 19, 1998 * * Modifications: @@ -519,8 +517,8 @@ h5_rmprefix(const char *filename) hid_t h5_fileaccess(void) { - const char *val = NULL; - const char *name; + const char *val = NULL; + const char *name; char s[1024]; hid_t fapl = -1; @@ -538,53 +536,53 @@ h5_fileaccess(void) if (NULL==(name=HDstrtok(s, " \t\n\r"))) return fapl; if (!HDstrcmp(name, "sec2")) { - /* Unix read() and write() system calls */ - if (H5Pset_fapl_sec2(fapl)<0) return -1; + /* Unix read() and write() system calls */ + if (H5Pset_fapl_sec2(fapl)<0) return -1; } else if (!HDstrcmp(name, "stdio")) { - /* Standard C fread() and fwrite() system calls */ - if (H5Pset_fapl_stdio(fapl)<0) return -1; + /* Standard C fread() and fwrite() system calls */ + if (H5Pset_fapl_stdio(fapl)<0) return -1; } else if (!HDstrcmp(name, "core")) { - /* In-core temporary file with 1MB increment */ - if (H5Pset_fapl_core(fapl, (size_t)1, TRUE)<0) return -1; + /* In-core temporary file with 1MB increment */ + if (H5Pset_fapl_core(fapl, (size_t)1, TRUE)<0) return -1; } else if (!HDstrcmp(name, "split")) { - /* Split meta data and raw data each using default driver */ - if (H5Pset_fapl_split(fapl, - "-m.h5", H5P_DEFAULT, - "-r.h5", H5P_DEFAULT)<0) - return -1; + /* Split meta data and raw data each using default driver */ + if (H5Pset_fapl_split(fapl, + "-m.h5", H5P_DEFAULT, + "-r.h5", H5P_DEFAULT)<0) + return -1; } else if (!HDstrcmp(name, "multi")) { - /* Multi-file driver, general case of the split driver */ - H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; - hid_t memb_fapl[H5FD_MEM_NTYPES]; - const char *memb_name[H5FD_MEM_NTYPES]; - char sv[H5FD_MEM_NTYPES][1024]; - haddr_t memb_addr[H5FD_MEM_NTYPES]; - H5FD_mem_t mt; - - HDmemset(memb_map, 0, sizeof memb_map); - HDmemset(memb_fapl, 0, sizeof memb_fapl); - HDmemset(memb_name, 0, sizeof memb_name); - HDmemset(memb_addr, 0, sizeof memb_addr); - - HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { - memb_fapl[mt] = H5P_DEFAULT; - sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); - memb_name[mt] = sv[mt]; - memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); - } /* end for */ - - if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, - memb_addr, FALSE)<0) { - return -1; - } + /* Multi-file driver, general case of the split driver */ + H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; + hid_t memb_fapl[H5FD_MEM_NTYPES]; + const char *memb_name[H5FD_MEM_NTYPES]; + char sv[H5FD_MEM_NTYPES][1024]; + haddr_t memb_addr[H5FD_MEM_NTYPES]; + H5FD_mem_t mt; + + HDmemset(memb_map, 0, sizeof memb_map); + HDmemset(memb_fapl, 0, sizeof memb_fapl); + HDmemset(memb_name, 0, sizeof memb_name); + HDmemset(memb_addr, 0, sizeof memb_addr); + + HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { + memb_fapl[mt] = H5P_DEFAULT; + sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); + memb_name[mt] = sv[mt]; + memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); + } /* end for */ + + if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, + memb_addr, FALSE)<0) { + return -1; + } } else if (!HDstrcmp(name, "family")) { hsize_t fam_size = 100*1024*1024; /*100 MB*/ - /* Family of files, each 1MB and using the default driver */ - if ((val=HDstrtok(NULL, " \t\n\r"))) - fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024); - if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0) + /* Family of files, each 1MB and using the default driver */ + if ((val=HDstrtok(NULL, " \t\n\r"))) + fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024); + if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0) return -1; } else if (!HDstrcmp(name, "log")) { unsigned log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC; @@ -594,20 +592,20 @@ h5_fileaccess(void) log_flags = (unsigned)HDstrtol(val, NULL, 0); if (H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0) - return -1; + return -1; } else if (!HDstrcmp(name, "direct")) { #ifdef H5_HAVE_DIRECT - /* Linux direct read() and write() system calls. Set memory boundary, file block size, - * and copy buffer size to the default values. */ - if (H5Pset_fapl_direct(fapl, 1024, 4096, 8*4096)<0) return -1; + /* Linux direct read() and write() system calls. Set memory boundary, file block size, + * and copy buffer size to the default values. */ + if (H5Pset_fapl_direct(fapl, 1024, 4096, 8*4096)<0) return -1; #endif } else if(!HDstrcmp(name, "latest")) { - /* use the latest format */ - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + /* use the latest format */ + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) return -1; } else { - /* Unknown driver */ - return -1; + /* Unknown driver */ + return -1; } return fapl; @@ -615,13 +613,13 @@ h5_fileaccess(void) /*------------------------------------------------------------------------- - * Function: h5_no_hwconv + * Function: h5_no_hwconv * - * Purpose: Turn off hardware data type conversions. + * Purpose: Turn off hardware data type conversions. * - * Return: void + * Return: void * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, November 20, 1998 * * Modifications: @@ -636,13 +634,13 @@ h5_no_hwconv(void) /*------------------------------------------------------------------------- - * Function: h5_show_hostname + * Function: h5_show_hostname * - * Purpose: Show hostname. Show process ID if in MPI environment. + * Purpose: Show hostname. Show process ID if in MPI environment. * - * Return: void + * Return: void * - * Programmer: Albert Cheng + * Programmer: Albert Cheng * 2002/04/22 * * Modifications: @@ -652,8 +650,8 @@ h5_no_hwconv(void) void h5_show_hostname(void) { - char hostname[80]; -#ifdef H5_HAVE_WINSOCK_H + char hostname[80]; +#ifdef H5_HAVE_WIN32_API WSADATA wsaData; int err; #endif @@ -661,21 +659,21 @@ h5_show_hostname(void) /* try show the process or thread id in multiple processes cases*/ #ifdef H5_HAVE_PARALLEL { - int mpi_rank, mpi_initialized; - - MPI_Initialized(&mpi_initialized); - if (mpi_initialized){ - MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); - printf("MPI-process %d.", mpi_rank); - }else - printf("thread 0."); + int mpi_rank, mpi_initialized; + + MPI_Initialized(&mpi_initialized); + if (mpi_initialized){ + MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); + printf("MPI-process %d.", mpi_rank); + }else + printf("thread 0."); } #elif defined(H5_HAVE_THREADSAFE) printf("thread %lu.", HDpthread_self_ulong()); #else printf("thread 0."); #endif -#ifdef H5_HAVE_WINSOCK_H +#ifdef H5_HAVE_WIN32_API err = WSAStartup( MAKEWORD(2,2), &wsaData ); if ( err != 0 ) { @@ -699,13 +697,13 @@ h5_show_hostname(void) #endif #ifdef H5_HAVE_GETHOSTNAME if (gethostname(hostname, (size_t)80) < 0) - printf(" gethostname failed\n"); + printf(" gethostname failed\n"); else - printf(" hostname=%s\n", hostname); + printf(" hostname=%s\n", hostname); #else printf(" gethostname not supported\n"); #endif -#ifdef H5_HAVE_WINSOCK_H +#ifdef H5_HAVE_WIN32_API WSACleanup(); #endif } @@ -728,8 +726,8 @@ h5_show_hostname(void) int h5_set_info_object(void) { - char *envp; /* environment pointer */ - int ret_value=0; + char *envp; /* environment pointer */ + int ret_value=0; /* handle any MPI INFO hints via $HDF5_MPI_INFO */ if ((envp = getenv("HDF5_MPI_INFO")) != NULL){ @@ -816,39 +814,39 @@ h5_set_info_object(void) void h5_dump_info_object(MPI_Info info) { - char key[MPI_MAX_INFO_KEY+1]; - char value[MPI_MAX_INFO_VAL+1]; - int flag; - int i, nkeys; + char key[MPI_MAX_INFO_KEY+1]; + char value[MPI_MAX_INFO_VAL+1]; + int flag; + int i, nkeys; printf("Dumping MPI Info Object(%d) (up to %d bytes per item):\n", (int)info, - MPI_MAX_INFO_VAL); + MPI_MAX_INFO_VAL); if (info==MPI_INFO_NULL){ - printf("object is MPI_INFO_NULL\n"); + printf("object is MPI_INFO_NULL\n"); } else { - MPI_Info_get_nkeys(info, &nkeys); - printf("object has %d items\n", nkeys); - for (i=0; i= 0) { - if(env == NULL) - env = (char*) HDmalloc(len+1); - else if(strlen(env) < len) - env = (char*) HDrealloc(env, len+1); - - MPI_Bcast(env, len, MPI_CHAR, root, comm); - env[len] = '\0'; - } - else { - if(env) - HDfree(env); - env = NULL; - } - } + MPI_Comm_rank(comm, &mpi_rank); + MPI_Comm_size(comm, &mpi_size); + assert(root < mpi_size); + + /* The root task does the getenv call + * and sends the result to the other tasks */ + if(mpi_rank == root) { + env = HDgetenv(name); + if(env) { + len = HDstrlen(env); + MPI_Bcast(&len, 1, MPI_INT, root, comm); + MPI_Bcast(env, len, MPI_CHAR, root, comm); + } + else { + /* len -1 indicates that the variable was not in the environment */ + len = -1; + MPI_Bcast(&len, 1, MPI_INT, root, comm); + } + } + else { + MPI_Bcast(&len, 1, MPI_INT, root, comm); + if(len >= 0) { + if(env == NULL) + env = (char*) HDmalloc(len+1); + else if(strlen(env) < len) + env = (char*) HDrealloc(env, len+1); + + MPI_Bcast(env, len, MPI_CHAR, root, comm); + env[len] = '\0'; + } + else { + if(env) + HDfree(env); + env = NULL; + } + } } #ifndef NDEBUG diff --git a/test/vfd.c b/test/vfd.c index 46e38bc..f6e9f06 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -76,9 +76,9 @@ const char *FILENAME[] = { static herr_t test_sec2(void) { - hid_t file = -1; - hid_t fapl = -1; - hid_t access_fapl = -1; + hid_t file = -1; + hid_t fapl = -1; + hid_t access_fapl = -1; char filename[1024]; int *fhandle = NULL; hsize_t file_size = 0; @@ -157,18 +157,18 @@ test_direct(void) { #ifdef H5_HAVE_DIRECT hid_t file=(-1), fapl, access_fapl = -1; - hid_t dset1=-1, dset2=-1, space1=-1, space2=-1; + hid_t dset1=-1, dset2=-1, space1=-1, space2=-1; char filename[1024]; int *fhandle=NULL; hsize_t file_size; - hsize_t dims1[2], dims2[1]; - size_t mbound; - size_t fbsize; - size_t cbsize; - int *points, *check, *p1, *p2; - int wdata2[DSET2_DIM] = {11,12,13,14}; - int rdata2[DSET2_DIM]; - int i, j, n; + hsize_t dims1[2], dims2[1]; + size_t mbound; + size_t fbsize; + size_t cbsize; + int *points, *check, *p1, *p2; + int wdata2[DSET2_DIM] = {11,12,13,14}; + int rdata2[DSET2_DIM]; + int i, j, n; #endif /*H5_HAVE_DIRECT*/ TESTING("DIRECT I/O file driver"); @@ -189,10 +189,10 @@ test_direct(void) if(H5Pget_fapl_direct(fapl, &mbound, &fbsize, &cbsize) < 0) TEST_ERROR; if(mbound != MBOUNDARY || fbsize != FBSIZE || cbsize != CBSIZE) - TEST_ERROR; + TEST_ERROR; if(H5Pset_alignment(fapl, (hsize_t)THRESHOLD, (hsize_t)FBSIZE) < 0) - TEST_ERROR; + TEST_ERROR; H5E_BEGIN_TRY { file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); @@ -200,7 +200,7 @@ test_direct(void) if(file<0) { H5Pclose (fapl); SKIPPED(); - printf(" Probably the file system doesn't support Direct I/O\n"); + printf(" Probably the file system doesn't support Direct I/O\n"); return 0; } @@ -244,8 +244,8 @@ test_direct(void) /* Initialize the dset1 */ p1 = points; for(i = n = 0; i < DSET1_DIM1; i++) - for(j = 0; j < DSET1_DIM2; j++) - *p1++ = n++; + for(j = 0; j < DSET1_DIM2; j++) + *p1++ = n++; /* Create the data space1 */ dims1[0] = DSET1_DIM1; @@ -275,13 +275,13 @@ test_direct(void) p1 = points; p2 = check; for(i = 0; i < DSET1_DIM1; i++) - for(j = 0; j < DSET1_DIM2; j++) - if(*p1++ != *p2++) { - H5_FAILED(); - printf(" Read different values than written in data set 1.\n"); - printf(" At index %d,%d\n", i, j); - TEST_ERROR; - } /* end if */ + for(j = 0; j < DSET1_DIM2; j++) + if(*p1++ != *p2++) { + H5_FAILED(); + printf(" Read different values than written in data set 1.\n"); + printf(" At index %d,%d\n", i, j); + TEST_ERROR; + } /* end if */ /* Create the data space2. For data set 2, memory address and data size are not aligned. */ dims2[0] = DSET2_DIM; @@ -308,12 +308,12 @@ test_direct(void) /* Check that the values read are the same as the values written */ for(i = 0; i < DSET2_DIM; i++) - if(wdata2[i] != rdata2[i]) { - H5_FAILED(); - printf(" Read different values than written in data set 2.\n"); - printf(" At index %d\n", i); + if(wdata2[i] != rdata2[i]) { + H5_FAILED(); + printf(" Read different values than written in data set 2.\n"); + printf(" At index %d\n", i); TEST_ERROR; - } /* end if */ + } /* end if */ if(H5Sclose(space1) < 0) TEST_ERROR; @@ -326,9 +326,9 @@ test_direct(void) if(H5Fclose(file) < 0) TEST_ERROR; if(points) - free(points); + free(points); if(check) - free(check); + free(check); h5_cleanup(FILENAME, fapl); PASSED(); @@ -368,10 +368,10 @@ test_core(void) char filename[1024]; void *fhandle=NULL; hsize_t file_size; - int *points, *check, *p1, *p2; - hid_t dset1=-1, space1=-1; - hsize_t dims1[2]; - int i, j, n; + int *points, *check, *p1, *p2; + hid_t dset1=-1, space1=-1; + hsize_t dims1[2]; + int i, j, n; TESTING("CORE file driver"); @@ -433,8 +433,8 @@ test_core(void) /* Initialize the dset1 */ p1 = points; for(i = n = 0; i < DSET1_DIM1; i++) - for(j = 0; j < DSET1_DIM2; j++) - *p1++ = n++; + for(j = 0; j < DSET1_DIM2; j++) + *p1++ = n++; /* Create the data space1 */ dims1[0] = DSET1_DIM1; @@ -464,13 +464,13 @@ test_core(void) p1 = points; p2 = check; for(i = 0; i < DSET1_DIM1; i++) - for(j = 0; j < DSET1_DIM2; j++) - if(*p1++ != *p2++) { - H5_FAILED(); - printf(" Read different values than written in data set 1.\n"); - printf(" At index %d,%d\n", i, j); - TEST_ERROR; - } /* end if */ + for(j = 0; j < DSET1_DIM2; j++) + if(*p1++ != *p2++) { + H5_FAILED(); + printf(" Read different values than written in data set 1.\n"); + printf(" At index %d,%d\n", i, j); + TEST_ERROR; + } /* end if */ if(H5Dclose(dset1) < 0) TEST_ERROR; @@ -502,7 +502,7 @@ test_core(void) /* Reallocate memory for reading buffer. */ if(check) - free(check); + free(check); check = (int*)malloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)); @@ -514,13 +514,13 @@ test_core(void) p1 = points; p2 = check; for(i = 0; i < DSET1_DIM1; i++) - for(j = 0; j < DSET1_DIM2; j++) - if(*p1++ != *p2++) { - H5_FAILED(); - printf(" Read different values than written in data set 1.\n"); - printf(" At index %d,%d\n", i, j); - TEST_ERROR; - } /* end if */ + for(j = 0; j < DSET1_DIM2; j++) + if(*p1++ != *p2++) { + H5_FAILED(); + printf(" Read different values than written in data set 1.\n"); + printf(" At index %d,%d\n", i, j); + TEST_ERROR; + } /* end if */ /* Check file size API */ if(H5Fget_filesize(file, &file_size) < 0) @@ -538,9 +538,9 @@ test_core(void) if(H5Fclose(file) < 0) TEST_ERROR; if(points) - free(points); + free(points); if(check) - free(check); + free(check); h5_cleanup(FILENAME, fapl); @@ -1397,7 +1397,6 @@ test_stdio(void) FILE *fhandle = NULL; hsize_t file_size = 0; - TESTING("STDIO file driver"); /* Set property list and file name for STDIO driver. */ @@ -1470,7 +1469,7 @@ error: static herr_t test_windows(void) { -#ifdef _WIN32 +#ifdef H5_HAVE_WINDOWS hid_t file = -1; hid_t fapl = -1; @@ -1479,16 +1478,16 @@ test_windows(void) int *fhandle = NULL; hsize_t file_size = 0; -#endif /*_WIN32*/ +#endif /*H5_HAVE_WINDOWS*/ TESTING("WINDOWS file driver"); -#ifndef _WIN32 +#ifndef H5_HAVE_WINDOWS SKIPPED(); return 0; -#else /*_WIN32*/ +#else /* H5_HAVE_WINDOWS */ /* Set property list and file name for WINDOWS driver. */ fapl = h5_fileaccess(); @@ -1541,7 +1540,7 @@ error: } H5E_END_TRY; return -1; -#endif /*_WIN32*/ +#endif /* H5_HAVE_WINDOWS */ } @@ -1580,9 +1579,9 @@ main(void) nerrors += test_windows() < 0 ? 1 : 0; if(nerrors) { - printf("***** %d Virtual File Driver TEST%s FAILED! *****\n", - nerrors, nerrors > 1 ? "S" : ""); - return 1; + printf("***** %d Virtual File Driver TEST%s FAILED! *****\n", + nerrors, nerrors > 1 ? "S" : ""); + return 1; } printf("All Virtual File Driver tests passed.\n"); diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c index cfed58b..232f3c1 100755 --- a/tools/h5import/h5import.c +++ b/tools/h5import/h5import.c @@ -25,7 +25,7 @@ /* Name of tool */ #define PROGRAMNAME "h5import" -#ifdef WIN32 +#ifdef H5_HAVE_WIN32_API #define READ_OPEN_FLAGS "rb" #else #define READ_OPEN_FLAGS "r" @@ -309,7 +309,7 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id) const char *err11 = "Error in reading string data.\n"; /*------------------------------------------------------------------------- - * special case for opening binary classes in WIN32 + * special case for opening binary classes in H5_HAVE_WIN32_API * "FP" denotes a floating point binary file, * "IN" denotes a signed integer binary file, * "UIN" denotes an unsigned integer binary file, diff --git a/tools/h5import/h5importtest.c b/tools/h5import/h5importtest.c index 2869236..434cba7 100755 --- a/tools/h5import/h5importtest.c +++ b/tools/h5import/h5importtest.c @@ -16,7 +16,7 @@ #include #include "H5private.h" -#ifdef WIN32 +#ifdef H5_HAVE_WIN32_API #define OPEN_FLAGS "wb" #else #define OPEN_FLAGS "w" diff --git a/windows/src/H5pubconf.h b/windows/src/H5pubconf.h index 7cf5e04..ee1abad 100755 --- a/windows/src/H5pubconf.h +++ b/windows/src/H5pubconf.h @@ -9,6 +9,12 @@ /* Define if the Windows virtual file driver should be compiled */ #define H5_HAVE_WINDOWS 1 +/* Define if on the Windows platform */ +#define H5_HAVE_WIN32_API 1 + +/* Define if using a Windows compiler (i.e. Visual Studio) */ +#define H5_HAVE_VISUAL_STUDIO 1 + /* Define if the Windows virtual file driver should use buffered IO functions */ /* #undef WINDOWS_USE_STDIO */ -- cgit v0.12