Go to the documentation of this file.
18 #include <FreeNOS/User.h>
27 , m_inodeData(inodeData)
43 Size bytes = 0, blockNr = 0, blockCount;
44 u64 storageOffset, copyOffset = offset;
50 while ((sb->
blockSize * (blockNr + 1)) <= copyOffset)
59 while (blockNr < inodeNumBlocks && total < size && m_inodeData->size - (offset + total) > 0)
65 bytes = (blockCount * sb->
blockSize) - copyOffset;
74 if (bytes > size - total)
90 blockNr += blockCount;
#define LINN_MAX_BLOCK_SIZE
Maximum blocksize.
LinnFileSystem * m_fs
Filesystem pointer.
#define LINN_INODE_NUM_BLOCKS(super, inode)
Calculate the number of blocks used in an LinnInode.
void addCount(const Size bytes)
Increment byte counter.
Linnenbank FileSystem (LinnFS).
LinnFile(LinnFileSystem *fs, const u32 inode, LinnInode *inodeData)
Constructor function.
Storage * getStorage()
Get the underlying Storage object.
Represents a file present on a FileSystem.
unsigned long long u64
Unsigned 64-bit number.
FileSystem::FileModes m_access
Access permissions.
Size m_size
Size of the file, in bytes.
Linnenbank Filesystem (LinnFS) super block.
Abstract Input/Output buffer.
virtual FileSystem::Result read(IOBuffer &buffer, Size &size, const Size offset)
Read bytes from the file.
unsigned int u32
Unsigned 32-bit number.
Structure of an inode on the disk in the LinnFS filesystem.
LinnInode * m_inodeData
Inode pointer.
unsigned int Size
Any sane size indicator cannot go negative.
virtual ~LinnFile()
Destructor function.
u8 * getBuffer()
Get raw buffer.
le16 mode
Access permissions, as an FileMode.
#define assert(exp)
Insert program diagnostics.
Result
Result code for filesystem Actions.
le32 blockSize
Size of each data block.
virtual FileSystem::Result read(const u64 offset, void *buffer, const Size size) const =0
Read a contiguous set of data.
LinnSuperBlock * getSuperBlock()
Retrieve the superblock pointer.
u64 getOffsetRange(const LinnInode *inode, const u32 blk, Size &numContiguous)
Calculates the offset inside storage for a given block.