FreeNOS
Modules | Data Structures | Macros | Typedefs
LinnFS

The Linnenbank Filesystem (LinnFS) provides an inode based filesystem similar to Ext2. More...

Modules

 linncreate
 The LinnCreate program can create a new LinnFS filesystem.
 

Data Structures

class  LinnDirectory
 Represents an directory on a LinnFS filesystem. More...
 
struct  LinnDirectoryEntry
 Struct of an directory entry in LinnFS. More...
 
class  LinnFile
 Represents a file on a mounted LinnFS filesystem. More...
 
class  LinnFileSystem
 Linnenbank FileSystem (LinnFS). More...
 
struct  LinnGroup
 Structure of a group descriptor. More...
 
struct  LinnInode
 Structure of an inode on the disk in the LinnFS filesystem. More...
 
struct  LinnSuperBlock
 Linnenbank Filesystem (LinnFS) super block. More...
 

Macros

#define LINN_DIRENT_PER_BLOCK(sb)   ((sb)->blockSize / sizeof(LinnDirectoryEntry))
 Calculates the number of LinnDirectoryEntry's fitting in one block. More...
 
#define LINN_DIRENT_NAME_LEN   59
 Length of the name field in an directory entry. More...
 
#define LINNFS_ROOTFS_FILE   "./rootfs.linn"
 Default filename of the embedded root filesystem (ramfs) More...
 

Typedefs

typedef struct LinnDirectoryEntry LinnDirectoryEntry
 Struct of an directory entry in LinnFS. More...
 
typedef struct LinnGroup LinnGroup
 Structure of a group descriptor. More...
 
typedef struct LinnInode LinnInode
 Structure of an inode on the disk in the LinnFS filesystem. More...
 
typedef struct LinnSuperBlock LinnSuperBlock
 Linnenbank Filesystem (LinnFS) super block. More...
 

Filesystem limits.

#define LINN_MIN_BLOCK_SIZE   1024
 Minimum blocksize. More...
 
#define LINN_MAX_BLOCK_SIZE   4096
 Maximum blocksize. More...
 

LinnGroup Block Index numbers.

#define LINN_GROUP_BLOCK_BITMAP   0
 Block index of the block bitmap. More...
 
#define LINN_GROUP_INODE_BITMAP   1
 Block index of the inode bitmap. More...
 
#define LINN_GROUP_INODE_TABLE   2
 Block index of the inode table. More...
 

LinnGroup Macros.

#define LINN_GROUP_COUNT(sb)
 Calculate the number of LinnGroups in a filesystem. More...
 
#define LINN_GROUP_NUM_BLOCKMAP(sb)
 Calculate the number of blocks needed for the blocks bitmap. More...
 
#define LINN_GROUP_NUM_INODEMAP(sb)
 Calculate the number of blocks needed for the inodes bitmap. More...
 
#define LINN_GROUP_NUM_INODETAB(sb)
 Calculate the number of blocks needed for the inodes table. More...
 
#define LINN_GROUP_PER_BLOCK(sb)   ((sb)->blockSize / sizeof(LinnGroup))
 Calculate the number of LinnGroups which fit in one block. More...
 
#define LINN_GROUP_BLOCKS(sb)
 Number of blocks needed to store LinnGroups. More...
 

Special Inode Numbers

#define LINN_INODE_ROOT   0
 Root inode. More...
 

Inode (in)direct block counts.

#define LINN_INODE_DIR_BLOCKS   4
 Direct blocks. More...
 
#define LINN_INODE_IND_BLOCKS   (LINN_INODE_DIR_BLOCKS + 1)
 Indirect blocks. More...
 
#define LINN_INODE_DIND_BLOCKS   (LINN_INODE_IND_BLOCKS + 1)
 Double indirect blocks. More...
 
#define LINN_INODE_TIND_BLOCKS   (LINN_INODE_DIND_BLOCKS + 1)
 Triple indirect blocks. More...
 
#define LINN_INODE_BLOCKS   (LINN_INODE_TIND_BLOCKS + 1)
 Total number of block pointers in an LinnInode. More...
 

Inode macros.

#define LINN_INODE_NUM_BLOCKS(super, inode)
 Calculate the number of blocks used in an LinnInode. More...
 

Magic Numbers.

#define LINN_SUPER_MAGIC0   0x4c696e6e
 First magic number ('Linn'). More...
 
#define LINN_SUPER_MAGIC1   0x512ea9b0
 Second magic number (randomly chosen bytes). More...
 

Revision Numbers.

#define LINN_SUPER_MAJOR   1
 Current major revision number. More...
 
#define LINN_SUPER_MINOR   0
 Current minor revision number. More...
 

Filesystem States.

#define LINN_SUPER_VALID   0
 Filesystem is consistent. More...
 
#define LINN_SUPER_UNCLEAN   1
 The filesystem has not been properly unmounted. More...
 
#define LINN_SUPER_CORRUPT   2
 Serious corruption has been detected. More...
 

Superblock Constants.

