FreeNOS
|
Represents a file present on a FileSystem. More...
#include <File.h>
Public Member Functions | |
File (const u32 inode, const FileSystem::FileType type=FileSystem::RegularFile, const UserID uid=ZERO, const GroupID gid=ZERO) | |
Constructor function. More... | |
virtual | ~File () |
Destructor function. More... | |
u32 | getInode () const |
Get inode number. More... | |
FileSystem::FileType | getType () const |
Retrieve our filetype. More... | |
virtual FileSystem::Result | read (IOBuffer &buffer, Size &size, const Size offset) |
Read bytes from the file. More... | |
virtual FileSystem::Result | write (IOBuffer &buffer, Size &size, const Size offset) |
Write bytes to the file. More... | |
virtual FileSystem::Result | status (FileSystem::FileStat &st) |
Retrieve file statistics. More... | |
virtual bool | canRead () const |
Check if the File has data ready for reading. More... | |
virtual bool | canWrite () const |
Check if the File can be written to. More... | |
Protected Attributes | |
const u32 | m_inode |
Inode number. More... | |
const FileSystem::FileType | m_type |
Type of this file. More... | |
UserID | m_uid |
Owner of the file. More... | |
GroupID | m_gid |
Group of the file. More... | |
FileSystem::FileModes | m_access |
Access permissions. More... | |
Size | m_size |
Size of the file, in bytes. More... | |
File::File | ( | const u32 | inode, |
const FileSystem::FileType | type = FileSystem::RegularFile , |
||
const UserID | uid = ZERO , |
||
const GroupID | gid = ZERO |
||
) |
|
virtual |
|
virtual |
u32 File::getInode | ( | ) | const |
Get inode number.
Definition at line 38 of file File.cpp.
References m_inode.
Referenced by FileSystemServer::clearFileCache(), FileSystemServer::insertFileCache(), and FileSystemServer::lookupFile().
FileSystem::FileType File::getType | ( | ) | const |
Retrieve our filetype.
Definition at line 43 of file File.cpp.
References m_type.
Referenced by FileSystemServer::lookupFile(), and FileSystemServer::registerFile().
|
virtual |
Read bytes from the file.
buffer | Input/Output buffer to output bytes to. |
size | Maximum number of bytes to read on input. On output, the actual number of bytes read. |
offset | Offset inside the file to start reading. |
Reimplemented in ATAController, Terminal, NS16550, VGA, Time, PL011, i8250, Directory, Keyboard, ICMPSocket, UDPSocket, LinnDirectory, PseudoFile, ARPSocket, LinnFile, ICMPFactory, UDPFactory, EthernetAddress, IPV4Address, and LogLevelFile.
Definition at line 48 of file File.cpp.
References FileSystem::NotSupported.
Referenced by FileSystemServer::inodeHandler().
|
virtual |
Retrieve file statistics.
st | File statistics output struct |
Definition at line 62 of file File.cpp.
References FileSystem::FileStat::access, FileSystem::FileStat::groupID, FileSystem::FileStat::inode, m_access, m_gid, m_inode, m_size, m_type, m_uid, FileSystem::FileStat::size, FileSystem::Success, FileSystem::FileStat::type, and FileSystem::FileStat::userID.
Referenced by Sun8iEmac::interrupt(), ATAController::pollReady(), and FileSystemServer::processRequest().
|
virtual |
Write bytes to the file.
buffer | Input/Output buffer to input bytes from. |
size | Maximum number of bytes to write on input. On output, the actual number of bytes written. |
offset | Offset inside the file to start writing. |
Reimplemented in Terminal, NS16550, VGA, PL011, i8250, ICMPSocket, UDPSocket, PseudoFile, ARPSocket, EthernetAddress, IPV4Address, and LogLevelFile.
Definition at line 55 of file File.cpp.
References FileSystem::NotSupported.
Referenced by FileSystemServer::inodeHandler(), and DeviceLog::write().
|
protected |
Access permissions.
Definition at line 145 of file File.h.
Referenced by LinnDirectory::LinnDirectory(), LinnFile::LinnFile(), LogLevelFile::LogLevelFile(), PseudoFile::PseudoFile(), and status().
|
protected |
|
protected |
|
protected |
Size of the file, in bytes.
Definition at line 148 of file File.h.
Referenced by EthernetAddress::EthernetAddress(), Directory::insert(), IPV4Address::IPV4Address(), LinnDirectory::LinnDirectory(), LinnFile::LinnFile(), PseudoFile::PseudoFile(), EthernetAddress::read(), IPV4Address::read(), PseudoFile::read(), Directory::remove(), status(), and PseudoFile::write().
|
protected |
|
protected |