forked version of FATFileSystemEx

Fork of FATFileSystem by mbed official

Revision:
4:c9dcfcfd0c5a
Parent:
2:b6669c987c8e
--- a/FATFileSystem.cpp	Mon Mar 17 14:09:00 2014 +0000
+++ b/FATFileSystem.cpp	Wed Aug 20 00:20:41 2014 +0000
@@ -28,6 +28,16 @@
 #include "FATFileHandle.h"
 #include "FATDirHandle.h"
 
+#ifdef FAT_TINY
+#define FA_RDWR FA_READ
+#define FA_WRITE FA_READ
+#define FA_CREATE_ALWAYS 0
+#define FA_OPEN_ALWAYS 0
+#else
+#define FA_RDWR (FA_READ|FA_WRITE)
+#endif
+
+
 DWORD get_fattime(void) {
     time_t rawtime;
     time(&rawtime);
@@ -73,7 +83,7 @@
     /* POSIX flags -> FatFS open mode */
     BYTE openmode;
     if (flags & O_RDWR) {
-        openmode = FA_READ|FA_WRITE;
+        openmode = FA_RDWR;
     } else if(flags & O_WRONLY) {
         openmode = FA_WRITE;
     } else {
@@ -100,21 +110,29 @@
 }
     
 int FATFileSystem::remove(const char *filename) {
+#ifdef FAT_TINY
+    return -1;
+#else
     FRESULT res = f_unlink(filename);
     if (res) { 
         debug_if(FFS_DBG, "f_unlink() failed: %d\n", res);
         return -1;
     }
     return 0;
+#endif
 }
 
 int FATFileSystem::format() {
+#ifdef FAT_TINY
+    return -1;
+#else
     FRESULT res = f_mkfs(_fsid, 0, 512); // Logical drive number, Partitioning rule, Allocation unit size (bytes per cluster)
     if (res) {
         debug_if(FFS_DBG, "f_mkfs() failed: %d\n", res);
         return -1;
     }
     return 0;
+#endif
 }
 
 DirHandle *FATFileSystem::opendir(const char *name) {
@@ -127,6 +145,10 @@
 }
 
 int FATFileSystem::mkdir(const char *name, mode_t mode) {
+#ifdef FAT_TINY
+    return -1;
+#else
     FRESULT res = f_mkdir(name);
     return res == 0 ? 0 : -1;
+#endif
 }