Fix a bug in the FAT statfs() implementation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4375 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
7c0e75b8db
commit
28dc73fd3b
@ -2447,3 +2447,6 @@
|
||||
* lib/net/lib_inetntop.c: Add inet_ntop().
|
||||
* lib/net/lib_inetpton.c: Add inet_pton().
|
||||
* include/pthread.h: Correct PTHREAD_MUTEX_INITIALIZER.
|
||||
* fs/fat/fs_fatfs.c: Fix and error in the FAT statfs() implementation that
|
||||
was causing some block counts to be reported incorrectly (reported by
|
||||
david_s5y).
|
@ -1,8 +1,8 @@
|
||||
/****************************************************************************
|
||||
* fs/fat/fs_fat32.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* References:
|
||||
* Microsoft FAT documentation
|
||||
@ -1706,13 +1706,13 @@ static int fat_statfs(struct inode *mountpt, struct statfs *buf)
|
||||
|
||||
/* Everything else follows in units of clusters */
|
||||
|
||||
buf->f_blocks = fs->fs_nclusters; /* Total data blocks in the file system */
|
||||
buf->f_bfree = fat_nfreeclusters(fs, &buf->f_bfree); /* Free blocks in the file system */
|
||||
buf->f_bavail = buf->f_bfree; /* Free blocks avail to non-superuser */
|
||||
buf->f_namelen = (8+1+3); /* Maximum length of filenames */
|
||||
|
||||
fat_semgive(fs);
|
||||
return OK;
|
||||
ret = fat_nfreeclusters(fs, &buf->f_bfree); /* Free blocks in the file system */
|
||||
if (ret >= 0)
|
||||
{
|
||||
buf->f_blocks = fs->fs_nclusters; /* Total data blocks in the file system */
|
||||
buf->f_bavail = buf->f_bfree; /* Free blocks avail to non-superuser */
|
||||
buf->f_namelen = (8+1+3); /* Maximum length of filenames */
|
||||
}
|
||||
|
||||
errout_with_semaphore:
|
||||
fat_semgive(fs);
|
||||
|
Loading…
Reference in New Issue
Block a user