vfsck: Fix roken fallout
authorAndrew Deason <adeason@sinenomine.net>
Wed, 13 Apr 2011 17:15:12 +0000 (12:15 -0500)
committerDerrick Brashear <shadow@dementia.org>
Fri, 15 Apr 2011 17:11:15 +0000 (10:11 -0700)
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 <sxw@inf.ed.ac.uk>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/vfsck/dir.c
src/vfsck/inode.c
src/vfsck/main.c
src/vfsck/pass2.c
src/vfsck/pass3.c
src/vfsck/pass4.c
src/vfsck/setup.c
src/vfsck/utilities.c
src/vfsck/vprintf.c

index de56cf8..fb65744 100644 (file)
 #include <afsconfig.h>
 #include <afs/param.h>
 
+#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 <sys/inode.h>
+# define       LONGFILENAMES   1
+# include <sys/sysmacros.h>
+# include <sys/ino.h>
+# define       DIRSIZ_MACRO
+# ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H
+#  include </usr/old/usr/include/ndir.h>
+# else
+#  include <ndir.h>
+# endif
+#endif
+
 #include <roken.h>
 
 #include <ctype.h>
 
 #else /* AFS_VFSINCL_ENV */
 #include <sys/inode.h>
-#ifdef AFS_HPUX_ENV
-#define        LONGFILENAMES   1
-#include <sys/sysmacros.h>
-#include <sys/ino.h>
-#define        DIRSIZ_MACRO
-#ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H
-#include </usr/old/usr/include/ndir.h>
-#else
-#include <ndir.h>
-#endif
-#else
+#ifndef        AFS_HPUX_ENV
 #define KERNEL
 #include <sys/dir.h>
 #undef KERNEL
index 6e74b19..576695b 100644 (file)
 #include <afsconfig.h>
 #include <afs/param.h>
 
+#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 <sys/inode.h>
+# define       LONGFILENAMES   1
+# include <sys/sysmacros.h>
+# include <sys/ino.h>
+# define       DIRSIZ_MACRO
+# ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H
+#  include </usr/old/usr/include/ndir.h>
+# else
+#  include <ndir.h>
+# endif
+#endif
+
 #include <roken.h>
 
 #include <ctype.h>
 #endif
 #else /* AFS_VFSINCL_ENV */
 #include <sys/inode.h>
-#ifdef AFS_HPUX_ENV
-#define        LONGFILENAMES   1
-#include <sys/sysmacros.h>
-#include <sys/ino.h>
-#define        DIRSIZ_MACRO
-#ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H
-#include </usr/old/usr/include/ndir.h>
-#else
-#include <ndir.h>
-#endif
-#else
+#ifndef        AFS_HPUX_ENV
 #include <sys/dir.h>
 #endif
 #include <sys/fs.h>
index 130abeb..ad14eee 100644 (file)
 #include <afsconfig.h>
 #include <afs/param.h>
 
+#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 <sys/inode.h>
+# define       LONGFILENAMES   1
+# include <sys/sysmacros.h>
+# include <sys/ino.h>
+# define       DIRSIZ_MACRO
+# ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H
+#  include </usr/old/usr/include/ndir.h>
+# else
+#  include <ndir.h>
+# endif
+#endif
+
 #include <roken.h>
 
 #include <ctype.h>
 #else /* AFS_VFSINCL_ENV */
 
 #include <sys/inode.h>
-#ifdef AFS_HPUX_ENV
-#define        LONGFILENAMES   1
-#include <sys/sysmacros.h>
-#include <sys/ino.h>
-#define        DIRSIZ_MACRO
-#ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H
-#include </usr/old/usr/include/ndir.h>
-#else
-#include <ndir.h>
-#endif
-#else
+#ifndef        AFS_HPUX_ENV
 #define KERNEL
 #include <sys/dir.h>
 #undef KERNEL
 #include "fsck.h"
 #include <sys/signal.h>
 
-char *rawname(), *unrawname(), *blockcheck(), *malloc();
+char *rawname(), *unrawname(), *blockcheck();
 void catch(), catchquit(), voidquit();
 static int tryForce;
 int returntosingle;
index 402fa9c..472915a 100644 (file)
 #include <afsconfig.h>
 #include <afs/param.h>
 
+#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 <sys/inode.h>
+# define       LONGFILENAMES   1
+# include <sys/sysmacros.h>
+# include <sys/ino.h>
+# define       DIRSIZ_MACRO
+# ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H
+#  include </usr/old/usr/include/ndir.h>
+# else
+#  include <ndir.h>
+# endif
+#endif
+
 #include <roken.h>
 
 #include <ctype.h>
 #endif
 #else /* AFS_VFSINCL_ENV */
 #include <sys/inode.h>
-#ifdef AFS_HPUX_ENV
-#define        LONGFILENAMES   1
-#include <sys/sysmacros.h>
-#include <sys/ino.h>
-#define        DIRSIZ_MACRO
-#ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H
-#include </usr/old/usr/include/ndir.h>
-#else
-#include <ndir.h>
-#endif
-#else
+#ifndef        AFS_HPUX_ENV
 #include <sys/dir.h>
 #endif
 #include <sys/fs.h>
index 92a9513..655deb4 100644 (file)
@@ -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();
index f4edf81..fd7d519 100644 (file)
@@ -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;
index 49cbd5c..0039074 100644 (file)
@@ -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)
index 67f7cd4..353f532 100644 (file)
 #include <afsconfig.h>
 #include <afs/param.h>
 
+#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 <sys/inode.h>
+# define       LONGFILENAMES   1
+# include <sys/sysmacros.h>
+# include <sys/ino.h>
+# include <sys/signal.h>
+# define       DIRSIZ_MACRO
+# ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H
+#  include </usr/old/usr/include/ndir.h>
+# else
+#  include <ndir.h>
+# endif
+#endif
+
 #include <roken.h>
 
 #include <ctype.h>
 #endif
 #else /* AFS_VFSINCL_ENV */
 #include <sys/inode.h>
-#ifdef AFS_HPUX_ENV
-#define        LONGFILENAMES   1
-#include <sys/sysmacros.h>
-#include <sys/ino.h>
-#include <sys/signal.h>
-#define        DIRSIZ_MACRO
-#ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H
-#include </usr/old/usr/include/ndir.h>
-#else
-#include <ndir.h>
-#endif
-#else
+#ifndef        AFS_HPUX_ENV
 #include <sys/dir.h>
 #endif
 #include <sys/fs.h>
@@ -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
index b266736..f339f09 100644 (file)
 #include <afsconfig.h>
 #include <afs/param.h>
 
+#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 <sys/inode.h>
+# define       LONGFILENAMES   1
+# include <sys/sysmacros.h>
+# include <sys/ino.h>
+# define       DIRSIZ_MACRO
+# ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H
+#  include </usr/old/usr/include/ndir.h>
+# else
+#  include <ndir.h>
+# endif
+#endif
+
 #include <roken.h>
 
 #include <ctype.h>
 #else /* AFS_VFSINCL_ENV */
 
 #include <sys/inode.h>
-#ifdef AFS_HPUX_ENV
-#define        LONGFILENAMES   1
-#include <sys/sysmacros.h>
-#include <sys/ino.h>
-#define        DIRSIZ_MACRO
-#ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H
-#include </usr/old/usr/include/ndir.h>
-#else
-#include <ndir.h>
-#endif
-#else
+#ifndef        AFS_HPUX_ENV
 #define KERNEL
 #include <sys/dir.h>
 #undef KERNEL