FreeNOS
Data Structures | Macros
linncreate

The LinnCreate program can create a new LinnFS filesystem. More...

Data Structures

class  LinnCreate
 Class for creating new Linnenbank FileSystems. More...
 

Macros

#define LINN_CREATE_BLOCK_SIZE   2048
 Default block size.
 
#define LINN_CREATE_BLOCK_NUM   8192
 Default number of blocks to allocate.
 
#define LINN_CREATE_BLOCKS_PER_GROUP   8192
 Default number of data blocks per group descriptor.
 
#define LINN_CREATE_INODE_NUM   1024
 Default number of inodes to allocate.
 
#define LINN_CREATE_INODES_PER_GROUP   1024
 Default number of inodes per group descriptor.
 
#define BLOCKPTR(type, nr)   (type *)(blocks + (super->blockSize * (nr)))
 Returns a pointer to the correct in-memory block.
 
#define BLOCKS(sb, count)
 Retrieve a given number of free contiguous blocks.
 
#define BLOCK(sb)    BLOCKS(sb, (ulong)1)
 Retrieve one free block.
 
#define FILETYPE_FROM_ST(st)
 Convert from a (host system's) POSIX struct stat into a FileType.
 
#define FILEMODE_FROM_ST(st)    (FileSystem::FileMode)((st)->st_mode & 0777)
 Converts an (host system's) POSIX struct st into a FileMode.
 

Detailed Description

The LinnCreate program can create a new LinnFS filesystem.

Macro Definition Documentation

◆ BLOCK

#define BLOCK (   sb)     BLOCKS(sb, (ulong)1)

Retrieve one free block.

Parameters
sbLinnSuperBlock pointer.
Returns
Block number of a free block.

Definition at line 91 of file LinnCreate.h.

◆ BLOCKPTR

#define BLOCKPTR (   type,
  nr 
)    (type *)(blocks + (super->blockSize * (nr)))

Returns a pointer to the correct in-memory block.

Parameters
typeData type to return a pointer for.
nrBlock number.
Returns
A pointer of the given type.

Definition at line 62 of file LinnCreate.h.

◆ BLOCKS

#define BLOCKS (   sb,
  count 
)
Value:
({ \
if ((sb)->freeBlocksCount < (count)) \
{ \
printf("%s: not enough free blocks remaining (%lu needed)\n", \
prog, (ulong)(count)); \
exit(EXIT_FAILURE); \
} \
(sb)->freeBlocksCount -= (count); \
((sb)->blocksCount - (sb)->freeBlocksCount - (count)); \
})
#define EXIT_FAILURE
Unsuccessful termination.
Definition stdlib.h:36
unsigned long ulong
Unsigned long number.
Definition Types.h:47

Retrieve a given number of free contiguous blocks.

Parameters
sbLinnSuperBlock pointer.
countNumber of blocks
Returns
Block number of the first block in the contiguous array of blocks.

Definition at line 72 of file LinnCreate.h.

◆ FILEMODE_FROM_ST

#define FILEMODE_FROM_ST (   st)     (FileSystem::FileMode)((st)->st_mode & 0777)

Converts an (host system's) POSIX struct st into a FileMode.

Parameters
ststruct st pointer.
Returns
FileMode value.

Definition at line 126 of file LinnCreate.h.

◆ FILETYPE_FROM_ST

#define FILETYPE_FROM_ST (   st)
Value:
({ \
\
switch ((st)->st_mode & S_IFMT) \
{ \
case S_IFIFO: t = FileSystem::FIFOFile; break; \
case S_IFREG: t = FileSystem::RegularFile; break; \
case S_IFDIR: t = FileSystem::DirectoryFile; break; \
case S_IFLNK: t = FileSystem::SymlinkFile; break; \
case S_IFSOCK: t = FileSystem::SocketFile; break; \
default: break; \
} \
t; \
})
#define S_IFDIR
Directory.
Definition stat.h:73
#define S_IFREG
Regular.
Definition stat.h:70
#define S_IFSOCK
Socket.
Definition stat.h:79
#define S_IFIFO
FIFO special.
Definition stat.h:67
#define S_IFBLK
Block special.
Definition stat.h:61
#define S_IFMT
Type of file.
Definition stat.h:58
#define S_IFCHR
Character special.
Definition stat.h:64
#define S_IFLNK
Symbolic link.
Definition stat.h:76
FileType
All possible filetypes.
Definition FileSystem.h:71
@ CharacterDeviceFile
Definition FileSystem.h:75
@ BlockDeviceFile
Definition FileSystem.h:74

Convert from a (host system's) POSIX struct stat into a FileType.

Parameters
ststruct stat pointer.
Returns
FileType value.

Definition at line 101 of file LinnCreate.h.

◆ LINN_CREATE_BLOCK_NUM

#define LINN_CREATE_BLOCK_NUM   8192

Default number of blocks to allocate.

Definition at line 43 of file LinnCreate.h.

◆ LINN_CREATE_BLOCK_SIZE

#define LINN_CREATE_BLOCK_SIZE   2048

Default block size.

Definition at line 40 of file LinnCreate.h.

◆ LINN_CREATE_BLOCKS_PER_GROUP

#define LINN_CREATE_BLOCKS_PER_GROUP   8192

Default number of data blocks per group descriptor.

Definition at line 46 of file LinnCreate.h.

◆ LINN_CREATE_INODE_NUM

#define LINN_CREATE_INODE_NUM   1024

Default number of inodes to allocate.

Definition at line 49 of file LinnCreate.h.

◆ LINN_CREATE_INODES_PER_GROUP

#define LINN_CREATE_INODES_PER_GROUP   1024

Default number of inodes per group descriptor.

Definition at line 52 of file LinnCreate.h.