Miosix
2.0alpha1
|
#include <file.h>
Public Member Functions | |
FileBase (intrusive_ref_ptr< FilesystemBase > parent) | |
virtual ssize_t | write (const void *data, size_t len)=0 |
virtual ssize_t | read (void *data, size_t len)=0 |
virtual off_t | lseek (off_t pos, int whence)=0 |
virtual int | fstat (struct stat *pstat) const =0 |
virtual int | isatty () const |
virtual int | fcntl (int cmd, int opt) |
virtual int | ioctl (int cmd, void *arg) |
virtual int | getdents (void *dp, int len) |
const intrusive_ref_ptr < FilesystemBase > | getParent () const |
virtual | ~FileBase () |
Additional Inherited Members | |
Protected Member Functions inherited from miosix::IntrusiveRefCounted | |
IntrusiveRefCounted () | |
IntrusiveRefCounted (const IntrusiveRefCounted &) | |
IntrusiveRefCounted & | operator= (const IntrusiveRefCounted &) |
The unix file abstraction. Also some device drivers are seen as files. Classes of this type are reference counted, must be allocated on the heap and managed through intrusive_ref_ptr<FileBase>
miosix::FileBase::FileBase | ( | intrusive_ref_ptr< FilesystemBase > | parent | ) |
Constructor
parent | the filesystem to which this file belongs |
|
virtual |
File destructor
|
virtual |
Perform various operations on a file descriptor
cmd | specifies the operation to perform |
opt | optional argument that some operation require |
|
pure virtual |
Return file information.
pstat | pointer to stat struct |
Implemented in miosix::Fat32File, miosix::DirectoryBase, miosix::DevFsFile, and miosix::TerminalDevice.
|
virtual |
Also directories can be opened as files. In this case, this system call allows to retrieve directory entries.
dp | pointer to a memory buffer where one or more struct dirent will be placed. dp must be four words aligned. |
len | memory buffer size. |
Reimplemented in miosix::Fat32Directory, and miosix::MountpointFsDirectory.
|
inline |
|
virtual |
Perform various operations on a file descriptor
cmd | specifies the operation to perform |
arg | optional argument that some operation require |
Reimplemented in miosix::Fat32File, miosix::DevFsFile, and miosix::TerminalDevice.
|
virtual |
Check whether the file refers to a terminal.
Reimplemented in miosix::DevFsFile, and miosix::TerminalDevice.
|
pure virtual |
Move file pointer, if the file supports random-access.
pos | offset to sum to the beginning of the file, current position or end of file, depending on whence |
whence | SEEK_SET, SEEK_CUR or SEEK_END |
Implemented in miosix::Fat32File, miosix::DirectoryBase, miosix::DevFsFile, and miosix::TerminalDevice.
|
pure virtual |
Read data from the file, if the file supports reading.
data | buffer to store read data |
len | the number of bytes to read |
Implemented in miosix::Fat32File, miosix::DirectoryBase, miosix::DevFsFile, and miosix::TerminalDevice.
|
pure virtual |
Write data to the file, if the file supports writing.
data | the data to write |
len | the number of bytes to write |
Implemented in miosix::Fat32File, miosix::DirectoryBase, miosix::DevFsFile, and miosix::TerminalDevice.