From 0bcb79b3abf988db924fc96f1b7c98236012b04d Mon Sep 17 00:00:00 2001 From: "goprife@gmail.com" Date: Sun, 8 Apr 2012 11:28:51 +0000 Subject: [PATCH] fix bugs in uffs_result_to_dfs and in dfs_uffs_statfs in dfs_uffs.c git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2025 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- components/dfs/filesystems/uffs/dfs_uffs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/dfs/filesystems/uffs/dfs_uffs.c b/components/dfs/filesystems/uffs/dfs_uffs.c index 7a6f97a92..c8b2de3d0 100644 --- a/components/dfs/filesystems/uffs/dfs_uffs.c +++ b/components/dfs/filesystems/uffs/dfs_uffs.c @@ -48,6 +48,7 @@ static int uffs_result_to_dfs(int result) { int status = -1; + result = result < 0 ? -result : result; switch (result) { case UENOERR:/** no error */ @@ -270,7 +271,7 @@ static int dfs_uffs_statfs(struct dfs_filesystem* fs, buf->f_bsize = mtd->page_size; buf->f_blocks = (mtd->block_size)/(mtd->page_size)* - (mtd->block_start - mtd->block_end + 1); + (mtd->block_end - mtd->block_start + 1); buf->f_bfree = uffs_GetDeviceFree(&nand_part[index].uffs_dev) / mtd->page_size; return 0;