mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-04-12 17:31:09 +08:00
[svn-r5205] Purpose:
Code cleanup Description: Platform dependent code related to the struct stat and fstat calls polluted source codes. Hard to maintain. Solution: Platform dependent code are moved to H5private.h and then internal code can #include H5private.h. Repeat those macro definition for the stdio and multi drivers since they area examples for writing a virtual file driver. They must not use any internal code. Platforms tested: eirene (parallel), modi4 (serial including gass driver.)
This commit is contained in:
parent
40117dd384
commit
f5d5e9e2ff
@ -11,6 +11,7 @@
|
||||
/* See H5private.h for how to include headers */
|
||||
#undef NDEBUG
|
||||
#include "hdf5.h"
|
||||
#include "H5private.h"
|
||||
|
||||
#ifdef H5_STDC_HEADERS
|
||||
# include <ctype.h>
|
||||
@ -186,7 +187,7 @@ test(fill_t fill_style, const double splits[],
|
||||
int mdc_nelmts; /*num meta objs to cache*/
|
||||
hsize_t i;
|
||||
int j;
|
||||
struct stat sb;
|
||||
h5_stat_t sb;
|
||||
|
||||
if (!had) had = calloc((size_t)cur_size[0], sizeof(int));
|
||||
if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) goto error;
|
||||
|
@ -412,7 +412,7 @@ pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t si
|
||||
if ((strlen(fullname) + strlen(base_name) + 1) < size) {
|
||||
/* Append the base_name with a slash first. Multiple slashes are
|
||||
* handled below. */
|
||||
struct stat buf;
|
||||
h5_stat_t buf;
|
||||
|
||||
if (stat(fullname, &buf) < 0)
|
||||
/* The directory doesn't exist just yet */
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define PIO_PERF_H__
|
||||
|
||||
#include "pio_timer.h"
|
||||
#include "H5private.h"
|
||||
|
||||
typedef enum iotype_ {
|
||||
RAW,
|
||||
|
@ -4018,6 +4018,7 @@ H5Dset_extent(hid_t dset_id, const hsize_t *size)
|
||||
H5D_t *dset = NULL;
|
||||
|
||||
FUNC_ENTER(H5Dset_extent, FAIL);
|
||||
H5TRACE2("e","i*h",dset_id,size);
|
||||
|
||||
/* Check args */
|
||||
if(H5I_DATASET != H5I_get_type(dset_id)
|
||||
|
@ -332,11 +332,7 @@ H5FD_gass_open(const char *name, unsigned flags, hid_t fapl_id,
|
||||
H5FD_gass_fapl_t _fa;
|
||||
char *filename = (char *) H5MM_malloc(80 * sizeof(char));
|
||||
H5P_genplist_t *plist; /* Property list pointer */
|
||||
#ifdef WIN32
|
||||
struct _stati64 sb;
|
||||
#else
|
||||
struct stat sb;
|
||||
#endif
|
||||
h5_stat_t sb;
|
||||
|
||||
FUNC_ENTER(H5FD_gass_open, NULL);
|
||||
|
||||
|
@ -475,10 +475,8 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id,
|
||||
HFILE filehandle;
|
||||
struct _BY_HANDLE_FILE_INFORMATION fileinfo;
|
||||
int results;
|
||||
struct _stati64 sb;
|
||||
#else
|
||||
struct stat sb;
|
||||
#endif
|
||||
h5_stat_t sb;
|
||||
H5P_genplist_t *plist; /* Property list */
|
||||
|
||||
FUNC_ENTER(H5FD_log_open, NULL);
|
||||
|
@ -273,13 +273,11 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t UNUSED fapl_id,
|
||||
int fd;
|
||||
H5FD_sec2_t *file=NULL;
|
||||
#ifdef WIN32
|
||||
HFILE filehandle;
|
||||
struct _BY_HANDLE_FILE_INFORMATION fileinfo;
|
||||
int results;
|
||||
struct _stati64 sb;
|
||||
#else
|
||||
struct stat sb;
|
||||
HFILE filehandle;
|
||||
struct _BY_HANDLE_FILE_INFORMATION fileinfo;
|
||||
int results;
|
||||
#endif
|
||||
h5_stat_t sb;
|
||||
|
||||
FUNC_ENTER(H5FD_sec2_open, NULL);
|
||||
|
||||
|
@ -562,10 +562,13 @@ __DLL__ int HDfprintf (FILE *stream, const char *fmt, ...);
|
||||
/* fscanf() variable arguments */
|
||||
#define HDfseek(F,O,W) fseek(F,O,W)
|
||||
#define HDfsetpos(F,P) fsetpos(F,P)
|
||||
/* definitions related to the file stat utilities */
|
||||
#ifdef WIN32
|
||||
#define HDfstat(F,B) _fstati64(F,B)
|
||||
typedef struct _stati64 h5_stat_t;
|
||||
#else
|
||||
#define HDfstat(F,B) fstat(F,B)
|
||||
typedef struct stat h5_stat_t;
|
||||
#endif
|
||||
#define HDftell(F) ftell(F)
|
||||
#define HDfwrite(M,Z,N,F) fwrite(M,Z,N,F)
|
||||
|
@ -74,7 +74,7 @@ static int
|
||||
is_sparse(void)
|
||||
{
|
||||
int fd;
|
||||
struct stat sb;
|
||||
h5_stat_t sb;
|
||||
|
||||
if ((fd=open("x.h5", O_RDWR|O_TRUNC|O_CREAT, 0666))<0) return 0;
|
||||
if (lseek(fd, (off_t)(1024*1024), SEEK_SET)!=1024*1024) return 0;
|
||||
|
@ -319,7 +319,7 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
|
||||
if (HDstrlen(fullname) + HDstrlen(base_name) + 1 < size) {
|
||||
/* Append the base_name with a slash first. Multiple slashes are
|
||||
* handled below. */
|
||||
struct stat buf;
|
||||
h5_stat_t buf;
|
||||
|
||||
if (HDstat(fullname, &buf) < 0)
|
||||
/* The directory doesn't exist just yet */
|
||||
|
@ -50,7 +50,7 @@ void pause_proc(void)
|
||||
{
|
||||
|
||||
int pid;
|
||||
struct stat statbuf;
|
||||
h5_stat_t statbuf;
|
||||
char greenlight[] = "go";
|
||||
int maxloop = 10;
|
||||
int loops = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user