From: Andrew Deason Date: Wed, 13 Apr 2011 17:15:12 +0000 (-0500) Subject: vfsck: Fix roken fallout X-Git-Tag: openafs-devel-1_7_1~610 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=f26f7ed22629556d4f0035fbe4d25d9804305da1 vfsck: Fix roken fallout Including roken.h in vfsck sources pulls in some more modern headers that vfsck code isn't used to. Accommodate: - Prevent roken.h from pulling in dirent.h so we don't conflict with the old-style directory defines for HP-UX. Also move the inclusion of the old-style directory defines to before roken.h, so we have the directory types defined in roken.h. - Remove some prototypes so the don't conflict with the prototypes in system headers. - Remove a couple of bizarre vprintf invocations, as they conflict with the actual vprintf definitions. Change-Id: Ifd7cd2544e75ed49b93ab491c4acadcb18528315 Reviewed-on: http://gerrit.openafs.org/4472 Reviewed-by: Simon Wilkinson Tested-by: BuildBot Tested-by: Andrew Deason Reviewed-by: Derrick Brashear --- diff --git a/src/vfsck/dir.c b/src/vfsck/dir.c index de56cf8..fb65744 100644 --- a/src/vfsck/dir.c +++ b/src/vfsck/dir.c @@ -18,6 +18,22 @@ #include #include +#ifdef AFS_HPUX_ENV +/* We need the old directory type headers (included below), so don't include + * the normal dirent.h, or it will conflict. */ +# undef HAVE_DIRENT_H +# include +# define LONGFILENAMES 1 +# include +# include +# define DIRSIZ_MACRO +# ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H +# include +# else +# include +# endif +#endif + #include #include @@ -54,17 +70,7 @@ #else /* AFS_VFSINCL_ENV */ #include -#ifdef AFS_HPUX_ENV -#define LONGFILENAMES 1 -#include -#include -#define DIRSIZ_MACRO -#ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H -#include -#else -#include -#endif -#else +#ifndef AFS_HPUX_ENV #define KERNEL #include #undef KERNEL diff --git a/src/vfsck/inode.c b/src/vfsck/inode.c index 6e74b19..576695b 100644 --- a/src/vfsck/inode.c +++ b/src/vfsck/inode.c @@ -18,6 +18,22 @@ #include #include +#ifdef AFS_HPUX_ENV +/* We need the old directory type headers (included below), so don't include + * the normal dirent.h, or it will conflict. */ +# undef HAVE_DIRENT_H +# include +# define LONGFILENAMES 1 +# include +# include +# define DIRSIZ_MACRO +# ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H +# include +# else +# include +# endif +#endif + #include #include @@ -53,17 +69,7 @@ #endif #else /* AFS_VFSINCL_ENV */ #include -#ifdef AFS_HPUX_ENV -#define LONGFILENAMES 1 -#include -#include -#define DIRSIZ_MACRO -#ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H -#include -#else -#include -#endif -#else +#ifndef AFS_HPUX_ENV #include #endif #include diff --git a/src/vfsck/main.c b/src/vfsck/main.c index 130abeb..ad14eee 100644 --- a/src/vfsck/main.c +++ b/src/vfsck/main.c @@ -18,6 +18,22 @@ #include #include +#ifdef AFS_HPUX_ENV +/* We need the old directory type headers (included below), so don't include + * the normal dirent.h, or it will conflict. */ +# undef HAVE_DIRENT_H +# include +# define LONGFILENAMES 1 +# include +# include +# define DIRSIZ_MACRO +# ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H +# include +# else +# include +# endif +#endif + #include #include @@ -62,17 +78,7 @@ #else /* AFS_VFSINCL_ENV */ #include -#ifdef AFS_HPUX_ENV -#define LONGFILENAMES 1 -#include -#include -#define DIRSIZ_MACRO -#ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H -#include -#else -#include -#endif -#else +#ifndef AFS_HPUX_ENV #define KERNEL #include #undef KERNEL @@ -97,7 +103,7 @@ #include "fsck.h" #include -char *rawname(), *unrawname(), *blockcheck(), *malloc(); +char *rawname(), *unrawname(), *blockcheck(); void catch(), catchquit(), voidquit(); static int tryForce; int returntosingle; diff --git a/src/vfsck/pass2.c b/src/vfsck/pass2.c index 402fa9c..472915a 100644 --- a/src/vfsck/pass2.c +++ b/src/vfsck/pass2.c @@ -18,6 +18,22 @@ #include #include +#ifdef AFS_HPUX_ENV +/* We need the old directory type headers (included below), so don't include + * the normal dirent.h, or it will conflict. */ +# undef HAVE_DIRENT_H +# include +# define LONGFILENAMES 1 +# include +# include +# define DIRSIZ_MACRO +# ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H +# include +# else +# include +# endif +#endif + #include #include @@ -50,17 +66,7 @@ #endif #else /* AFS_VFSINCL_ENV */ #include -#ifdef AFS_HPUX_ENV -#define LONGFILENAMES 1 -#include -#include -#define DIRSIZ_MACRO -#ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H -#include -#else -#include -#endif -#else +#ifndef AFS_HPUX_ENV #include #endif #include diff --git a/src/vfsck/pass3.c b/src/vfsck/pass3.c index 92a9513..655deb4 100644 --- a/src/vfsck/pass3.c +++ b/src/vfsck/pass3.c @@ -88,11 +88,7 @@ pass3() || ((statemap[dp->di_contin] & STATE) != CSTATE)) { /* this is an error which must be cleared by hand. */ pfatal("BAD CONTINUATION INODE NUMBER "); -#ifdef VICE - vprintf(" I=%u ", inumber); -#else printf(" I=%u ", inumber); -#endif /* VICE */ if (reply("CLEAR") == 1) { dp->di_contin = 0; inodirty(); diff --git a/src/vfsck/pass4.c b/src/vfsck/pass4.c index f4edf81..fd7d519 100644 --- a/src/vfsck/pass4.c +++ b/src/vfsck/pass4.c @@ -141,11 +141,7 @@ pass4() pwarn("I=%u (%ld should be %ld)", inumber, dp->di_nlink, 1); if (preen) -#ifdef VICE - vprintf(" (CORRECTED)\n"); -#else printf(" (CORRECTED)\n"); -#endif /* VICE */ else { if (reply("CORRECT") == 0) continue; diff --git a/src/vfsck/setup.c b/src/vfsck/setup.c index 49cbd5c..0039074 100644 --- a/src/vfsck/setup.c +++ b/src/vfsck/setup.c @@ -100,7 +100,6 @@ struct bufarea *pbp; /* inode map */ howmany((fs)->fs_ipg, NBBY) + \ /* block map */ howmany((fs)->fs_cpg * (fs)->fs_spc / NSPF(fs), NBBY)) -char *malloc(), *calloc(); struct disklabel *getdisklabel(); setup(dev) diff --git a/src/vfsck/utilities.c b/src/vfsck/utilities.c index 67f7cd4..353f532 100644 --- a/src/vfsck/utilities.c +++ b/src/vfsck/utilities.c @@ -18,6 +18,23 @@ #include #include +#ifdef AFS_HPUX_ENV +/* We need the old directory type headers (included below), so don't include + * the normal dirent.h, or it will conflict. */ +# undef HAVE_DIRENT_H +# include +# define LONGFILENAMES 1 +# include +# include +# include +# define DIRSIZ_MACRO +# ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H +# include +# else +# include +# endif +#endif + #include #include @@ -51,18 +68,7 @@ #endif #else /* AFS_VFSINCL_ENV */ #include -#ifdef AFS_HPUX_ENV -#define LONGFILENAMES 1 -#include -#include -#include -#define DIRSIZ_MACRO -#ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H -#include -#else -#include -#endif -#else +#ifndef AFS_HPUX_ENV #include #endif #include @@ -81,7 +87,6 @@ long diskreads, totalreads; /* Disk cache statistics */ #if !defined(AFS_HPUX101_ENV) long lseek(); #endif -char *malloc(); #if defined(AFS_SUN_ENV) extern int iscorrupt; #endif diff --git a/src/vfsck/vprintf.c b/src/vfsck/vprintf.c index b266736..f339f09 100644 --- a/src/vfsck/vprintf.c +++ b/src/vfsck/vprintf.c @@ -13,6 +13,22 @@ #include #include +#ifdef AFS_HPUX_ENV +/* We need the old directory type headers (included below), so don't include + * the normal dirent.h, or it will conflict. */ +# undef HAVE_DIRENT_H +# include +# define LONGFILENAMES 1 +# include +# include +# define DIRSIZ_MACRO +# ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H +# include +# else +# include +# endif +#endif + #include #include @@ -60,17 +76,7 @@ #else /* AFS_VFSINCL_ENV */ #include -#ifdef AFS_HPUX_ENV -#define LONGFILENAMES 1 -#include -#include -#define DIRSIZ_MACRO -#ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H -#include -#else -#include -#endif -#else +#ifndef AFS_HPUX_ENV #define KERNEL #include #undef KERNEL