Go to the documentation of this file.
37 FATAL(
"reading superblock failed: result = " << (
int) e);
43 FATAL(
"magic mismatch");
62 FATAL(
"reading group descriptor failed: result = " << (
int) e);
80 NOTICE(
"mounted at " << p);
114 ERROR(
"reading inode failed: result = " << (
int) e);
124 return (*
groups)[groupNum];
134 Size & numContiguous)
147 const u32 offsetBlock = inode->
block[blk];
152 if (inode->
block[i] == offsetBlock + numContiguous)
189 for (
Size i = 0; i < depth - 1; i++)
211 for (
Size i = blk + 1; i < numBlocks && (i % numPerBlock) != 0; i++)
le32 freeInodesCount
Free inodes remaining.
#define LINN_MAX_BLOCK_SIZE
Maximum blocksize.
#define NOTICE(msg)
Output a notice message.
HashTable< u32, LinnInode * > inodes
Inode cache.
le32 magic0
Allows detection of valid superblocks.
void setRoot(Directory *newRoot)
Change the filesystem root directory.
#define LINN_INODE_NUM_BLOCKS(super, inode)
Calculate the number of blocks used in an LinnInode.
le32 block[LINN_INODE_BLOCKS]
Pointers to blocks.
le32 magic1
Allows detection of valid superblocks.
Vector< LinnGroup * > * groups
Group descriptors.
void sendResponse(FileSystemMessage *msg) const
Send response for a FileSystemMessage.
Structure of a group descriptor.
Abstract filesystem class.
le32 inodesCount
Total number of inodes.
FileSystem::Result result
Result code.
virtual void fill(T value)
Fill the Sequence with the given value.
le32 inodeTable
Inode table contains pre-allocated inodes.
le32 freeBlocksCount
Number of free data blocks.
LinnInode * getInode(u32 inodeNum)
Read an inode from the filesystem.
unsigned long long u64
Unsigned 64-bit number.
LinnSuperBlock super
Describes the filesystem.
#define LINN_SUPER_NUM_PTRS(sb)
Calculate the number of block address pointers fitting in one block.
#define FATAL(msg)
Output a critical message and terminate program immediatly.
virtual bool contains(const K &key) const
Check if the given key exists.
LinnGroup * getGroup(u32 groupNum)
Read a group descriptor from the filesystem.
#define LINN_SUPER_OFFSET
Fixed offset in storage of the superblock.
Storage * storage
Provides storage.
#define LINN_SUPER_MAGIC1
Second magic number (randomly chosen bytes).
#define INFO(msg)
Output a regular message to standard output.
#define LINN_SUPER_MAGIC0
First magic number ('Linn').
#define NULL
NULL means zero.
unsigned int u32
Unsigned 32-bit number.
Structure of an inode on the disk in the LinnFS filesystem.
void notSupportedHandler(FileSystemMessage *msg)
Callback handler for unsupported operations.
unsigned int Size
Any sane size indicator cannot go negative.
LinnGroup * getGroupByInode(u32 inodeNum)
Read a group descriptor from the filesystem, given an inode number.
virtual int insert(const T &item)
Adds the given item to the Vector, if possible.
le32 groupsTable
Block address of the LinnGroup table.
#define LINN_GROUP_COUNT(sb)
Calculate the number of LinnGroups in a filesystem.
Represents an directory on a LinnFS filesystem.
#define LINN_INODE_ROOT
Root inode.
#define LINN_INODE_DIR_BLOCKS
Direct blocks.
#define assert(exp)
Insert program diagnostics.
#define ERROR(msg)
Output an error message.
Result
Result code for filesystem Actions.
le32 blocksCount
Total number of data blocks.
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.
struct LinnInode LinnInode
Structure of an inode on the disk in the LinnFS filesystem.
LinnFileSystem(const char *path, Storage *storage)
Class constructor function.
struct LinnGroup LinnGroup
Structure of a group descriptor.
Provides a storage device to build filesystems on top.
virtual bool insert(const K &key, const V &value)
Inserts the given item to the HashTable.
le32 inodesPerGroup
Number of inodes per group.
virtual const V value(const K &key, const V defaultValue=V()) const
Return the first value for the given key.
u64 getOffsetRange(const LinnInode *inode, const u32 blk, Size &numContiguous)
Calculates the offset inside storage for a given block.