Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/fsck_ffs commit fix from pr bin/15449



details:   https://anonhg.NetBSD.org/src/rev/02d3ae0932a1
branches:  trunk
changeset: 533456:02d3ae0932a1
user:      dbj <dbj%NetBSD.org@localhost>
date:      Sun Jun 30 22:57:30 2002 +0000

description:
commit fix from pr bin/15449
this fixes FS_42POSTBLFMT compatibility

diffstat:

 sbin/fsck_ffs/pass5.c |  14 +++++++++++---
 sbin/fsck_ffs/setup.c |  18 ++++++++++++------
 2 files changed, 23 insertions(+), 9 deletions(-)

diffs (104 lines):

diff -r 72c719bd9a59 -r 02d3ae0932a1 sbin/fsck_ffs/pass5.c
--- a/sbin/fsck_ffs/pass5.c     Sun Jun 30 22:40:32 2002 +0000
+++ b/sbin/fsck_ffs/pass5.c     Sun Jun 30 22:57:30 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pass5.c,v 1.29 2002/05/06 03:17:43 lukem Exp $ */
+/*     $NetBSD: pass5.c,v 1.30 2002/06/30 22:57:30 dbj Exp $   */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)pass5.c    8.9 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: pass5.c,v 1.29 2002/05/06 03:17:43 lukem Exp $");
+__RCSID("$NetBSD: pass5.c,v 1.30 2002/06/30 22:57:30 dbj Exp $");
 #endif
 #endif /* not lint */
 
@@ -64,6 +64,7 @@
 pass5()
 {
        int c, blk, frags, basesize, sumsize, mapsize, savednrpos = 0;
+       int32_t savednpsect, savedinterleave;
        int inomapsize, blkmapsize;
        struct fs *fs = sblock;
        ufs_daddr_t dbase, dmax;
@@ -136,7 +137,11 @@
                inomapsize = &ocg->cg_free[0] - (u_char *)&ocg->cg_iused[0];
                ocg->cg_magic = CG_MAGIC;
                savednrpos = fs->fs_nrpos;
+               savednpsect = fs->fs_npsect;
+               savedinterleave = fs->fs_interleave;
                fs->fs_nrpos = 8;
+               fs->fs_npsect = fs->fs_nsect;
+               fs->fs_interleave = 1;
                break;
 
        case FS_DYNAMICPOSTBLFMT:
@@ -416,8 +421,11 @@
                         cgdirty();
                 }
        }
-       if (fs->fs_postblformat == FS_42POSTBLFMT)
+       if (fs->fs_postblformat == FS_42POSTBLFMT) {
                fs->fs_nrpos = savednrpos;
+               fs->fs_npsect = savednpsect;
+               fs->fs_interleave = savedinterleave;
+       }
        if (memcmp(&cstotal, &fs->fs_cstotal, sizeof *cs) != 0) {
                if (dofix(&idesc[0], "FREE BLK COUNT(S) WRONG IN SUPERBLK")) {
                        memmove(&fs->fs_cstotal, &cstotal, sizeof *cs);
diff -r 72c719bd9a59 -r 02d3ae0932a1 sbin/fsck_ffs/setup.c
--- a/sbin/fsck_ffs/setup.c     Sun Jun 30 22:40:32 2002 +0000
+++ b/sbin/fsck_ffs/setup.c     Sun Jun 30 22:57:30 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: setup.c,v 1.52 2001/12/19 10:05:20 fvdl Exp $  */
+/*     $NetBSD: setup.c,v 1.53 2002/06/30 22:57:31 dbj Exp $   */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)setup.c    8.10 (Berkeley) 5/9/95";
 #else
-__RCSID("$NetBSD: setup.c,v 1.52 2001/12/19 10:05:20 fvdl Exp $");
+__RCSID("$NetBSD: setup.c,v 1.53 2002/06/30 22:57:31 dbj Exp $");
 #endif
 #endif /* not lint */
 
@@ -199,8 +199,9 @@
                        sbdirty();
                }
        }
-       if (sblock->fs_interleave < 1 || 
-           sblock->fs_interleave > sblock->fs_nsect) {
+       if (sblock->fs_postblformat != FS_42POSTBLFMT &&
+           (sblock->fs_interleave < 1 || 
+           sblock->fs_interleave > sblock->fs_nsect)) {
                pwarn("IMPOSSIBLE INTERLEAVE=%d IN SUPERBLOCK",
                        sblock->fs_interleave);
                sblock->fs_interleave = 1;
@@ -211,8 +212,9 @@
                        dirty(&asblk);
                }
        }
-       if (sblock->fs_npsect < sblock->fs_nsect || 
-           sblock->fs_npsect > sblock->fs_nsect*2) {
+       if (sblock->fs_postblformat != FS_42POSTBLFMT &&
+           (sblock->fs_npsect < sblock->fs_nsect || 
+           sblock->fs_npsect > sblock->fs_nsect*2)) {
                pwarn("IMPOSSIBLE NPSECT=%d IN SUPERBLOCK",
                        sblock->fs_npsect);
                sblock->fs_npsect = sblock->fs_nsect;
@@ -324,6 +326,10 @@
                doinglevel1++;
                sblock->fs_postblformat = FS_DYNAMICPOSTBLFMT;
                sblock->fs_nrpos = 8;
+               if (sblock->fs_npsect < sblock->fs_nsect)
+                       sblock->fs_npsect = sblock->fs_nsect;
+               if (sblock->fs_interleave < 1)
+                       sblock->fs_interleave = 1;
                sblock->fs_postbloff =
                    (char *)(&sblock->fs_opostbl[0][0]) -
                    (char *)(&sblock->fs_firstfield);



Home | Main Index | Thread Index | Old Index