#define LINN_SUPER_OFFSET   1024
 Fixed offset in storage of the superblock. More...
 

Superblock Macros.

#define LINN_SUPER_NUM_PTRS(sb)   ((sb)->blockSize / sizeof(u32))
 Calculate the number of block address pointers fitting in one block. More...
 

Detailed Description

The Linnenbank Filesystem (LinnFS) provides an inode based filesystem similar to Ext2.

Macro Definition Documentation

◆ LINN_DIRENT_NAME_LEN

#define LINN_DIRENT_NAME_LEN   59

Length of the name field in an directory entry.

Definition at line 39 of file LinnDirectoryEntry.h.

◆ LINN_DIRENT_PER_BLOCK

#define LINN_DIRENT_PER_BLOCK (   sb)    ((sb)->blockSize / sizeof(LinnDirectoryEntry))

Calculates the number of LinnDirectoryEntry's fitting in one block.

Returns
Number of entries.

Definition at line 35 of file LinnDirectoryEntry.h.

◆ LINN_GROUP_BLOCK_BITMAP

#define LINN_GROUP_BLOCK_BITMAP   0

Block index of the block bitmap.

Definition at line 38 of file LinnGroup.h.

◆ LINN_GROUP_BLOCKS

#define LINN_GROUP_BLOCKS (   sb)
Value:
LINN_GROUP_COUNT(sb) / LINN_GROUP_PER_BLOCK(sb) : 1)

Number of blocks needed to store LinnGroups.

Parameters
sbLinnSuperBlock pointer.
Returns
Number of blocks required for LinnGroups.

Definition at line 118 of file LinnGroup.h.

◆ LINN_GROUP_COUNT

#define LINN_GROUP_COUNT (   sb)
Value:
((sb)->blocksCount / (sb)->blocksPerGroup ? \
(sb)->blocksCount / (sb)->blocksPerGroup : 1)

Calculate the number of LinnGroups in a filesystem.

Calculation is based on the blocksCount and blocksPerGroup fields.

Parameters
sbLinnSuperBlock pointer.
Returns
Number of LinnGroups in the filesystem.

Definition at line 64 of file LinnGroup.h.

◆ LINN_GROUP_INODE_BITMAP

#define LINN_GROUP_INODE_BITMAP   1

Block index of the inode bitmap.

Definition at line 41 of file LinnGroup.h.

◆ LINN_GROUP_INODE_TABLE

#define LINN_GROUP_INODE_TABLE   2

Block index of the inode table.

Definition at line 44 of file LinnGroup.h.

◆ LINN_GROUP_NUM_BLOCKMAP

#define LINN_GROUP_NUM_BLOCKMAP (   sb)
Value:
((sb)->blocksPerGroup / LINN_SUPER_NUM_PTRS(sb) ? \
(sb)->blocksPerGroup / LINN_SUPER_NUM_PTRS(sb) : 1)

Calculate the number of blocks needed for the blocks bitmap.

Parameters
sbLinnSuperBlock pointer.
Returns
Number of blocks needed for the blocks bitmap.

Definition at line 75 of file LinnGroup.h.

◆ LINN_GROUP_NUM_INODEMAP

#define LINN_GROUP_NUM_INODEMAP (   sb)
Value:
((sb)->inodesPerGroup / LINN_SUPER_NUM_PTRS(sb) ? \
(sb)->inodesPerGroup / LINN_SUPER_NUM_PTRS(sb) : 1)

Calculate the number of blocks needed for the inodes bitmap.

Parameters
sbLinnSuperBlock pointer.
Returns
Number of blocks needed for the inodes bitmap.

Definition at line 86 of file LinnGroup.h.

◆ LINN_GROUP_NUM_INODETAB

#define LINN_GROUP_NUM_INODETAB (   sb)
Value:
((sb)->inodesPerGroup / ((sb)->blockSize / sizeof(LinnInode)) ? \
(sb)->inodesPerGroup / ((sb)->blockSize / sizeof(LinnInode)) : 1)

Calculate the number of blocks needed for the inodes table.

Parameters
sbLinnSuperBlock pointer.
Returns
Number of blocks needed for the inodes table.

Definition at line 97 of file LinnGroup.h.

◆ LINN_GROUP_PER_BLOCK

#define LINN_GROUP_PER_BLOCK (   sb)    ((sb)->blockSize / sizeof(LinnGroup))

Calculate the number of LinnGroups which fit in one block.

Parameters
sbLinnSuperBlock pointer.
Returns
Number of LinnGroups per block.

Definition at line 108 of file LinnGroup.h.

◆ LINN_INODE_BLOCKS

#define LINN_INODE_BLOCKS   (LINN_INODE_TIND_BLOCKS + 1)

Total number of block pointers in an LinnInode.

Definition at line 61 of file LinnInode.h.

◆ LINN_INODE_DIND_BLOCKS

#define LINN_INODE_DIND_BLOCKS   (LINN_INODE_IND_BLOCKS + 1)

Double indirect blocks.

