vfsck: Fix roken fallout
[openafs.git] / src / vfsck / setup.c
index 70881c1..0039074 100644 (file)
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID
-    ("$Header$");
+#include <roken.h>
+
+#include <ctype.h>
 
-#include <stdio.h>
 #define VICE
 
 #if    defined(AFS_SUN_ENV) || defined(AFS_OSF_ENV)
@@ -36,8 +36,6 @@ extern vfscklogprintf();
 #endif
 
 #define DKTYPENAMES
-#include <sys/param.h>
-#include <sys/time.h>
 
 #ifdef AFS_OSF_ENV
 #include <sys/vnode.h>
@@ -49,13 +47,10 @@ extern vfscklogprintf();
 #include <ufs/dir.h>
 #undef _KERNEL
 #undef _BSD
-#include <stdio.h>
 #else /* AFS_OSF_ENV */
 #ifdef AFS_VFSINCL_ENV
 #include <sys/vnode.h>
 #ifdef   AFS_SUN5_ENV
-#include <stdio.h>
-#include <unistd.h>
 #include <sys/fs/ufs_inode.h>
 #include <sys/fs/ufs_fs.h>
 #define _KERNEL
@@ -69,7 +64,6 @@ extern vfscklogprintf();
 #else /* AFS_VFSINCL_ENV */
 #include <sys/inode.h>
 #ifdef AFS_HPUX_ENV
-#include <ctype.h>
 #define        LONGFILENAMES   1
 #include <sys/sysmacros.h>
 #include <sys/ino.h>
@@ -78,10 +72,7 @@ extern vfscklogprintf();
 #endif /* AFS_VFSINCL_ENV */
 #endif /* AFS_OSF_ENV */
 
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <sys/file.h>
-#include <ctype.h>
 #ifdef AFS_SUN5_ENV
 #include <sys/mntent.h>
 #include <sys/vfstab.h>
@@ -99,7 +90,7 @@ struct bufarea *pbp;
 /*
  * The size of a cylinder group is calculated by CGSIZE. The maximum size
  * is limited by the fact that cylinder groups are at most one block.
- * Its size is derived from the size of the maps maintained in the 
+ * Its size is derived from the size of the maps maintained in the
  * cylinder group and the (struct cg) size.
  */
 #define CGSIZE(fs) \
@@ -109,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)
@@ -129,9 +119,6 @@ setup(dev)
     mlk_pbp = 0;
     pbp = 0;
     mlk_startinum = 0;
-#ifdef AFS_DEC_ENV
-    iscorrupt = 0;
-#endif
 #if defined(ACLS) && defined(AFS_HPUX_ENV)
     n_cont = 0;
 #endif
@@ -209,7 +196,7 @@ setup(dev)
      * The rules are:
      *      1) if nflag is set, it's pretty safe to fsck the target dev
      *      2) if the target device is a swap, exit
-     *      3) if hotroot is set, and "-F" is not specified prompt the 
+     *      3) if hotroot is set, and "-F" is not specified prompt the
      *              user and wait for reply
      *      4) if the target is a mounted file system, and "-F" is not
      *              specified, prompt the user and wait for reply
@@ -359,17 +346,6 @@ setup(dev)
            sbdirty();
        }
     }
-#ifdef AFS_DEC_ENV
-    /*
-     * If '-p' is used and the partition was cleanly unmounted last time then skip the
-     * fscking process
-     */
-    if (only_when_needed && (sblock.fs_clean == FS_CLEAN)
-       && clean_byte_valid(sblock.fs_lastfsck)) {
-       msgprintf("%s: umounted cleanly\n", dev);
-       return (FS_CLEAN);
-    }
-#endif
 #ifdef AFS_HPUX_ENV
     /*
      * Do we need to continue ?
@@ -731,13 +707,6 @@ readsb(listerr)
     memcpy((char *)altsblock.fs_sparecon, (char *)sblock.fs_sparecon,
           sizeof sblock.fs_sparecon);
 #endif
-#if defined(AFS_DEC_ENV)
-    memcpy((char *)altsblock.fs_extra, (char *)sblock.fs_extra,
-          sizeof sblock.fs_extra);
-    altsblock.fs_deftimer = sblock.fs_deftimer;
-    altsblock.fs_lastfsck = sblock.fs_lastfsck;
-    altsblock.fs_gennum = sblock.fs_gennum;
-#endif
     /*
      * The following should not have to be copied.
      */
@@ -761,7 +730,7 @@ readsb(listerr)
        if (memcmp
            ((char *)&sblock.fs_blank[0], (char *)&altsblock.fs_blank[0],
             MAXCSBUFS * sizeof(int))) {
-           memset((char *)sblock.fs_blank, 0, sizeof(sblock.fs_blank));
+           memset(sblock.fs_blank, 0, sizeof(sblock.fs_blank));
        } else {
 #endif /* __alpha */
            badsb(listerr,
@@ -796,32 +765,11 @@ badsb(listerr, s)
 calcsb(dev, devfd, fs)
      char *dev;
      int devfd;
-     register struct fs *fs;
+     struct fs *fs;
 {
     return 0;
 }
 
-#ifdef AFS_DEC_ENV
-clean_byte_valid(lastfsck)
-     time_t lastfsck;
-{
-    time_t now;
-    int delta;
-
-    time(&now);
-    if ((!sblock.fs_deftimer) || (!sblock.fs_lastfsck) || (lastfsck > now)) {
-       sblock.fs_deftimer = 0;
-       return (0);
-    }
-    if (!sblock.fs_cleantimer)
-       return (0);
-    delta = (now - lastfsck) / 86400;
-    if (delta > 60)
-       return (0);
-    return (1);
-}
-#endif
-
 #include <sys/ustat.h>
 #ifdef AFS_HPUX_ENV
 #include <sys/pstat.h>
@@ -875,7 +823,7 @@ is_swap(devno)
      dev_t devno;
 {
     struct pst_swapinfo pst[PS_BURST];
-    register struct pst_swapinfo *psp = &pst[0];
+    struct pst_swapinfo *psp = &pst[0];
     int idx = 0, count, match = 0;
 
     while ((count = PSTAT(psp, PS_BURST, idx) != 0)) {
@@ -972,8 +920,8 @@ getline(fp, loc, maxlen)
      FILE *fp;
      char *loc;
 {
-    register n;
-    register char *p, *lastloc;
+    int n;
+    char *p, *lastloc;
 
     p = loc;
     lastloc = &p[maxlen - 1];
@@ -1009,7 +957,7 @@ freply(s)
 
 #if   defined(AFS_HPUX110_ENV)
 /*
- *  Refer to function compare_sblocks() in HP's fsck.c 
+ *  Refer to function compare_sblocks() in HP's fsck.c
  *
  *  DESCRIPTION:
  *     This routine will compare the primary superblock (PRIM_SBLOCK) to the