Source-Changes-HG archive

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

[src/trunk]: src/libexec/lfs_cleanerd Correct my previous lfs_cleanerd commit...



details:   https://anonhg.NetBSD.org/src/rev/6f9000d7d158
branches:  trunk
changeset: 526278:6f9000d7d158
user:      perseant <perseant%NetBSD.org@localhost>
date:      Tue Apr 30 00:28:58 2002 +0000

description:
Correct my previous lfs_cleanerd commit so that it works properly on
v1 filesystems as well (use segtod instead of lfs_ssize / lfs_fsize).

Tested on i386.

diffstat:

 libexec/lfs_cleanerd/library.c |  13 ++++++++-----
 libexec/lfs_cleanerd/print.c   |   8 ++++----
 2 files changed, 12 insertions(+), 9 deletions(-)

diffs (73 lines):

diff -r a0eba08ce83e -r 6f9000d7d158 libexec/lfs_cleanerd/library.c
--- a/libexec/lfs_cleanerd/library.c    Mon Apr 29 23:36:02 2002 +0000
+++ b/libexec/lfs_cleanerd/library.c    Tue Apr 30 00:28:58 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: library.c,v 1.23 2001/07/18 05:46:44 perseant Exp $    */
+/*     $NetBSD: library.c,v 1.24 2002/04/30 00:28:58 perseant Exp $    */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)library.c  8.3 (Berkeley) 5/24/95";
 #else
-__RCSID("$NetBSD: library.c,v 1.23 2001/07/18 05:46:44 perseant Exp $");
+__RCSID("$NetBSD: library.c,v 1.24 2002/04/30 00:28:58 perseant Exp $");
 #endif
 #endif /* not lint */
 
@@ -354,9 +354,12 @@
        i = 0;
        bip = NULL;
        lfsp = &fsp->fi_lfs;
-       nelem = 2 * lfsp->lfs_ssize;
-       if (!(bip = malloc(nelem * sizeof(BLOCK_INFO_15))))
+       nelem = 2 * segtod(lfsp, 1);
+       if (!(bip = malloc(nelem * sizeof(BLOCK_INFO_15)))) {
+               syslog(LOG_DEBUG, "couldn't allocate %d bytes in lfs_segmapv",
+                       nelem * sizeof(BLOCK_INFO_15));
                goto err0;
+       }
 
        sup = SEGUSE_ENTRY(lfsp, fsp->fi_segusep, seg);
        s = seg_buf + (sup->su_flags & SEGUSE_SUPERBLOCK ? LFS_SBPAD : 0);
@@ -624,7 +627,7 @@
         }
 
        if ((nblocks = dump_summary(&fsp->fi_lfs, ssp, 0, NULL, addr)) <= 0 ||
-           nblocks > fsp->fi_lfs.lfs_ssize - 1)
+           nblocks > (fsp->fi_lfs.lfs_ssize / fsp->fi_lfs.lfs_fsize) - 1)
                return(0);
 
 #if 0
diff -r a0eba08ce83e -r 6f9000d7d158 libexec/lfs_cleanerd/print.c
--- a/libexec/lfs_cleanerd/print.c      Mon Apr 29 23:36:02 2002 +0000
+++ b/libexec/lfs_cleanerd/print.c      Tue Apr 30 00:28:58 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: print.c,v 1.11 2002/04/26 04:34:41 perseant Exp $      */
+/*     $NetBSD: print.c,v 1.12 2002/04/30 00:28:58 perseant Exp $      */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "from: @(#)print.c      8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: print.c,v 1.11 2002/04/26 04:34:41 perseant Exp $");
+__RCSID("$NetBSD: print.c,v 1.12 2002/04/30 00:28:58 perseant Exp $");
 #endif
 #endif /* not lint */
 
@@ -77,10 +77,10 @@
        u_int32_t ck;
 
        blk=0;
-       datap = (u_int32_t *)malloc((lfsp->lfs_ssize / lfsp->lfs_fsize) * sizeof(u_int32_t));
+       datap = (u_int32_t *)malloc(segtod(lfsp, 1) * sizeof(u_int32_t));
        if(datap==NULL) {
                syslog(LOG_WARNING, "cannot allocate %d in dump_summary",
-                      (int)((lfsp->lfs_ssize / lfsp->lfs_fsize) * sizeof(u_int32_t)));
+                      (int)(segtod(lfsp, 1) * sizeof(u_int32_t)));
                return(-1);
        }
 



Home | Main Index | Thread Index | Old Index