Skip to content

Commit 5b53aec

Browse files
committed
Filesystem: Initial integration with the FATFileSystem
1 parent 6e2d937 commit 5b53aec

File tree

11 files changed

+512
-672
lines changed

11 files changed

+512
-672
lines changed

features/filesystem/FileSystem.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ ssize_t FileSystem::dir_read(fs_dir_t dir, char *path, size_t len)
6969

7070
ssize_t FileSystem::dir_read(fs_dir_t dir, char *path, size_t len, uint8_t *type)
7171
{
72-
return FS_ERROR_UNSUPPORTED;
72+
*type = DT_UNKNOWN;
73+
return dir_read(dir, path, len);
7374
}
7475

7576
void FileSystem::dir_seek(fs_dir_t dir, off_t offset)

features/filesystem/FileSystem.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "drivers/FileBase.h"
2323
#include "drivers/FileHandle.h"
2424
#include "drivers/DirHandle.h"
25+
#include "BlockDevice.h"
2526

2627
namespace mbed {
2728
/** \addtogroup filesystem */
@@ -56,7 +57,20 @@ class FileSystem {
5657
public:
5758
/** FileSystem lifetime
5859
*/
59-
~FileSystem() {}
60+
virtual ~FileSystem() {}
61+
62+
/** Mounts a filesystem to a block device
63+
*
64+
* @param bd BlockDevice to mount to
65+
* @return 0 on success, negative error code on failure
66+
*/
67+
virtual int mount(BlockDevice *bd) = 0;
68+
69+
/** Unmounts a filesystem from the underlying block device
70+
*
71+
* @return 0 on success, negative error code on failure
72+
*/
73+
virtual int unmount() = 0;
6074

6175
/** Remove a file from the filesystem.
6276
*
@@ -174,7 +188,7 @@ class FileSystem {
174188
* @param file File handle
175189
* @return Size of the file in bytes
176190
*/
177-
virtual size_t file_size(fs_file_t);
191+
virtual size_t file_size(fs_file_t file);
178192

179193
/** Open a directory on the filesystem
180194
*

features/filesystem/fat/FATDirHandle.cpp

Lines changed: 0 additions & 108 deletions
This file was deleted.

features/filesystem/fat/FATDirHandle.h

Lines changed: 0 additions & 60 deletions
This file was deleted.

features/filesystem/fat/FATFileHandle.cpp

Lines changed: 0 additions & 124 deletions
This file was deleted.

0 commit comments

Comments
 (0)