Module Name: src
Committed By: uch
Date: Sun Jul 10 12:14:01 UTC 2011
Modified Files:
src/sbin/newfs_v7fs: main.c
Log Message:
fix freeblock count bug.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sbin/newfs_v7fs/main.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/newfs_v7fs/main.c
diff -u src/sbin/newfs_v7fs/main.c:1.1 src/sbin/newfs_v7fs/main.c:1.2
--- src/sbin/newfs_v7fs/main.c:1.1 Mon Jun 27 11:52:58 2011
+++ src/sbin/newfs_v7fs/main.c Sun Jul 10 12:14:01 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.1 2011/06/27 11:52:58 uch Exp $ */
+/* $NetBSD: main.c,v 1.2 2011/07/10 12:14:01 uch Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: main.c,v 1.1 2011/06/27 11:52:58 uch Exp $");
+__RCSID("$NetBSD: main.c,v 1.2 2011/07/10 12:14:01 uch Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -146,11 +146,11 @@
{
VPRINTF("\nlast freeblock #%d\n",
(*val32)(fb->freeblock[i + 1]));
- fb->nfreeblock = (*val16)(k);
memmove(fb->freeblock + 1, fb->freeblock + i + 1, k *
sizeof(v7fs_daddr_t));
fb->freeblock[0] = 0; /* Terminate link; */
+ fb->nfreeblock = (*val16)(k + 1);
VPRINTF("last freeblock contains #%d\n",
(*val16)(fb->nfreeblock));
fs->io.write(fs->io.cookie, buf, listblk);
@@ -211,7 +211,8 @@
for (i = V7FS_MAX_FREEBLOCK - 1, j = sb->datablock_start_sector; i >= 0;
i--, j++)
sb->freeblock[i] = j;
- sb->total_freeblock = volume_size - sb->datablock_start_sector - 1;
+
+ sb->total_freeblock = volume_size - sb->datablock_start_sector;
/* Write superblock. */
sb->modified = 1;