Setup FS structure and set fs to point to struct
This commit is contained in:
+13
-2
@@ -51,6 +51,7 @@ void FuseGetArgs(int argc, char* argv[], fuseArgStruct* fuseArgs)
|
||||
// Given code for default functionality
|
||||
void FuseGivenTest(fuseArgStruct* fuseArgs, char* programPath)
|
||||
{
|
||||
FileSystemStruct fileSystem;
|
||||
if (!fuseArgs->filefsname)
|
||||
FuseUsageError(programPath);
|
||||
fuseArgs->fd = open(fuseArgs->fsname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
|
||||
@@ -74,7 +75,7 @@ void FuseGivenTest(fuseArgStruct* fuseArgs, char* programPath)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
MapFS(fuseArgs->fd);
|
||||
MapFS(&fileSystem, fuseArgs->fd);
|
||||
if (fuseArgs->newfs)
|
||||
FormatFS();
|
||||
LoadFS();
|
||||
@@ -86,7 +87,7 @@ void FuseGivenTest(fuseArgStruct* fuseArgs, char* programPath)
|
||||
ExtractFileFromFS(fuseArgs->toExtract);
|
||||
if(fuseArgs->list)
|
||||
ListFS();
|
||||
UnmapFS();
|
||||
UnmapFS(&fileSystem);
|
||||
}
|
||||
|
||||
// Initialize entire fuseStruct
|
||||
@@ -123,3 +124,13 @@ int zerosize(int fd)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Finds next empty bit in Free Block List
|
||||
int FindEmptyBitPosition(int number)
|
||||
{
|
||||
for (int i = 0; i < 32; i++)
|
||||
if ((~number & (1 << i)) == (1 << i))
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
+5
-7
@@ -4,9 +4,7 @@
|
||||
#include <sys/mman.h>
|
||||
#include "fuseactions.h"
|
||||
|
||||
unsigned char* fs;
|
||||
|
||||
void MapFS(int fd)
|
||||
void MapFS(FileSystemStruct* fs, int fd)
|
||||
{
|
||||
fs = mmap(NULL, FSSIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
if (fs == NULL)
|
||||
@@ -16,22 +14,22 @@ void MapFS(int fd)
|
||||
}
|
||||
}
|
||||
|
||||
void UnmapFS()
|
||||
void UnmapFS(FileSystemStruct* fs)
|
||||
{
|
||||
munmap(fs, FSSIZE);
|
||||
}
|
||||
|
||||
void FormatFS()
|
||||
void FormatFS(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LoadFS()
|
||||
void LoadFS(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ListFS()
|
||||
void ListFS(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user