|
FreeNOS
|
Abstracts files which are opened by a user process. More...
#include <FileDescriptor.h>
Data Structures | |
| struct | Entry |
| Describes a single file opened by a user process. More... | |
Public Types | |
| enum | Result { Success, InvalidArgument, OutOfFiles } |
| Result code. More... | |
Public Member Functions | |
| FileDescriptor () | |
| Constructor. More... | |
| Entry * | getArray (Size &count) |
| Get entry table. More... | |
| void | setArray (Entry *array, const Size count) |
| Assign entry table. More... | |
| Result | openEntry (const u32 inode, const ProcessID filesystem, Size &index) |
| Add new file descriptor entry. More... | |
| Entry * | getEntry (const Size index) |
| Retrieve a file descriptor Entry. More... | |
| Result | closeEntry (const Size index) |
| Remove file descriptor entry. More... | |
Static Public Attributes | |
| static const Size | MaximumFiles = 1024 |
| Default maximum number of files which can be opened. More... | |
Private Attributes | |
| Entry * | m_array |
| Pointer to array of entries. More... | |
| Size | m_count |
| Number of entries in the array. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from StrictSingleton< FileDescriptor > | |
| static FileDescriptor * | instance () |
| Retrieve the instance. More... | |
Abstracts files which are opened by a user process.
Definition at line 36 of file FileDescriptor.h.
Result code.
| Enumerator | |
|---|---|
| Success | |
| InvalidArgument | |
| OutOfFiles | |
Definition at line 57 of file FileDescriptor.h.
| FileDescriptor::FileDescriptor | ( | ) |
Constructor.
Definition at line 20 of file FileDescriptor.cpp.
| FileDescriptor::Result FileDescriptor::closeEntry | ( | const Size | index | ) |
Remove file descriptor entry.
| index | Index in the array of entries |
Definition at line 68 of file FileDescriptor.cpp.
References InvalidArgument, m_array, m_count, FileDescriptor::Entry::open, and Success.
Referenced by FileSystemClient::closeFile().
| FileDescriptor::Entry * FileDescriptor::getArray | ( | Size & | count | ) |
Get entry table.
| count | Maximum number of entries |
Definition at line 25 of file FileDescriptor.cpp.
References m_array, and m_count.
Referenced by setupMappings().
| FileDescriptor::Entry * FileDescriptor::getEntry | ( | const Size | index | ) |
Retrieve a file descriptor Entry.
| index | Index in the array of entries |
Definition at line 58 of file FileDescriptor.cpp.
References m_array, m_count, and ZERO.
Referenced by lseek(), FileStorage::read(), FileSystemClient::readFile(), NetworkClient::waitSocket(), FileStorage::write(), FileSystemClient::writeFile(), and NetworkClient::writeSocketInfo().
| FileDescriptor::Result FileDescriptor::openEntry | ( | const u32 | inode, |
| const ProcessID | filesystem, | ||
| Size & | index | ||
| ) |
Add new file descriptor entry.
| inode | Inode number of the file to add |
| filesystem | Process identifier of the filesystem |
| index | On output contains the index number for the entry |
Definition at line 38 of file FileDescriptor.cpp.
References FileDescriptor::Entry::inode, m_array, m_count, open(), FileDescriptor::Entry::open, OutOfFiles, FileDescriptor::Entry::pid, FileDescriptor::Entry::position, and Success.
Referenced by FileSystemClient::openFile().
Assign entry table.
| array | Pointer to array with file descriptor entries |
| count | Number of Entry structures in the array |
Definition at line 31 of file FileDescriptor.cpp.
References m_array, and m_count.
Referenced by setupMappings().
|
private |
Pointer to array of entries.
Definition at line 123 of file FileDescriptor.h.
Referenced by closeEntry(), getArray(), getEntry(), openEntry(), and setArray().
|
private |
Number of entries in the array.
Definition at line 126 of file FileDescriptor.h.
Referenced by closeEntry(), getArray(), getEntry(), openEntry(), and setArray().
|
static |
Default maximum number of files which can be opened.
Definition at line 41 of file FileDescriptor.h.
1.8.17