FreeNOS
Public Member Functions | Private Attributes
LinnFile Class Reference

Represents a file on a mounted LinnFS filesystem. More...

#include <LinnFile.h>

Inheritance diagram for LinnFile:
File

Public Member Functions

 LinnFile (LinnFileSystem *fs, const u32 inode, LinnInode *inodeData)
 Constructor function. More...
 
virtual ~LinnFile ()
 Destructor function. More...
 
virtual FileSystem::Result read (IOBuffer &buffer, Size &size, const Size offset)
 Read bytes from the file. More...
 
- Public Member Functions inherited from File
 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 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...
 

Private Attributes

LinnFileSystemm_fs
 Filesystem pointer. More...
 
LinnInodem_inodeData
 Inode pointer. More...
 

Additional Inherited Members

- Protected Attributes inherited from File
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...
 

Detailed Description

Represents a file on a mounted LinnFS filesystem.

Definition at line 38 of file LinnFile.h.

Constructor & Destructor Documentation

◆ LinnFile()

LinnFile::LinnFile ( LinnFileSystem fs,
const u32  inode,
LinnInode inodeData 
)

Constructor function.

Parameters
fsLinnFS filesystem pointer.
inodeInode number
inodeDataInode data pointer.

Definition at line 22 of file LinnFile.cpp.

References File::m_access, m_inodeData, File::m_size, LinnInode::mode, and LinnInode::size.

◆ ~LinnFile()

LinnFile::~LinnFile ( )
virtual

Destructor function.

Definition at line 33 of file LinnFile.cpp.

Member Function Documentation

◆ read()

FileSystem::Result LinnFile::read ( IOBuffer buffer,
Size size,
const Size  offset 
)
virtual

Read bytes from the file.

Parameters
bufferInput/Output buffer to output bytes to.
sizeMaximum number of bytes to read on input. On output, the actual number of bytes read.
offsetOffset inside the file to start reading.
Returns
Result code

Reimplemented from File.

Definition at line 37 of file LinnFile.cpp.

References IOBuffer::addCount(), assert, LinnSuperBlock::blockSize, IOBuffer::getBuffer(), LinnFileSystem::getOffsetRange(), LinnFileSystem::getStorage(), LinnFileSystem::getSuperBlock(), FileSystem::IOError, LINN_INODE_NUM_BLOCKS, LINN_MAX_BLOCK_SIZE, m_fs, m_inodeData, Storage::read(), LinnInode::size, and FileSystem::Success.

Field Documentation

◆ m_fs

LinnFileSystem* LinnFile::m_fs
private

Filesystem pointer.

Definition at line 75 of file LinnFile.h.

Referenced by read().

◆ m_inodeData

LinnInode* LinnFile::m_inodeData
private

Inode pointer.

Definition at line 78 of file LinnFile.h.

Referenced by LinnFile(), and read().


The documentation for this class was generated from the following files: