18#ifndef MBED_FILESYSTEM_H
19#define MBED_FILESYSTEM_H
21#include "platform/platform.h"
23#include "platform/FileBase.h"
24#include "platform/FileHandle.h"
25#include "platform/DirHandle.h"
26#include "platform/FileSystemLike.h"
27#include "blockdevice/BlockDevice.h"
35typedef void *fs_file_t;
36typedef void *fs_dir_t;
110 virtual int rename(
const char *path,
const char *newpath);
118 virtual int stat(
const char *path,
struct stat *st);
126 virtual int mkdir(
const char *path, mode_t mode);
149 virtual int file_open(fs_file_t *file,
const char *path,
int flags) = 0;
156 virtual int file_close(fs_file_t file) = 0;
165 virtual ssize_t file_read(fs_file_t file,
void *buffer,
size_t size) = 0;
174 virtual ssize_t file_write(fs_file_t file,
const void *buffer,
size_t size) = 0;
181 virtual int file_sync(fs_file_t file);
189 virtual int file_isatty(fs_file_t file);
201 virtual off_t file_seek(fs_file_t file, off_t offset,
int whence) = 0;
208 virtual off_t file_tell(fs_file_t file);
215 virtual void file_rewind(fs_file_t file);
222 virtual off_t file_size(fs_file_t file);
235 virtual int file_truncate(fs_file_t file, off_t length);
243 virtual int dir_open(fs_dir_t *dir,
const char *path);
250 virtual int dir_close(fs_dir_t dir);
258 virtual ssize_t dir_read(fs_dir_t dir,
struct dirent *ent);
266 virtual void dir_seek(fs_dir_t dir, off_t offset);
273 virtual off_t dir_tell(fs_dir_t dir);
279 virtual void dir_rewind(fs_dir_t dir);
286 virtual size_t dir_size(fs_dir_t dir);
A hardware device capable of writing and reading blocks.
Represents a directory stream.
virtual int mkdir(const char *path, mode_t mode)
Create a directory in the file system.
virtual int open(FileHandle **file, const char *path, int flags)
defined(DOXYGEN_ONLY)
virtual int unmount()=0
Unmount a file system from the underlying block device.
virtual int stat(const char *path, struct stat *st)
Store information about the file in a stat structure.
FileSystem(const char *name=NULL)
File system lifetime.
virtual int reformat(BlockDevice *bd=NULL)
Reformat a file system.
virtual int remove(const char *path)
Remove a file from the file system.
virtual int statvfs(const char *path, struct statvfs *buf)
Store information about the mounted file system in a statvfs structure.
virtual int mount(BlockDevice *bd)=0
Mount a file system to a block device.
virtual int rename(const char *path, const char *newpath)
Rename a file in the file system.
static FileSystem * get_default_instance()
Return the default file system.
virtual int open(DirHandle **dir, const char *path)
Open a directory on the filesystem.
A filesystem-like object is one that can be used to open file-like objects though it by fopen("/name/...