Go to the documentation of this file.
18 #ifndef __FILESYSTEM_LINN_CREATE_H
19 #define __FILESYSTEM_LINN_CREATE_H
40 #define LINN_CREATE_BLOCK_SIZE 2048
43 #define LINN_CREATE_BLOCK_NUM 8192
46 #define LINN_CREATE_BLOCKS_PER_GROUP 8192
49 #define LINN_CREATE_INODE_NUM 1024
52 #define LINN_CREATE_INODES_PER_GROUP 1024
62 #define BLOCKPTR(type,nr) (type *)(blocks + (super->blockSize * (nr)))
72 #define BLOCKS(sb,count) \
74 if ((sb)->freeBlocksCount < (count)) \
76 printf("%s: not enough free blocks remaining (%lu needed)\n", \
77 prog, (ulong)(count)); \
80 (sb)->freeBlocksCount -= (count); \
81 ((sb)->blocksCount - (sb)->freeBlocksCount - (count)); \
101 #define FILETYPE_FROM_ST(st) \
103 FileSystem::FileType t = FileSystem::UnknownFile; \
105 switch ((st)->st_mode & S_IFMT) \
107 case S_IFBLK: t = FileSystem::BlockDeviceFile; break; \
108 case S_IFCHR: t = FileSystem::CharacterDeviceFile; break; \
109 case S_IFIFO: t = FileSystem::FIFOFile; break; \
110 case S_IFREG: t = FileSystem::RegularFile; break; \
111 case S_IFDIR: t = FileSystem::DirectoryFile; break; \
112 case S_IFLNK: t = FileSystem::SymlinkFile; break; \
113 case S_IFSOCK: t = FileSystem::SocketFile; break; \
126 #define FILEMODE_FROM_ST(st) \
127 (FileSystem::FileMode)((st)->st_mode & 0777)
The <sys/stat.h> header shall define the stat structure.
char * prog
Program name we are invoked with.
LinnInode * createInode(le32 inodeNum, FileSystem::FileType type, FileSystem::FileModes mode, UserID uid=ZERO, GroupID gid=ZERO)
Creates an empty LinnInode.
char * image
Path to the output image.
FileType
All possible filetypes.
LinnCreate()
Class constructor.
unsigned short GroupID
Group Identity.
char * input
Path to the input directory.
int writeImage()
Writes the final image to disk.
LinnSuperBlock * super
Pointer to the superblock.
int create(Size blockSize, Size blockNum, Size inodeNum)
Creates the LinnFS FileSystem.
le32 insertIndirect(le32 *ptr, const le32 blockIndexNumber, const Size depth)
Inserts an indirect block address.
void setProgram(char *progName)
Set the program name we are invoked with.
void setInput(char *inputName)
Set the input directory name.
Linnenbank Filesystem (LinnFS) super block.
Structure of an inode on the disk in the LinnFS filesystem.
unsigned int Size
Any sane size indicator cannot go negative.
void setImage(char *imageName)
Set the output image file name.
void insertFile(char *inputFile, LinnInode *inode, struct stat *st)
Inserts the contents of a local file into an LinnInode.
u16 FileModes
Multiple FileMode values combined.
u32 BITWISE le32
Unsigned 32-bit little endian number.
List< String * > excludes
List of file patterns to ignore.
bool verbose
Output verbose messages.
unsigned short UserID
User Identity.
void insertDirectory(char *inputFile, le32 inodeNum, le32 parentNum)
Inserts the given directory and it's childs to the filesystem image.
unsigned char u8
Unsigned 8-bit number.
u8 * blocks
Array of blocks available in the filesystem.
void setExclude(char *pattern)
Exclude files matching the given pattern from the image.
void insertEntry(le32 dirInode, le32 entryInode, const char *name, FileSystem::FileType type)
Inserts an LinnDirectoryEntry to the given directory inode.
Class for creating new Linnenbank FileSystems.
void setVerbose(bool newVerbose)
Output verbose messages during the construction.