Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/makefs After populating the file system, update sup...



details:   https://anonhg.NetBSD.org/src/rev/399f97ca5ec8
branches:  trunk
changeset: 565228:399f97ca5ec8
user:      lukem <lukem%NetBSD.org@localhost>
date:      Fri Apr 02 11:27:56 2004 +0000

description:
After populating the file system, update superblock->fs_old_cstotal from
superblock->fs_cstotal.  Fixes inconsistencies found by FreeBSD's fsck.
Problem noted by Luigi Rizzo <luigi%FreeBSD.org@localhost> via Colin Percival.

diffstat:

 usr.sbin/makefs/ffs.c |  17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diffs (46 lines):

diff -r 115944b672e6 -r 399f97ca5ec8 usr.sbin/makefs/ffs.c
--- a/usr.sbin/makefs/ffs.c     Fri Apr 02 11:14:24 2004 +0000
+++ b/usr.sbin/makefs/ffs.c     Fri Apr 02 11:27:56 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs.c,v 1.25 2003/10/26 10:32:35 mycroft Exp $ */
+/*     $NetBSD: ffs.c,v 1.26 2004/04/02 11:27:56 lukem Exp $   */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: ffs.c,v 1.25 2003/10/26 10:32:35 mycroft Exp $");
+__RCSID("$NetBSD: ffs.c,v 1.26 2004/04/02 11:27:56 lukem Exp $");
 #endif /* !__lint */
 
 #include <sys/param.h>
@@ -210,7 +210,8 @@
 void
 ffs_makefs(const char *image, const char *dir, fsnode *root, fsinfo_t *fsopts)
 {
-       struct timeval start;
+       struct fs       *superblock;
+       struct timeval  start;
 
        assert(image != NULL);
        assert(dir != NULL);
@@ -251,9 +252,15 @@
        if (debug & DEBUG_FS_MAKEFS)
                bcleanup();
 
-               /* write out superblock; image is now complete */
+               /* update various superblock parameters */
+       superblock = fsopts->superblock;
+       superblock->fs_fmod = 0;
+       superblock->fs_old_cstotal.cs_ndir   = superblock->fs_cstotal.cs_ndir;
+       superblock->fs_old_cstotal.cs_nbfree = superblock->fs_cstotal.cs_nbfree;
+       superblock->fs_old_cstotal.cs_nifree = superblock->fs_cstotal.cs_nifree;
+       superblock->fs_old_cstotal.cs_nffree = superblock->fs_cstotal.cs_nffree;
 
-       ((struct fs *)fsopts->superblock)->fs_fmod = 0;
+               /* write out superblock; image is now complete */
        ffs_write_superblock(fsopts->superblock, fsopts);
        if (close(fsopts->fd) == -1)
                err(1, "Closing `%s'", image);



Home | Main Index | Thread Index | Old Index