|
FreeNOS
|
Use a file as Storage provider. More...
#include <FileStorage.h>
Public Member Functions | |
| FileStorage (const char *path, Size offset=ZERO) | |
| Constructor function. More... | |
| virtual FileSystem::Result | initialize () |
| Initialize the Storage device. More... | |
| virtual FileSystem::Result | read (const u64 offset, void *buffer, const Size size) const |
| Read a contiguous set of data. More... | |
| virtual FileSystem::Result | write (const u64 offset, void *buffer, const Size size) |
| Write a contiguous set of data. More... | |
| virtual u64 | capacity () const |
| Retrieve maximum storage capacity. More... | |
Public Member Functions inherited from Storage | |
| Storage () | |
| Constructor function. More... | |
| virtual | ~Storage () |
| Destructor function. More... | |
Private Attributes | |
| const char * | m_path |
| Path to the file. More... | |
| Size | m_fd |
| File descriptor of the file. More... | |
| FileSystemClient | m_file |
| Client for file system I/O. More... | |
| FileSystem::FileStat | m_stat |
| Status of the file for Storage I/O. More... | |
| Size | m_offset |
| Offset used as a base for I/O. More... | |
Constructor function.
| path | Full path to the file to use. |
| offset | Offset in the file as a base for I/O. |
Definition at line 21 of file FileStorage.cpp.
|
virtual |
Retrieve maximum storage capacity.
Implements Storage.
Definition at line 71 of file FileStorage.cpp.
References m_stat, and FileSystem::FileStat::size.
|
virtual |
Initialize the Storage device.
Implements Storage.
Definition at line 28 of file FileStorage.cpp.
References m_fd, m_file, m_path, m_stat, FileSystemClient::openFile(), FileSystemClient::statFile(), and FileSystem::Success.
|
virtual |
Read a contiguous set of data.
| offset | Offset to start reading from. |
| buffer | Output buffer. |
| size | Number of bytes to copied. |
Implements Storage.
Definition at line 39 of file FileStorage.cpp.
References FileDescriptor::getEntry(), StrictSingleton< FileDescriptor >::instance(), FileSystem::IOError, m_fd, m_file, m_offset, FileDescriptor::Entry::open, FileDescriptor::Entry::position, and FileSystemClient::readFile().
|
virtual |
Write a contiguous set of data.
| offset | Offset to start writing to. |
| buffer | Input buffer. |
| size | Number of bytes to written. |
Reimplemented from Storage.
Definition at line 55 of file FileStorage.cpp.
References FileDescriptor::getEntry(), StrictSingleton< FileDescriptor >::instance(), FileSystem::IOError, m_fd, m_file, m_offset, FileDescriptor::Entry::open, FileDescriptor::Entry::position, and FileSystemClient::writeFile().
|
private |
File descriptor of the file.
Definition at line 92 of file FileStorage.h.
Referenced by initialize(), read(), and write().
|
private |
Client for file system I/O.
Definition at line 95 of file FileStorage.h.
Referenced by initialize(), read(), and write().
|
private |
Offset used as a base for I/O.
Definition at line 101 of file FileStorage.h.
|
private |
|
private |
Status of the file for Storage I/O.
Definition at line 98 of file FileStorage.h.
Referenced by capacity(), and initialize().
1.8.17