Source-Changes-HG archive

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

[src/fvdl-softdep]: src/sbin/fsck_ffs Fix some merge mistakes.



details:   https://anonhg.NetBSD.org/src/rev/e60847668262
branches:  fvdl-softdep
changeset: 477513:e60847668262
user:      fvdl <fvdl%NetBSD.org@localhost>
date:      Tue Oct 26 23:20:11 1999 +0000

description:
Fix some merge mistakes.

diffstat:

 sbin/fsck_ffs/inode.c     |  11 +++++-
 sbin/fsck_ffs/pass5.c     |  71 ++++++++++++++++++++++++++++++----------------
 sbin/fsck_ffs/setup.c     |  10 +++++-
 sbin/fsck_ffs/utilities.c |  10 ++++-
 4 files changed, 69 insertions(+), 33 deletions(-)

diffs (223 lines):

diff -r e68f54ac887b -r e60847668262 sbin/fsck_ffs/inode.c
--- a/sbin/fsck_ffs/inode.c     Tue Oct 26 19:30:04 1999 +0000
+++ b/sbin/fsck_ffs/inode.c     Tue Oct 26 23:20:11 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inode.c,v 1.30.4.1 1999/10/19 13:01:28 fvdl Exp $      */
+/*     $NetBSD: inode.c,v 1.30.4.2 1999/10/26 23:20:11 fvdl Exp $      */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)inode.c    8.8 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: inode.c,v 1.30.4.1 1999/10/19 13:01:28 fvdl Exp $");
+__RCSID("$NetBSD: inode.c,v 1.30.4.2 1999/10/26 23:20:11 fvdl Exp $");
 #endif
 #endif /* not lint */
 
@@ -623,8 +623,13 @@
                return (0);
        cg = ino_to_cg(sblock, ino);
        getblk(&cgblk, cgtod(sblock, cg), sblock->fs_cgsize);
+       memcpy(cgp, cgblk.b_un.b_cg, sblock->fs_cgsize);
+       if ((doswap && !needswap) || (!doswap && needswap))
+               swap_cg(cgblk.b_un.b_cg, cgp);
        if (!cg_chkmagic(cgp, 0))
-               pfatal("CG %d: BAD MAGIC NUMBER\n", cg);
+               pfatal("CG %d: ALLOCINO: BAD MAGIC NUMBER\n", cg);
+       if (doswap)
+               cgdirty();
        setbit(cg_inosused(cgp, 0), ino % sblock->fs_ipg);
        cgp->cg_cs.cs_nifree--;
        switch (type & IFMT) {
diff -r e68f54ac887b -r e60847668262 sbin/fsck_ffs/pass5.c
--- a/sbin/fsck_ffs/pass5.c     Tue Oct 26 19:30:04 1999 +0000
+++ b/sbin/fsck_ffs/pass5.c     Tue Oct 26 23:20:11 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pass5.c,v 1.20.4.2 1999/10/26 19:30:04 fvdl Exp $      */
+/*     $NetBSD: pass5.c,v 1.20.4.3 1999/10/26 23:20:11 fvdl 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.20.4.2 1999/10/26 19:30:04 fvdl Exp $");
+__RCSID("$NetBSD: pass5.c,v 1.20.4.3 1999/10/26 23:20:11 fvdl Exp $");
 #endif
 #endif /* not lint */
 
@@ -68,18 +68,14 @@
        struct fs *fs = sblock;
        ufs_daddr_t dbase, dmax;
        ufs_daddr_t d;
-       long i, j;
+       long i, j, k;
        struct csum *cs;
        struct csum cstotal;
        struct inodesc idesc[3];
        char buf[MAXBSIZE];
        struct cg *newcg = (struct cg *)buf;
        struct ocg *ocg = (struct ocg *)buf;
-       struct cg *cg;
-
-       cg = cgrp = malloc(fs->fs_cgsize);
-       if (cg == NULL)
-               errx(EEXIT, "cannot allocate space for cylinder group");
+       struct cg *cg = cgrp;
 
        statemap[WINO] = USTATE;
        memset(newcg, 0, (size_t)fs->fs_cgsize);
@@ -117,6 +113,11 @@
                                                    doit);
                                        fs->fs_cgsize =
                                            fragroundup(fs, CGSIZE(fs));
+                                       cg = cgrp =
+                                           realloc(cgrp, fs->fs_cgsize);
+                                       if (cg == NULL)
+                                               errx(EEXIT,
+                                               "cannot reallocate cg space");
                                        doinglevel1 = 1;
                                        sbdirty();
                                }
@@ -189,7 +190,7 @@
                if((doswap && !needswap) || (!doswap && needswap))
                        swap_cg(cgblk.b_un.b_cg, cg);
                if (!cg_chkmagic(cg, 0))
-                       pfatal("CG %d: BAD MAGIC NUMBER\n", c);
+                       pfatal("CG %d: PASS5: BAD MAGIC NUMBER\n", c);
                if(doswap)
                        cgdirty();
                dbase = cgbase(fs, c);
@@ -327,20 +328,6 @@
                        cgdirty();
                        continue;
                }
