Commit Graph

12 Commits (be215a310d51c694a992e913f6757e96c397cefd)

Author SHA1 Message Date
Deepika 7a90be0ce1 Added statvfs API to get storage statistics
The API is as per posix standard, but does not provide stats for file/directory.
Stats buffer (block size, total block count, free block count) is filled for
entire mounted filesystem.
2017-12-29 16:42:31 -06:00
0x6d61726b 4434569719 Build with external tool fails: missing includes
When building with VisualGDB the compilation fails due to the lack of required include files Dir.h and File.h.
Compiler report:

1>------ Build started: Project: exported-mbed-STM32F429-nucleo, Configuration: Debug VisualGDB ------
1>  FileSystem.cpp
1>  mbed-os/features/filesystem/FileSystem.cpp: In instantiation of 'class Managed<mbed::File>':
1>  mbed-os\features\filesystem\FileSystem.cpp(141,19): note :   required from here
1>mbed-os\features\filesystem\FileSystem.cpp(130,7): error :  invalid use of incomplete type 'class mbed::File'
1>   class Managed : public F {
1>         ^~~~~~~
1>  mbed-os\features\filesystem\FileSystem.cpp(18):
1>  mbed-os\features\filesystem\FileSystem.h(39,7): note :  forward declaration of 'class mbed::File'
1>   class File;
1>         ^~~~
1>  mbed-os/features/filesystem/FileSystem.cpp: In member function 'virtual int mbed::FileSystem::open(mbed::FileHandle**, const char*, int)':
1>mbed-os\features\filesystem\FileSystem.cpp(141,19): error :  cannot convert 'Managed<mbed::File>*' to 'mbed::File*' in initialization
1>       File *f = new Managed<File>;
1>                     ^~~~~~~~~~~~~
1>mbed-os\features\filesystem\FileSystem.cpp(142,16): error :  invalid use of incomplete type 'class mbed::File'
1>       int err = f->open(this, path, flags);
1>                  ^~
1>  mbed-os\features\filesystem\FileSystem.cpp(18):
1>  mbed-os\features\filesystem\FileSystem.h(39,7): note :  forward declaration of 'class mbed::File'
1>   class File;
1>         ^~~~
1>mbed-os\features\filesystem\FileSystem.cpp(144,16): warning :  possible problem detected in invocation of delete operator: [-Wdelete-incomplete]
1>           delete f;
1>                  ^
1>mbed-os\features\filesystem\FileSystem.cpp(141,11): warning :  'f' has incomplete type
1>       File *f = new Managed<File>;
1>             ^
1>  mbed-os\features\filesystem\FileSystem.cpp(18):
1>  mbed-os\features\filesystem\FileSystem.h(39,7): note :  forward declaration of 'class mbed::File'
1>   class File;
1>         ^~~~
1>  mbed-os\features\filesystem\FileSystem.cpp(144,16): note :  neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined
1>           delete f;
1>                  ^
1>mbed-os\features\filesystem\FileSystem.cpp(148,13): error :  cannot convert 'mbed::File*' to 'mbed::FileHandle*' in assignment
1>       *file = f;
1>               ^
1>  mbed-os\features\filesystem\FileSystem.cpp(18):
1>  mbed-os\features\filesystem\FileSystem.h(39,7): note :  class type 'mbed::File' is incomplete
1>   class File;
1>         ^~~~
1>  mbed-os/features/filesystem/FileSystem.cpp: In instantiation of 'class Managed<mbed::Dir>':
1>  mbed-os\features\filesystem\FileSystem.cpp(153,18): note :   required from here
1>mbed-os\features\filesystem\FileSystem.cpp(130,7): error :  invalid use of incomplete type 'class mbed::Dir'
1>   class Managed : public F {
1>         ^~~~~~~
1>  mbed-os\features\filesystem\FileSystem.cpp(18):
1>  mbed-os\features\filesystem\FileSystem.h(38,7): note :  forward declaration of 'class mbed::Dir'
1>   class Dir;
1>         ^~~
1>  mbed-os/features/filesystem/FileSystem.cpp: In member function 'virtual int mbed::FileSystem::open(mbed::DirHandle**, const char*)':
1>mbed-os\features\filesystem\FileSystem.cpp(153,18): error :  cannot convert 'Managed<mbed::Dir>*' to 'mbed::Dir*' in initialization
1>       Dir *d = new Managed<Dir>;
1>                    ^~~~~~~~~~~~
1>mbed-os\features\filesystem\FileSystem.cpp(154,16): error :  invalid use of incomplete type 'class mbed::Dir'
1>       int err = d->open(this, path);
1>                  ^~
1>  mbed-os\features\filesystem\FileSystem.cpp(18):
1>  mbed-os\features\filesystem\FileSystem.h(38,7): note :  forward declaration of 'class mbed::Dir'
1>   class Dir;
1>         ^~~
1>mbed-os\features\filesystem\FileSystem.cpp(156,16): warning :  possible problem detected in invocation of delete operator: [-Wdelete-incomplete]
1>           delete d;
1>                  ^
1>mbed-os\features\filesystem\FileSystem.cpp(153,10): warning :  'd' has incomplete type
1>       Dir *d = new Managed<Dir>;
1>            ^
1>  mbed-os\features\filesystem\FileSystem.cpp(18):
1>  mbed-os\features\filesystem\FileSystem.h(38,7): note :  forward declaration of 'class mbed::Dir'
1>   class Dir;
1>         ^~~
1>  mbed-os\features\filesystem\FileSystem.cpp(156,16): note :  neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined
1>           delete d;
1>                  ^
1>mbed-os\features\filesystem\FileSystem.cpp(160,12): error :  cannot convert 'mbed::Dir*' to 'mbed::DirHandle*' in assignment
1>       *dir = d;
1>              ^
1>  mbed-os\features\filesystem\FileSystem.cpp(18):
1>  mbed-os\features\filesystem\FileSystem.h(38,7): note :  class type 'mbed::Dir' is incomplete
1>   class Dir;
1>         ^~~
1>  mbed-os/features/filesystem/FileSystem.cpp: In instantiation of 'int Managed<F>::close() [with F = mbed::Dir]':
1>  mbed-os\features\filesystem\FileSystem.cpp(162,1): note :   required from here
1>mbed-os\features\filesystem\FileSystem.cpp(133,27): error :  incomplete type 'mbed::Dir' used in nested name specifier
1>           int err = F::close();
1>                     ~~~~~~~~^~
1>  mbed-os/features/filesystem/FileSystem.cpp: In instantiation of 'int Managed<F>::close() [with F = mbed::File]':
1>  mbed-os\features\filesystem\FileSystem.cpp(162,1): note :   required from here
1>mbed-os\features\filesystem\FileSystem.cpp(133,27): error :  incomplete type 'mbed::File' used in nested name specifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
2017-08-30 17:21:53 +02:00
Christopher Haster 0f8dffb7a4 fs: Added FileSystem::reformat
This function provides a shortcut to reformatting a mounted filesystem.

Also, since this function is a virtual member of the FileSystem class,
the user does not need to know the underlying filesystem to reformat
the underlying storage.
2017-08-14 17:05:40 -05:00
Christopher Haster 0fc5ce2b5e LocalFileSystem: Moved away from deprecated open functions
The old open/opendir functions did not provide a route for errors and
relied on implementations manually setting errno. Updated to return
errors directly.
2017-06-03 13:18:02 -05:00
Christopher Haster eed1cec5d8 FileSystem: Provided default implementations for all non-file operations 2017-06-03 13:18:01 -05:00
Christopher Haster 5d6fc713fb FileSystem: Reintegrated FileSystemLike interface
Required for other representations of FileSystems, ie LocalFileSystem

Introduces FileSystemHandle for the same behaviour as FileHandle and
DirHandle.

Requires the following to hook into file/dir lookup:
```
int open(FileHandle **file, const char *filename, int flags)
int open(DirHandle **dir, const char *path)
```

This hook is provided by the FileSystem class, so requires no changes
from implementations.
2017-06-03 13:17:37 -05:00
Kevin Bracey 533910cb87 Correct return type of FileHandle::size()
File size should be off_t, not size_t.
2017-05-31 15:02:11 +03:00
Christopher Haster c4649afba5 Filesystem: Last minute changes due to feedback on directory iteration
- Changed to use dirent structure type
- Fixed memory leak in closedir
2017-02-24 12:03:14 -06:00
Christopher Haster b9122c73f9 Filesystem: Integrate error handling between c++/posix layers 2017-02-24 12:03:09 -06:00
Christopher Haster eea5c9f08a Filesystem: Integration with retarget code 2017-02-24 11:55:37 -06:00
Christopher Haster e5197ceaca Filesystem: Initial integration with the FATFileSystem 2017-02-24 11:53:17 -06:00
Christopher Haster a5245e32fe Filesystem: Created prototypical filesystem class
Intention is to make filesystem api and network stack api consistent
as current designs diverge greatly. Attempted to change as little as
possible outside of api structure.
2017-02-24 11:41:34 -06:00