summaryrefslogtreecommitdiffstatshomepage
path: root/lib/fatfs/ff.h
diff options
context:
space:
mode:
authorDaniel Campora <daniel@wipy.io>2015-03-27 12:17:12 +0100
committerDamien George <damien.p.george@gmail.com>2015-03-29 22:12:14 +0100
commit7b19e99edd2ca5d60154ffaa6007c936f274a15a (patch)
treed8850b49750f417d119450c9dd4084e71837959f /lib/fatfs/ff.h
parent64e8b622917156bfe3a7ca3698072188be1ab862 (diff)
downloadmicropython-7b19e99edd2ca5d60154ffaa6007c936f274a15a.tar.gz
micropython-7b19e99edd2ca5d60154ffaa6007c936f274a15a.zip
lib: Update FatFs to R0.11.
There are lots of cosmetic changes, but this release brings a very important bug fix: - Fixed f_unlink() does not remove cluster chain of the file. With R0.10c if you try to write a file that is too large to fit in the free space of the drive, the operation fails, you delete the incomplete file, and it seems to be erased, but the space is not really freed, because any subsequent write operations fail because the drive is "still" full. The only way to recover from this is by formatting the drive. I can confirm that R0.11 fixes the problem.
Diffstat (limited to 'lib/fatfs/ff.h')
-rw-r--r--lib/fatfs/ff.h36
1 files changed, 23 insertions, 13 deletions
diff --git a/lib/fatfs/ff.h b/lib/fatfs/ff.h
index 6f7c86debf..31d58b4427 100644
--- a/lib/fatfs/ff.h
+++ b/lib/fatfs/ff.h
@@ -1,21 +1,23 @@
/*---------------------------------------------------------------------------/
-/ FatFs - FAT file system module include file R0.10c (C)ChaN, 2014
+/ FatFs - FAT file system module include R0.11 (C)ChaN, 2015
/----------------------------------------------------------------------------/
-/ FatFs module is a generic FAT file system module for small embedded systems.
-/ This is a free software that opened for education, research and commercial
-/ developments under license policy of following terms.
+/ FatFs module is a free software that opened under license policy of
+/ following conditions.
/
-/ Copyright (C) 2014, ChaN, all right reserved.
+/ Copyright (C) 2015, ChaN, all right reserved.
/
-/ * The FatFs module is a free software and there is NO WARRANTY.
-/ * No restriction on use. You can use, modify and redistribute it for
-/ personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY.
-/ * Redistributions of source code must retain the above copyright notice.
+/ 1. Redistributions of source code must retain the above copyright notice,
+/ this condition and the following disclaimer.
/
-/----------------------------------------------------------------------------*/
+/ This software is provided by the copyright holder and contributors "AS IS"
+/ and any warranties related to this software are DISCLAIMED.
+/ The copyright owner or contributors be NOT LIABLE for any damages caused
+/ by use of this software.
+/---------------------------------------------------------------------------*/
+
#ifndef _FATFS
-#define _FATFS 80376 /* Revision ID */
+#define _FATFS 32020 /* Revision ID */
#ifdef __cplusplus
extern "C" {
@@ -36,6 +38,7 @@ typedef struct {
BYTE pd; /* Physical drive number */
BYTE pt; /* Partition: 0:Auto detect, 1-4:Forced partition) */
} PARTITION;
+// dpgeorge: make the partition config table const
extern const PARTITION VolToPart[]; /* Volume - Partition resolution table */
#define LD2PD(vol) (VolToPart[vol].pd) /* Get physical drive number */
#define LD2PT(vol) (VolToPart[vol].pt) /* Get partition index */
@@ -154,11 +157,14 @@ typedef struct {
WCHAR* lfn; /* Pointer to the LFN working buffer */
WORD lfn_idx; /* Last matched LFN index number (0xFFFF:No LFN) */
#endif
+#if _USE_FIND
+ const TCHAR* pat; /* Pointer to the name matching pattern */
+#endif
} DIR;
-/* File status structure (FILINFO) */
+/* File information structure (FILINFO) */
typedef struct {
DWORD fsize; /* File size */
@@ -215,11 +221,13 @@ FRESULT f_sync (FIL* fp); /* Flush cached data of a writing file */
FRESULT f_opendir (DIR* dp, const TCHAR* path); /* Open a directory */
FRESULT f_closedir (DIR* dp); /* Close an open directory */
FRESULT f_readdir (DIR* dp, FILINFO* fno); /* Read a directory item */
+FRESULT f_findfirst (DIR* dp, FILINFO* fno, const TCHAR* path, const TCHAR* pattern); /* Find first file */
+FRESULT f_findnext (DIR* dp, FILINFO* fno); /* Find next file */
FRESULT f_mkdir (const TCHAR* path); /* Create a sub directory */
FRESULT f_unlink (const TCHAR* path); /* Delete an existing file or directory */
FRESULT f_rename (const TCHAR* path_old, const TCHAR* path_new); /* Rename/Move a file or directory */
FRESULT f_stat (const TCHAR* path, FILINFO* fno); /* Get file status */
-FRESULT f_chmod (const TCHAR* path, BYTE value, BYTE mask); /* Change attribute of the file/dir */
+FRESULT f_chmod (const TCHAR* path, BYTE attr, BYTE mask); /* Change attribute of the file/dir */
FRESULT f_utime (const TCHAR* path, const FILINFO* fno); /* Change times-tamp of the file/dir */
FRESULT f_chdir (const TCHAR* path); /* Change current directory */
FRESULT f_chdrive (const TCHAR* path); /* Change current drive */
@@ -239,6 +247,8 @@ TCHAR* f_gets (TCHAR* buff, int len, FIL* fp); /* Get a string from the fil
#define f_error(fp) ((fp)->err)
#define f_tell(fp) ((fp)->fptr)
#define f_size(fp) ((fp)->fsize)
+#define f_rewind(fp) f_lseek((fp), 0)
+#define f_rewinddir(dp) f_readdir((dp), 0)
#ifndef EOF
#define EOF (-1)