fuse/include/fuse.h

72 lines
1.6 KiB
C
Raw Normal View History

2022-11-14 21:46:44 -06:00
#ifndef FUSE_H
#define FUSE_H
#include <sys/types.h>
#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;
typedef struct SuperBlockStruct
{
blksize_t blockSize;
blkcnt_t blockCount;
} SuperBlockStruct;
typedef struct FBLStruct
{
int freeList[DEFAULTINODEMAX/32];
} FBLStruct;
typedef struct BlockStruct
{
char byte[DEFAULTBLOCKSIZE];
} BlockStruct;
2022-12-02 13:35:38 -06:00
// TODO: Adjust Inodes to be 128 inodes with 128 direct block references *each*
// Slides exist for inode structure
typedef struct InodeStruct
{
char filePath[256];
off_t fileSize;
BlockStruct dataBlock;
} InodeStruct;
typedef struct FileSystemStruct
{
SuperBlockStruct superBlock;
FBLStruct fbl;
InodeStruct inodes[DEFAULTINODEMAX];
} FileSystemStruct;
2022-11-14 21:46:44 -06:00
void Fuse(int argc, char* argv[]);
2022-12-02 13:35:38 -06:00
void GetArguments(int argc, char* argv[], fuseArgStruct* fuseArgs);
void OpenFS(fuseArgStruct* fuseArgs, char* programPath);
FileSystemStruct* SetupFS(fuseArgStruct* fuseArgs);
void RunFuse(FileSystemStruct* fs, fuseArgStruct* fuseArgs);
void TearDownFS(void);
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);
int FindEmptyBitPosition(int number);
ino_t GetFreeInodeNumber(int fbl[]);
void SetFileSystemDefaults(FileSystemStruct* fs);
2022-11-14 21:46:44 -06:00
#endif