From 8b082c05ba769ef8eee840985ebac290022cc0ba Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sat, 5 Mar 2011 14:25:34 -0500 Subject: [PATCH] vol: consolide afs_xxxx macros in ihandle.h Various definitions of afs_open, afs_stat, etc. were scattered across the .c sources within the vol package. Consolidate them all in ihandle.h which is included in all of the files and contains the OS_xxxx macros which will substitute for many afs_xxxx calls in future patchsets. Change-Id: I72363332fd5f1d330e225df51c68d4c113b59f3b Reviewed-on: http://gerrit.openafs.org/4147 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/tviced/serialize_state.c | 30 --------------------- src/tviced/state_analyzer.c | 27 ------------------- src/venus/afsio.c | 9 ------- src/viced/afsfileprocs.c | 11 -------- src/viced/viced.c | 12 --------- src/vol/ihandle.c | 10 ------- src/vol/ihandle.h | 51 ++++++++++++++++++++++++++++++++++++ src/vol/listinodes.c | 22 ---------------- src/vol/namei_ops.c | 16 ----------- src/vol/nuke.c | 6 ----- src/vol/partition.c | 36 ------------------------- src/vol/vg_scan.c | 6 ----- src/vol/vol-info.c | 10 ------- src/vol/vol-salvage.c | 22 ---------------- src/vol/volume.c | 10 ------- src/volser/vol-dump.c | 10 ------- 16 files changed, 51 insertions(+), 237 deletions(-) diff --git a/src/tviced/serialize_state.c b/src/tviced/serialize_state.c index 6b2dbff2c..b2b30117a 100644 --- a/src/tviced/serialize_state.c +++ b/src/tviced/serialize_state.c @@ -57,36 +57,6 @@ #include "../viced/callback.h" #include "serialize_state.h" -/*@+fcnmacros +macrofcndecl@*/ -#ifdef O_LARGEFILE -#ifdef S_SPLINT_S -extern off64_t afs_lseek(int FD, off64_t O, int F); -#endif /*S_SPLINT_S */ -#define afs_lseek(FD, O, F) lseek64(FD, (off64_t)(O), F) -#define afs_stat stat64 -#define afs_fstat fstat64 -#define afs_open open64 -#define afs_fopen fopen64 -#define afs_ftruncate ftruncate64 -#define afs_mmap mmap64 -#ifdef AFS_AIX_ENV -extern void * mmap64(); /* ugly hack since aix build env appears to be somewhat broken */ -#endif -#else /* !O_LARGEFILE */ -#ifdef S_SPLINT_S -extern off_t afs_lseek(int FD, off_t O, int F); -#endif /*S_SPLINT_S */ -#define afs_lseek(FD, O, F) lseek(FD, (off_t)(O), F) -#define afs_stat stat -#define afs_fstat fstat -#define afs_open open -#define afs_fopen fopen -#define afs_ftruncate ftruncate -#define afs_mmap mmap -#endif /* !O_LARGEFILE */ -/*@=fcnmacros =macrofcndecl@*/ - - #ifdef AFS_DEMAND_ATTACH_FS /* diff --git a/src/tviced/state_analyzer.c b/src/tviced/state_analyzer.c index 05dcb3160..2185013b3 100644 --- a/src/tviced/state_analyzer.c +++ b/src/tviced/state_analyzer.c @@ -60,33 +60,6 @@ #include #include -/*@+fcnmacros +macrofcndecl@*/ -#ifdef O_LARGEFILE -#ifdef S_SPLINT_S -extern off64_t afs_lseek(int FD, off64_t O, int F); -#endif /*S_SPLINT_S */ -#define afs_lseek(FD, O, F) lseek64(FD, (off64_t)(O), F) -#define afs_stat stat64 -#define afs_fstat fstat64 -#define afs_open open64 -#define afs_fopen fopen64 -#define afs_mmap mmap64 -#ifdef AFS_AIX_ENV -extern void * mmap64(); /* ugly hack since aix build env appears to be somewhat broken */ -#endif -#else /* !O_LARGEFILE */ -#ifdef S_SPLINT_S -extern off_t afs_lseek(int FD, off_t O, int F); -#endif /*S_SPLINT_S */ -#define afs_lseek(FD, O, F) lseek(FD, (off_t)(O), F) -#define afs_stat stat -#define afs_fstat fstat -#define afs_open open -#define afs_fopen fopen -#define afs_mmap mmap -#endif /* !O_LARGEFILE */ -/*@=fcnmacros =macrofcndecl@*/ - #ifndef AFS_DEMAND_ATTACH_FS int diff --git a/src/venus/afsio.c b/src/venus/afsio.c index f0690c60a..2e026492a 100644 --- a/src/venus/afsio.c +++ b/src/venus/afsio.c @@ -104,15 +104,6 @@ #include #include -#ifdef O_LARGEFILE -#define afs_stat stat64 -#define afs_fstat fstat64 -#define afs_open open64 -#else /* !O_LARGEFILE */ -#define afs_stat stat -#define afs_fstat fstat -#define afs_open open -#endif /* !O_LARGEFILE */ #ifdef AFS_PTHREAD_ENV #include pthread_key_t uclient_key; diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index 86c740427..9ba8b8814 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -119,17 +119,6 @@ extern void FidZero(DirHandle * file); pthread_mutex_t fileproc_glock_mutex; #endif /* AFS_PTHREAD_ENV */ -#ifdef O_LARGEFILE -#define afs_stat stat64 -#define afs_fstat fstat64 -#define afs_open open64 -#else /* !O_LARGEFILE */ -#define afs_stat stat -#define afs_fstat fstat -#define afs_open open -#endif /* !O_LARGEFILE */ - - /* Useful local defines used by this module */ #define DONTCHECK 0 diff --git a/src/viced/viced.c b/src/viced/viced.c index 50a259aa5..f2df45c2a 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -94,18 +94,6 @@ #endif #include -#ifdef O_LARGEFILE -#define afs_stat stat64 -#define afs_fstat fstat64 -#define afs_open open64 -#define afs_fopen fopen64 -#else /* !O_LARGEFILE */ -#define afs_stat stat -#define afs_fstat fstat -#define afs_open open -#define afs_fopen fopen -#endif /* !O_LARGEFILE */ - extern int etext; void *ShutDown(void *); diff --git a/src/vol/ihandle.c b/src/vol/ihandle.c index 1bf19589a..287cfc534 100644 --- a/src/vol/ihandle.c +++ b/src/vol/ihandle.c @@ -42,16 +42,6 @@ #include "afs/afs_assert.h" #include -#ifndef AFS_NT40_ENV -#ifdef O_LARGEFILE -#define afs_stat stat64 -#define afs_fstat fstat64 -#else /* !O_LARGEFILE */ -#define afs_stat stat -#define afs_fstat fstat -#endif /* !O_LARGEFILE */ -#endif /* AFS_NT40_ENV */ - #ifdef AFS_PTHREAD_ENV pthread_once_t ih_glock_once = PTHREAD_ONCE_INIT; pthread_mutex_t ih_glock_mutex; diff --git a/src/vol/ihandle.h b/src/vol/ihandle.h index 3f863cd2e..93a101c3a 100644 --- a/src/vol/ihandle.h +++ b/src/vol/ihandle.h @@ -549,4 +549,55 @@ extern afs_sfsize_t ih_size(FD_t); #define FDH_LOCKFILE(H, O) OS_LOCKFILE((H)->fd_fd, O) #define FDH_UNLOCKFILE(H, O) OS_UNLOCKFILE((H)->fd_fd, O) +#ifdef AFS_NT40_ENV +#define afs_stat_st __stat64 +#define afs_stat _stat64 +#define afs_fstat _fstat64 +#define afs_fopen fopen +#define afs_open open +#define afs_lseek(FD, O, F) _lseeki64(FD, O, F) +#else +#ifdef O_LARGEFILE +#define afs_stat_st stat64 +#define afs_stat stat64 +#define afs_fstat fstat64 +#define afs_fopen fopen64 +#define afs_open open64 +#ifdef S_SPLINT_S +extern off64_t afs_lseek(int FD, off64_t O, int F); +#endif /*S_SPLINT_S */ +#define afs_lseek(FD, O, F) lseek64(FD, (off64_t) (O), F) +#define afs_ftruncate ftruncate64 +#define afs_mmap mmap64 +#ifdef AFS_AIX_ENV +extern void * mmap64(); /* ugly hack since aix build env appears to be somewhat broken */ +#endif +#else /* !O_LARGEFILE */ +#define afs_stat_st stat +#define afs_stat stat +#define afs_fstat fstat +#define afs_fopen fopen +#define afs_open open +#ifdef S_SPLINT_S +extern off_t afs_lseek(int FD, off_t O, int F); +#endif /*S_SPLINT_S */ +#define afs_lseek(FD, O, F) lseek(FD, (off_t) (O), F) +#define afs_ftruncate ftruncate +#define afs_mmap mmap +#endif /* !O_LARGEFILE */ +#if AFS_HAVE_STATVFS64 +# define afs_statvfs statvfs64 +#else +# if AFS_HAVE_STATFS64 +# define afs_statfs statfs64 +#else +# if AFS_HAVE_STATVFS +# define afs_statvfs statvfs +# else +# define afs_statfs statfs +# endif /* !AFS_HAVE_STATVFS */ +# endif /* !AFS_HAVE_STATFS64 */ +#endif /* !AFS_HAVE_STATVFS64 */ +#endif /* AFS_NT40_ENV */ + #endif /* _IHANDLE_H_ */ diff --git a/src/vol/listinodes.c b/src/vol/listinodes.c index fd608aa75..d13a2a190 100644 --- a/src/vol/listinodes.c +++ b/src/vol/listinodes.c @@ -112,28 +112,6 @@ ListViceInodes(char *devname, char *mountedOn, FILE *inodeFile, #include "fssync.h" #include "volume_inline.h" -/*@+fcnmacros +macrofcndecl@*/ -#ifdef O_LARGEFILE -#ifdef S_SPLINT_S -extern off64_t afs_lseek(int FD, off64_t O, int F); -#endif /*S_SPLINT_S */ -#define afs_lseek(FD, O, F) lseek64(FD, (off64_t) (O), F) -#define afs_stat stat64 -#define afs_fstat fstat64 -#define afs_open open64 -#define afs_fopen fopen64 -#else /* !O_LARGEFILE */ -#ifdef S_SPLINT_S -extern off_t afs_lseek(int FD, off_t O, int F); -#endif /*S_SPLINT_S */ -#define afs_lseek(FD, O, F) lseek(FD, (off_t) (O), F) -#define afs_stat stat -#define afs_fstat fstat -#define afs_open open -#define afs_fopen fopen -#endif /* !O_LARGEFILE */ -/*@=fcnmacros =macrofcndecl@*/ - /* Notice: parts of this module have been cribbed from vfsck.c */ #define ROOTINODE 2 diff --git a/src/vol/namei_ops.c b/src/vol/namei_ops.c index dc3457d82..8d7585ab7 100644 --- a/src/vol/namei_ops.c +++ b/src/vol/namei_ops.c @@ -58,22 +58,6 @@ #include #endif -/*@+fcnmacros +macrofcndecl@*/ -#ifdef O_LARGEFILE -#ifdef S_SPLINT_S -#endif /*S_SPLINT_S */ -#define afs_stat stat64 -#define afs_fstat fstat64 -#define afs_fopen fopen64 -#else /* !O_LARGEFILE */ -#ifdef S_SPLINT_S -#endif /*S_SPLINT_S */ -#define afs_stat stat -#define afs_fstat fstat -#define afs_fopen fopen -#endif /* !O_LARGEFILE */ -/*@=fcnmacros =macrofcndecl@*/ - #ifndef LOCK_SH #define LOCK_SH 1 /* shared lock */ #define LOCK_EX 2 /* exclusive lock */ diff --git a/src/vol/nuke.c b/src/vol/nuke.c index 7313c2b78..c430803d2 100644 --- a/src/vol/nuke.c +++ b/src/vol/nuke.c @@ -44,12 +44,6 @@ #include "fssync.h" #include "common.h" -#ifdef O_LARGEFILE -#define afs_stat stat64 -#else /* !O_LARGEFILE */ -#define afs_stat stat -#endif /* !O_LARGEFILE */ - struct Lock localLock; #define MAXATONCE 100 diff --git a/src/vol/partition.c b/src/vol/partition.c index 4ec19b907..f2ca2c5a6 100644 --- a/src/vol/partition.c +++ b/src/vol/partition.c @@ -139,42 +139,6 @@ #include #endif -#ifdef O_LARGEFILE - -#define afs_stat stat64 -#define afs_open open64 -#define afs_fopen fopen64 -#ifndef AFS_NT40_ENV -#if AFS_HAVE_STATVFS64 -# define afs_statvfs statvfs64 -#else -# if AFS_HAVE_STATFS64 -# define afs_statfs statfs64 -#else -# if AFS_HAVE_STATVFS -# define afs_statvfs statvfs -# else -# define afs_statfs statfs -# endif /* !AFS_HAVE_STATVFS */ -# endif /* !AFS_HAVE_STATFS64 */ -#endif /* !AFS_HAVE_STATVFS64 */ -#endif /* !AFS_NT40_ENV */ - -#else /* !O_LARGEFILE */ - -#define afs_stat stat -#define afs_open open -#define afs_fopen fopen -#ifndef AFS_NT40_ENV -#if AFS_HAVE_STATVFS -#define afs_statvfs statvfs -#else /* !AFS_HAVE_STATVFS */ -#define afs_statfs statfs -#endif /* !AFS_HAVE_STATVFS */ -#endif /* !AFS_NT40_ENV */ - -#endif /* !O_LARGEFILE */ - int aixlow_water = 8; /* default 8% */ struct DiskPartition64 *DiskPartitionList; diff --git a/src/vol/vg_scan.c b/src/vol/vg_scan.c index 391f9504a..93a28015d 100644 --- a/src/vol/vg_scan.c +++ b/src/vol/vg_scan.c @@ -55,12 +55,6 @@ #include "vg_cache.h" #include "vg_cache_impl.h" -#ifdef O_LARGEFILE -#define afs_open open64 -#else /* !O_LARGEFILE */ -#define afs_open open -#endif /* !O_LARGEFILE */ - static int _VVGC_scan_table_init(VVGCache_scan_table_t * tbl); static int _VVGC_scan_table_add(VVGCache_scan_table_t * tbl, struct DiskPartition64 * dp, diff --git a/src/vol/vol-info.c b/src/vol/vol-info.c index 667df8395..9a9f08628 100644 --- a/src/vol/vol-info.c +++ b/src/vol/vol-info.c @@ -57,16 +57,6 @@ #include -#ifdef O_LARGEFILE -#define afs_stat stat64 -#define afs_fstat fstat64 -#define afs_open open64 -#else /* !O_LARGEFILE */ -#define afs_stat stat -#define afs_fstat fstat -#define afs_open open -#endif /* !O_LARGEFILE */ - int DumpVnodes = 0; /* Dump everything, i.e. summary of all vnodes */ int DumpInodeNumber = 0; /* Dump inode numbers with vnodes */ int DumpDate = 0; /* Dump vnode date (server modify date) with vnode */ diff --git a/src/vol/vol-salvage.c b/src/vol/vol-salvage.c index 932ef40a7..44a3778d0 100644 --- a/src/vol/vol-salvage.c +++ b/src/vol/vol-salvage.c @@ -204,28 +204,6 @@ Vnodes with 0 inode pointers in RW volumes are now deleted. #include #endif -/*@+fcnmacros +macrofcndecl@*/ -#ifdef O_LARGEFILE -#ifdef S_SPLINT_S -extern off64_t afs_lseek(int FD, off64_t O, int F); -#endif /*S_SPLINT_S */ -#define afs_lseek(FD, O, F) lseek64(FD, (off64_t) (O), F) -#define afs_stat stat64 -#define afs_fstat fstat64 -#define afs_open open64 -#define afs_fopen fopen64 -#else /* !O_LARGEFILE */ -#ifdef S_SPLINT_S -extern off_t afs_lseek(int FD, off_t O, int F); -#endif /*S_SPLINT_S */ -#define afs_lseek(FD, O, F) lseek(FD, (off_t) (O), F) -#define afs_stat stat -#define afs_fstat fstat -#define afs_open open -#define afs_fopen fopen -#endif /* !O_LARGEFILE */ -/*@=fcnmacros =macrofcndecl@*/ - #ifdef AFS_OSF_ENV extern void *calloc(); #endif diff --git a/src/vol/volume.c b/src/vol/volume.c index c34ae4ca7..5fc478759 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -136,16 +136,6 @@ #include #endif -#ifdef O_LARGEFILE -#define afs_stat stat64 -#define afs_fstat fstat64 -#define afs_open open64 -#else /* !O_LARGEFILE */ -#define afs_stat stat -#define afs_fstat fstat -#define afs_open open -#endif /* !O_LARGEFILE */ - #ifdef AFS_PTHREAD_ENV pthread_mutex_t vol_glock_mutex; pthread_mutex_t vol_trans_mutex; diff --git a/src/volser/vol-dump.c b/src/volser/vol-dump.c index 912f0b417..adcdc3e2b 100644 --- a/src/volser/vol-dump.c +++ b/src/volser/vol-dump.c @@ -79,16 +79,6 @@ #define putint32(p, v) *p++ = v>>24, *p++ = v>>16, *p++ = v>>8, *p++ = v #define putshort(p, v) *p++ = v>>8, *p++ = v -#ifdef O_LARGEFILE -#define afs_stat stat64 -#define afs_fstat fstat64 -#define afs_open open64 -#else /* !O_LARGEFILE */ -#define afs_stat stat -#define afs_fstat fstat -#define afs_open open -#endif /* !O_LARGEFILE */ - int VolumeChanged; /* needed by physio - leave alone */ int verbose = 0; -- 2.39.5