-               if (memcmp(cg_inosused(newcg, 0), cg_inosused(cg, 0), mapsize) != 0) {
-                       if (debug) {
-                               printf("newcg map:\n");
-                               print_bmap(cg_inosused(newcg, 0), mapsize);
-                               printf("\ncg map:\n");
-                               print_bmap(cg_inosused(cg, 0), mapsize);
-                       }
-                   if (dofix(&idesc[1], "BLK(S) MISSING IN BIT MAPS")) {
-                       memmove(cg_inosused(cg, 0), cg_inosused(newcg, 0),
-                             (size_t)mapsize);
-                       cgdirty();
-                       } else
-                               markclean = 0;
-               }
                if (memcmp(newcg, cg, basesize) != 0 ||
                     memcmp(&cg_blktot(newcg, 0)[0],
                                &cg_blktot(cg, 0)[0], sumsize) != 0) {
@@ -349,9 +336,43 @@
                        memmove(&cg_blktot(cg, 0)[0],
                               &cg_blktot(newcg, 0)[0], (size_t)sumsize);
                        cgdirty();
-                       } else markclean = 0;
+                       } else
+                               markclean = 0;
                }
-
+               if (usedsoftdep) {
+                       for (i = 0; i < inomapsize; i++) {
+                               j = cg_inosused(newcg, 0)[i];
+                               if ((cg_inosused(cg, 0)[i] & j) == j)
+                                       continue;
+                               for (k = 0; k < NBBY; k++) {
+                                       if ((j & (1 << k)) == 0)
+                                               continue;
+                                       if (cg_inosused(cg, 0)[i] & (1 << k))
+                                               continue;
+                                       pwarn("ALLOCATED INODE %d MARKED FREE",
+                                           c * fs->fs_ipg + i * 8 + k);
+                               }
+                       }
+                       for (i = 0; i < blkmapsize; i++) {
+                               j = cg_blksfree(cg, 0)[i];
+                               if ((cg_blksfree(newcg, 0)[i] & j) == j)
+                                       continue;
+                               for (k = 0; k < NBBY; k++) {
+                                       if ((j & (1 << k)) == 0)
+                                               continue;
+                                       if (cg_inosused(cg, 0)[i] & (1 << k))
+                                               continue;
+                                       pwarn("ALLOCATED FRAG %d MARKED FREE",
+                                           c * fs->fs_fpg + i * 8 + k);
+                               }
+                       }
+               }
+               if (memcmp(cg_inosused(newcg, 0), cg_inosused(cg, 0), mapsize)
+                   != 0 && dofix(&idesc[1], "BLK(S) MISSING IN BIT MAPS")) {
+                       memmove(cg_inosused(cg, 0), cg_inosused(newcg, 0),
+                           (size_t)mapsize);
+                        cgdirty();
+                }
        }
        if (fs->fs_postblformat == FS_42POSTBLFMT)
                fs->fs_nrpos = savednrpos;
diff -r e68f54ac887b -r e60847668262 sbin/fsck_ffs/setup.c
--- a/sbin/fsck_ffs/setup.c     Tue Oct 26 19:30:04 1999 +0000
+++ b/sbin/fsck_ffs/setup.c     Tue Oct 26 23:20:11 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: setup.c,v 1.36.2.1 1999/10/19 13:01:30 fvdl Exp $      */
+/*     $NetBSD: setup.c,v 1.36.2.2 1999/10/26 23:20:11 fvdl 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.36.2.1 1999/10/19 13:01:30 fvdl Exp $");
+__RCSID("$NetBSD: setup.c,v 1.36.2.2 1999/10/26 23:20:11 fvdl Exp $");
 #endif
 #endif /* not lint */
 
@@ -425,6 +425,12 @@
                    (unsigned)(numdirs * sizeof(struct inoinfo *)));
                goto badsblabel;
        }
+       cgrp = malloc(sblock->fs_cgsize);
+       if (cgrp == NULL) {
+               printf("cannot alloc %u bytes for cylinder group\n",
+                   sblock->fs_cgsize);
+               goto badsblabel;
+       }
        bufinit();
        if (sblock->fs_flags & FS_DOSOFTDEP)
                usedsoftdep = 1;
diff -r e68f54ac887b -r e60847668262 sbin/fsck_ffs/utilities.c
--- a/sbin/fsck_ffs/utilities.c Tue Oct 26 19:30:04 1999 +0000
+++ b/sbin/fsck_ffs/utilities.c Tue Oct 26 23:20:11 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: utilities.c,v 1.25.4.1 1999/10/19 13:01:30 fvdl Exp $  */
+/*     $NetBSD: utilities.c,v 1.25.4.2 1999/10/26 23:20:11 fvdl Exp $  */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)utilities.c        8.6 (Berkeley) 5/19/95";
 #else
-__RCSID("$NetBSD: utilities.c,v 1.25.4.1 1999/10/19 13:01:30 fvdl Exp $");
+__RCSID("$NetBSD: utilities.c,v 1.25.4.2 1999/10/26 23:20:11 fvdl Exp $");
 #endif
 #endif /* not lint */
 
@@ -426,8 +426,12 @@
                        }
                        cg = dtog(sblock, i + j);
                        getblk(&cgblk, cgtod(sblock, cg), sblock->fs_cgsize);
+                       memcpy(cgp, cgblk.b_un.b_cg, sblock->fs_cgsize);
+                       if ((doswap && !needswap) || (!doswap && needswap))
+                               swap_cg(cgblk.b_un.b_cg, cgp);
                        if (!cg_chkmagic(cgp, 0))
-                               pfatal("CG %d: BAD MAGIC NUMBER\n", cg);
+                               pfatal("CG %d: ALLOCBLK: BAD MAGIC NUMBER\n",
+                                   cg);
                        baseblk = dtogd(sblock, i + j);
                        for (k = 0; k < frags; k++) {
                                setbmap(i + j + k);



Home | Main Index | Thread Index | Old Index