Definition at line 55 of file LinnInode.h.

◆ LINN_INODE_DIR_BLOCKS

#define LINN_INODE_DIR_BLOCKS   4

Direct blocks.

Definition at line 49 of file LinnInode.h.

◆ LINN_INODE_IND_BLOCKS

#define LINN_INODE_IND_BLOCKS   (LINN_INODE_DIR_BLOCKS + 1)

Indirect blocks.

Definition at line 52 of file LinnInode.h.

◆ LINN_INODE_NUM_BLOCKS

#define LINN_INODE_NUM_BLOCKS (   super,
  inode 
)
Value:
((inode)->size % (super)->blockSize ? \
(inode)->size / (super)->blockSize + 1 : \
(inode)->size / (super)->blockSize)

Calculate the number of blocks used in an LinnInode.

Parameters
superLinnSuperBlock pointer.
inodeLinnInode pointer.
Returns
Number of blocks used.

Definition at line 80 of file LinnInode.h.

◆ LINN_INODE_ROOT

#define LINN_INODE_ROOT   0

Root inode.

Definition at line 37 of file LinnInode.h.

◆ LINN_INODE_TIND_BLOCKS

#define LINN_INODE_TIND_BLOCKS   (LINN_INODE_DIND_BLOCKS + 1)

Triple indirect blocks.

Definition at line 58 of file LinnInode.h.

◆ LINN_MAX_BLOCK_SIZE

#define LINN_MAX_BLOCK_SIZE   4096

Maximum blocksize.

Definition at line 51 of file LinnFileSystem.h.

◆ LINN_MIN_BLOCK_SIZE

#define LINN_MIN_BLOCK_SIZE   1024

Minimum blocksize.

Definition at line 48 of file LinnFileSystem.h.

◆ LINN_SUPER_CORRUPT

#define LINN_SUPER_CORRUPT   2

Serious corruption has been detected.

Definition at line 73 of file LinnSuperBlock.h.

◆ LINN_SUPER_MAGIC0

#define LINN_SUPER_MAGIC0   0x4c696e6e

First magic number ('Linn').

Used to detect a valid superblock.

Definition at line 37 of file LinnSuperBlock.h.

◆ LINN_SUPER_MAGIC1

#define LINN_SUPER_MAGIC1   0x512ea9b0

Second magic number (randomly chosen bytes).

Definition at line 40 of file LinnSuperBlock.h.

◆ LINN_SUPER_MAJOR

#define LINN_SUPER_MAJOR   1

Current major revision number.

Definition at line 52 of file LinnSuperBlock.h.

◆ LINN_SUPER_MINOR

#define LINN_SUPER_MINOR   0

Current minor revision number.

Definition at line 55 of file LinnSuperBlock.h.

◆ LINN_SUPER_NUM_PTRS

#define LINN_SUPER_NUM_PTRS (   sb)    ((sb)->blockSize / sizeof(u32))

Calculate the number of block address pointers fitting in one block.

Parameters
sbLinnSuperBlock pointer.
Returns
Number of block address pointers.

Definition at line 103 of file LinnSuperBlock.h.

◆ LINN_SUPER_OFFSET

#define LINN_SUPER_OFFSET   1024

Fixed offset in storage of the superblock.

Definition at line 85 of file LinnSuperBlock.h.

◆ LINN_SUPER_UNCLEAN

#define LINN_SUPER_UNCLEAN   1

The filesystem has not been properly unmounted.

Definition at line 70 of file LinnSuperBlock.h.

◆ LINN_SUPER_VALID

#define LINN_SUPER_VALID   0

Filesystem is consistent.

Definition at line 67 of file LinnSuperBlock.h.

◆ LINNFS_ROOTFS_FILE

#define LINNFS_ROOTFS_FILE   "./rootfs.linn"

Default filename of the embedded root filesystem (ramfs)

Definition at line 40 of file LinnFileSystem.h.

Typedef Documentation

◆ LinnDirectoryEntry

Struct of an directory entry in LinnFS.

◆ LinnGroup

typedef struct LinnGroup LinnGroup

Structure of a group descriptor.

◆ LinnInode

typedef struct LinnInode LinnInode

Structure of an inode on the disk in the LinnFS filesystem.

◆ LinnSuperBlock

Linnenbank Filesystem (LinnFS) super block.

LINN_SUPER_NUM_PTRS
#define LINN_SUPER_NUM_PTRS(sb)
Calculate the number of block address pointers fitting in one block.
Definition: LinnSuperBlock.h:103
LINN_GROUP_PER_BLOCK
#define LINN_GROUP_PER_BLOCK(sb)
Calculate the number of LinnGroups which fit in one block.
Definition: LinnGroup.h:108
LINN_GROUP_COUNT
#define LINN_GROUP_COUNT(sb)
Calculate the number of LinnGroups in a filesystem.
Definition: LinnGroup.h:64
LinnInode
struct LinnInode LinnInode
Structure of an inode on the disk in the LinnFS filesystem.