2022-11-14 21:46:44 -06:00
|
|
|
#ifndef FUSE_H
|
|
|
|
#define FUSE_H
|
|
|
|
|
2022-11-25 20:55:43 -06:00
|
|
|
#include <sys/types.h>
|
|
|
|
|
2022-11-25 18:03:45 -06:00
|
|
|
#define DEFAULTINODEMAX 128
|
|
|
|
#define DEFAULTBLOCKSIZE 512 // Size in bytes
|
|
|
|
|
2022-11-14 21:46:44 -06:00
|
|
|
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;
|
|
|
|
|
2022-11-25 18:03:45 -06:00
|
|
|
typedef struct BlockStruct
|
|
|
|
{
|
|
|
|
char byte[DEFAULTBLOCKSIZE];
|
|
|
|
} BlockStruct;
|
|
|
|
|
|
|
|
typedef struct InodeStruct
|
|
|
|
{
|
2022-11-25 20:55:43 -06:00
|
|
|
char filePath[256];
|
|
|
|
off_t fileSize;
|
|
|
|
BlockStruct dataBlock;
|
2022-11-25 18:03:45 -06:00
|
|
|
} InodeStruct;
|
|
|
|
|
|
|
|
typedef struct SuperBlockStruct
|
|
|
|
{
|
2022-11-25 20:55:43 -06:00
|
|
|
blksize_t blockSize;
|
|
|
|
blkcnt_t blockCount;
|
2022-11-25 18:03:45 -06:00
|
|
|
} SuperBlockStruct;
|
|
|
|
|
|
|
|
typedef struct FBLStruct
|
|
|
|
{
|
|
|
|
int freeList[DEFAULTINODEMAX/32];
|
|
|
|
} FBLStruct;
|
|
|
|
|
|
|
|
typedef struct FileSystemStruct
|
|
|
|
{
|
|
|
|
SuperBlockStruct superBlock;
|
2022-11-25 20:55:43 -06:00
|
|
|
FBLStruct fbl;
|
2022-11-25 18:03:45 -06:00
|
|
|
InodeStruct inodes[DEFAULTINODEMAX];
|
|
|
|
} FileSystemStruct;
|
|
|
|
|
2022-11-14 21:46:44 -06:00
|
|
|
void Fuse(int argc, char* argv[]);
|
2022-11-16 16:08:14 -06:00
|
|
|
void FuseGetArgs(int argc, char* argv[], fuseArgStruct* fuseArgs);
|
2022-11-14 21:46:44 -06:00
|
|
|
void FuseGivenTest(fuseArgStruct* fuseArgs, char* programPath);
|
|
|
|
void FuseStructInit(fuseArgStruct* fuseStruct);
|
|
|
|
void FuseUsageError(char* programPath);
|
|
|
|
int zerosize(int fd);
|
2022-11-25 18:03:45 -06:00
|
|
|
int FindEmptyBitPosition(int number);
|
2022-11-14 21:46:44 -06:00
|
|
|
|
|
|
|
#endif
|