FileSystem: Provided default implementations for all non-file operations

pull/4087/head
Christopher Haster 2017-03-30 14:39:54 -05:00 committed by Russ Butler
parent 5d6fc713fb
commit eed1cec5d8
2 changed files with 23 additions and 9 deletions

View File

@ -1,4 +1,3 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2013 ARM Limited
* *
@ -25,6 +24,26 @@ FileSystem::FileSystem(const char *name)
{ {
} }
int FileSystem::remove(const char *path)
{
return -ENOSYS;
}
int FileSystem::rename(const char *path, const char *newpath)
{
return -ENOSYS;
}
int FileSystem::stat(const char *path, struct stat *st)
{
return -ENOSYS;
}
int FileSystem::mkdir(const char *path, mode_t mode)
{
return -ENOSYS;
}
int FileSystem::file_sync(fs_file_t file) int FileSystem::file_sync(fs_file_t file)
{ {
return 0; return 0;
@ -53,11 +72,6 @@ off_t FileSystem::file_size(fs_file_t file)
return size; return size;
} }
int FileSystem::mkdir(const char *path, mode_t mode)
{
return -ENOSYS;
}
int FileSystem::dir_open(fs_dir_t *dir, const char *path) int FileSystem::dir_open(fs_dir_t *dir, const char *path)
{ {
return -ENOSYS; return -ENOSYS;

View File

@ -71,7 +71,7 @@ public:
* @param path The name of the file to remove. * @param path The name of the file to remove.
* @return 0 on success, negative error code on failure * @return 0 on success, negative error code on failure
*/ */
virtual int remove(const char *path) = 0; virtual int remove(const char *path);
/** Rename a file in the filesystem. /** Rename a file in the filesystem.
* *
@ -79,7 +79,7 @@ public:
* @param newpath The name to rename it to * @param newpath The name to rename it to
* @return 0 on success, negative error code on failure * @return 0 on success, negative error code on failure
*/ */
virtual int rename(const char *path, const char *newpath) = 0; virtual int rename(const char *path, const char *newpath);
/** Store information about the file in a stat structure /** Store information about the file in a stat structure
* *
@ -87,7 +87,7 @@ public:
* @param st The stat buffer to write to * @param st The stat buffer to write to
* @return 0 on success, negative error code on failure * @return 0 on success, negative error code on failure
*/ */
virtual int stat(const char *path, struct stat *st) = 0; virtual int stat(const char *path, struct stat *st);
/** Create a directory in the filesystem. /** Create a directory in the filesystem.
* *