72 lines
1.3 KiB
C
72 lines
1.3 KiB
C
#ifndef FUSESTRUCTS_H
|
|
#define FUSESTRUCTS_H
|
|
|
|
#define DEFAULTINODEMAX 128
|
|
#define DEFAULTBLOCKSIZE 512 // Size in bytes
|
|
#define DEFAULTBLOCKMAX 16384
|
|
#define FSSIZE 10000000
|
|
|
|
extern unsigned char* tempfs;
|
|
|
|
typedef struct fuseArgStruct
|
|
{
|
|
int create;
|
|
int list;
|
|
int add;
|
|
int remove;
|
|
int extract;
|
|
char* toAdd;
|
|
char* toRemove;
|
|
char* toExtract;
|
|
char* fsname;
|
|
int fd;
|
|
int newfs;
|
|
int filefsname;
|
|
} fuseArgStruct;
|
|
|
|
typedef struct SuperBlock
|
|
{
|
|
blksize_t blockSize;
|
|
blkcnt_t blockCount;
|
|
unsigned long inodeCount;
|
|
} SuperBlock;
|
|
|
|
typedef struct FreeBlockList
|
|
{
|
|
int freeList[DEFAULTBLOCKMAX/32];
|
|
} FreeBlockList;
|
|
|
|
// 128 Blocks
|
|
typedef struct DataBlock
|
|
{
|
|
char byte[DEFAULTBLOCKSIZE];
|
|
} DataBlock;
|
|
|
|
// Inode * 128 + number
|
|
// Directblock == Files/Directories inside an inode?
|
|
typedef struct DirectBlock
|
|
{
|
|
unsigned int isValid : 1;
|
|
unsigned int isDirectory : 1;
|
|
char name[256];
|
|
ino_t inode;
|
|
off_t size;
|
|
} DirectBlock;
|
|
|
|
// Inode 0 is root
|
|
// Inode * 128
|
|
typedef struct Inode
|
|
{
|
|
unsigned int isValid : 1;
|
|
DirectBlock blocks[DEFAULTINODEMAX];
|
|
} Inode;
|
|
|
|
typedef struct FileSystem
|
|
{
|
|
SuperBlock superBlock;
|
|
FreeBlockList fbl;
|
|
Inode inodes[DEFAULTINODEMAX];
|
|
DataBlock dataBlocks[DEFAULTBLOCKMAX];
|
|
} FileSystem;
|
|
|
|
#endif |