diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-05-27 21:44:20 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-05-27 21:44:20 +0000 |
commit | 2547315d49a4ee9f2fc61d54260a8b1f37f33cbd (patch) | |
tree | 56cf83810b788b5aa43d845ce3f4842275ed0e3c /nuttx/fs | |
parent | 541f8a338b93b1d1cc58573765de286cf441ee6f (diff) | |
download | px4-nuttx-2547315d49a4ee9f2fc61d54260a8b1f37f33cbd.tar.gz px4-nuttx-2547315d49a4ee9f2fc61d54260a8b1f37f33cbd.tar.bz2 px4-nuttx-2547315d49a4ee9f2fc61d54260a8b1f37f33cbd.zip |
Fix FAT32 bug
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1829 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs')
-rw-r--r-- | nuttx/fs/fat/fs_fat32util.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/nuttx/fs/fat/fs_fat32util.c b/nuttx/fs/fat/fs_fat32util.c index 16f47727b..7353dee88 100644 --- a/nuttx/fs/fat/fs_fat32util.c +++ b/nuttx/fs/fat/fs_fat32util.c @@ -262,15 +262,20 @@ static inline int fat_path2dirname(const char **path, struct fat_dirinfo_s *diri static int fat_checkfsinfo(struct fat_mountpt_s *fs) { - /* Verify that this is, indeed, an FSINFO sector */ + /* Make sure that the fsinfo sector is in the cache */ - if (FSI_GETLEADSIG(fs->fs_buffer) == 0x41615252 && - FSI_GETSTRUCTSIG(fs->fs_buffer) == 0x61417272 && - FSI_GETTRAILSIG(fs->fs_buffer) == BOOT_SIGNATURE32) + if (fat_fscacheread(fs, fs->fs_fsinfo) == OK) { - fs->fs_fsinextfree = FSI_GETFREECOUNT(fs->fs_buffer); - fs->fs_fsifreecount = FSI_GETNXTFREE(fs->fs_buffer); - return OK; + /* Verify that this is, indeed, an FSINFO sector */ + + if (FSI_GETLEADSIG(fs->fs_buffer) == 0x41615252 && + FSI_GETSTRUCTSIG(fs->fs_buffer) == 0x61417272 && + FSI_GETTRAILSIG(fs->fs_buffer) == BOOT_SIGNATURE32) + { + fs->fs_fsinextfree = FSI_GETFREECOUNT(fs->fs_buffer); + fs->fs_fsifreecount = FSI_GETNXTFREE(fs->fs_buffer); + return OK; + } } return -ENODEV; } @@ -697,7 +702,7 @@ int fat_mount(struct fat_mountpt_s *fs, boolean writeable) ret = fat_checkfsinfo(fs); if (ret != OK) { - goto errout_with_buffer; + goto errout_with_buffer; } } |