Abstract file descriptor.
More...
#include </home/travis/build/forGGe/theCore/lib/fs/export/ecl/fs/file_descriptor.hpp>
Abstract file descriptor.
◆ file_descriptor()
file_descriptor::file_descriptor |
( |
const inode_weak & |
node | ) |
|
Constructs the file descriptor from given weak pointer to inode.
Constructing the file descriptor acts as file opening.
- Parameters
-
[in] | node | Weak smart pointer to the respective file inode. |
◆ ~file_descriptor()
file_descriptor::~file_descriptor |
( |
| ) |
|
|
virtual |
Closes and destructs the file descriptor.
◆ read()
virtual err ecl::fs::file_descriptor::read |
( |
uint8_t * |
buf, |
|
|
size_t & |
size |
|
) |
| |
|
pure virtual |
Reads data from a file to a buffer with given size.
- Precondition
- Valid and opened file descriptor.
Current read/write offset is advanced to an amount of bytes read.
- Parameters
-
[in] | buf | Buffer to store data into. Must not be NULL. |
[in,out] | size | Size of a buffer on entry, bytes read from a file on exit. In case of returned values is less than provided one, it means the read pointer has reached end of the file during read operation. |
- Returns
- Status of operation.
- Return values
-
err::notsup | Operation is not supported on a given filesystem. |
Implemented in ecl::fat::file.
◆ write()
virtual err ecl::fs::file_descriptor::write |
( |
const uint8_t * |
buf, |
|
|
size_t & |
size |
|
) |
| |
|
pure virtual |
Writes data to a file from buffer with given size.
- Precondition
- Valid and opened file descriptor.
Current read/write offset is advanced to an amount of bytes written.
- Parameters
-
[in] | buf | Buffer to copy data from. Must not be NULL. |
[in,out] | size | Size of a buffer on entry, bytes written to a file on exit. |
- Returns
- Status of operation.
- Return values
-
err::notsup | Operation is not supported on a given filesystem. |
Implemented in ecl::fat::file.
◆ seek()
Sets the file offset to a given value.
- Precondition
- Valid and opened file descriptor.
- Parameters
-
[in] | offt | New offset value. |
[in] | whence | Directs how to change offset:
- If set to seekdir::beg, the file offset shall be set to offset bytes.
- If set to seekdir::cur, the file offset shall be set to its current location plus offset.
- If set to is seekdir::end, the file offset shall be set to the size of the file plus offset.
|
- Returns
- Status of operation.
- Return values
-
err::notsup | Operation is not supported on a given filesystem. |
Implemented in ecl::fat::file.
◆ tell()
virtual err ecl::fs::file_descriptor::tell |
( |
off_t & |
offt | ) |
|
|
pure virtual |
Gets current file offset.
- Precondition
- Valid and opened file descriptor.
- Parameters
-
[out] | offt | Parameter to store offset into. |
- Returns
- Status of operation.
- Return values
-
err::notsup | Operation is not supported on a given filesystem. |
Implemented in ecl::fat::file.
◆ close()
virtual err ecl::fs::file_descriptor::close |
( |
| ) |
|
|
pure virtual |
Closes the file descriptor.
- Precondition
- Valid and opened file descriptor.
- Postcondition
- File descriptor is closed.
- Returns
- Status of operation.
Implemented in ecl::fat::file.
◆ m_inode
The documentation for this class was generated from the following files: