Author: mckusick
Date: Thu Feb  8 23:14:24 2018
New Revision: 329052
URL: https://svnweb.freebsd.org/changeset/base/329052

Log:
  Include files missed in 329051.

Modified:
  head/sbin/fsck_ffs/fsck.h
  head/sbin/fsck_ffs/globs.c
  head/sbin/fsck_ffs/main.c

Modified: head/sbin/fsck_ffs/fsck.h
==============================================================================
--- head/sbin/fsck_ffs/fsck.h   Thu Feb  8 23:06:58 2018        (r329051)
+++ head/sbin/fsck_ffs/fsck.h   Thu Feb  8 23:14:24 2018        (r329052)
@@ -315,6 +315,7 @@ extern int  Zflag;                  /* zero empty data 
blocks */
 extern int     inoopt;                 /* trim out unused inodes */
 extern char    ckclean;                /* only do work if not cleanly 
unmounted */
 extern int     cvtlevel;               /* convert to newer file system format 
*/
+extern int     ckhashadd;              /* check hashes to be added */
 extern int     bkgrdcheck;             /* determine if background check is 
possible */
 extern int     bkgrdsumadj;            /* whether the kernel have ability to 
adjust superblock summary */
 extern char    usedsoftdep;            /* just fix soft dependency 
inconsistencies */

Modified: head/sbin/fsck_ffs/globs.c
==============================================================================
--- head/sbin/fsck_ffs/globs.c  Thu Feb  8 23:06:58 2018        (r329051)
+++ head/sbin/fsck_ffs/globs.c  Thu Feb  8 23:14:24 2018        (r329052)
@@ -87,6 +87,7 @@ int   Zflag;                  /* zero empty data blocks */
 int    inoopt;                 /* trim out unused inodes */
 char   ckclean;                /* only do work if not cleanly unmounted */
 int    cvtlevel;               /* convert to newer file system format */
+int    ckhashadd;              /* check hashes to be added */
 int    bkgrdcheck;             /* determine if background check is possible */
 int    bkgrdsumadj;            /* whether the kernel have ability to adjust 
superblock summary */
 char   usedsoftdep;            /* just fix soft dependency inconsistencies */

Modified: head/sbin/fsck_ffs/main.c
==============================================================================
--- head/sbin/fsck_ffs/main.c   Thu Feb  8 23:06:58 2018        (r329051)
+++ head/sbin/fsck_ffs/main.c   Thu Feb  8 23:14:24 2018        (r329052)
@@ -43,6 +43,7 @@ static char sccsid[] = "@(#)main.c    8.6 (Berkeley) 5/14
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#define        IN_RTLD                 /* So we pickup the P_OSREL defines */
 #include <sys/param.h>
 #include <sys/file.h>
 #include <sys/mount.h>
@@ -440,7 +441,46 @@ checkfilesys(char *filesys)
                flush(fswritefd, &sblk);
                fsmodified = ofsmodified;
        }
-
+       /*
+        * If the filesystem was run on an old kernel that did not
+        * support check hashes, clear the check-hash flags so that
+        * we do not try to verify them.
+        */
+       if ((sblock.fs_flags & FS_METACKHASH) == 0)
+               sblock.fs_metackhash = 0;
+       /*
+        * If we are running on a kernel that can provide check hashes
+        * that are not yet enabled for the filesystem and we are
+        * running manually without the -y flag, offer to add any
+        * supported check hashes that are not already enabled.
+        */
+       ckhashadd = 0;
+       if (preen == 0 && yflag == 0 && sblock.fs_magic != FS_UFS1_MAGIC &&
+           fswritefd != -1 && getosreldate() >= P_OSREL_CK_CYLGRP) {
+               if ((sblock.fs_metackhash & CK_CYLGRP) == 0 &&
+                   reply("ADD CYLINDER GROUP CHECK-HASH PROTECTION") != 0)
+                       ckhashadd |= CK_CYLGRP;
+#ifdef notyet
+               if ((sblock.fs_metackhash & CK_SUPERBLOCK) == 0 &&
+                   getosreldate() >= P_OSREL_CK_SUPERBLOCK &&
+                   reply("ADD SUPERBLOCK CHECK-HASH PROTECTION") != 0)
+                       ckhashadd |= CK_SUPERBLOCK;
+               if ((sblock.fs_metackhash & CK_INODE) == 0 &&
+                   getosreldate() >= P_OSREL_CK_INODE &&
+                   reply("ADD INODE CHECK-HASH PROTECTION") != 0)
+                       ckhashadd |= CK_INODE;
+               if ((sblock.fs_metackhash & CK_INDIR) == 0 &&
+                   getosreldate() >= P_OSREL_CK_INDIR &&
+                   reply("ADD INDIRECT BLOCK CHECK-HASH PROTECTION") != 0)
+                       ckhashadd |= CK_INDIR;
+               if ((sblock.fs_metackhash & CK_DIR) == 0 &&
+                   getosreldate() >= P_OSREL_CK_DIR &&
+                   reply("ADD DIRECTORY CHECK-HASH PROTECTION") != 0)
+                       ckhashadd |= CK_DIR;
+#endif /* notyet */
+               if (ckhashadd != 0)
+                       sblock.fs_flags |= FS_METACKHASH;
+       }
        /*
         * Cleared if any questions answered no. Used to decide if
         * the superblock should be marked clean.
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to