Cleaned up function names

This commit is contained in:
TriantaTV 2022-11-17 19:43:46 -06:00
parent cf001272db
commit 0b9eb0be9a
4 changed files with 27 additions and 61 deletions

View File

@ -5,13 +5,13 @@
extern unsigned char* fs;
void mapfs(int fd);
void unmapfs();
void formatfs();
void loadfs();
void lsfs();
void addfilefs(char* fname);
void removefilefs(char* fname);
void extractfilefs(char* fname);
void MapFS(int fd);
void UnmapFS();
void FormatFS();
void LoadFS();
void ListFS();
void AddFileToFS(char* fname);
void RemoveFileFromFS(char* fname);
void ExtractFileFromFS(char* fname);
#endif

View File

@ -14,7 +14,7 @@
void Fuse(int argc, char* argv[])
{
fuseArgStruct fuseArgs;
FuseCheckArgs(argc, argv, &fuseArgs);
FuseGetArgs(argc, argv, &fuseArgs);
FuseGivenTest(&fuseArgs, argv[0]);
}
@ -48,40 +48,6 @@ void FuseGetArgs(int argc, char* argv[], fuseArgStruct* fuseArgs)
}
}
// Originally given method for getting arguments
// Depreciated
void FuseCheckArgs(int argc, char* argv[], fuseArgStruct* fuseArgs)
{
int opt;
while ((opt = getopt(argc, argv, "la:r:e:f:")) != -1)
{
switch (opt)
{
case 'l':
fuseArgs->list = 1;
break;
case 'a':
fuseArgs->add = 1;
fuseArgs->toAdd = strdup(optarg);
break;
case 'r':
fuseArgs->remove = 1;
fuseArgs->toRemove = strdup(optarg);
break;
case 'e':
fuseArgs->extract = 1;
fuseArgs->toExtract = strdup(optarg);
break;
case 'f':
fuseArgs->filefsname = 1;
fuseArgs->fsname = strdup(optarg);
break;
default:
FuseUsageError(argv[0]);
}
}
}
// Given code for default functionality
void FuseGivenTest(fuseArgStruct* fuseArgs, char* programPath)
{
@ -108,19 +74,19 @@ void FuseGivenTest(fuseArgStruct* fuseArgs, char* programPath)
exit(EXIT_FAILURE);
}
}
mapfs(fuseArgs->fd);
MapFS(fuseArgs->fd);
if (fuseArgs->newfs)
formatfs();
loadfs();
FormatFS();
LoadFS();
if (fuseArgs->add)
addfilefs(fuseArgs->toAdd);
AddFileToFS(fuseArgs->toAdd);
if (fuseArgs->remove)
removefilefs(fuseArgs->toRemove);
RemoveFileFromFS(fuseArgs->toRemove);
if (fuseArgs->extract)
extractfilefs(fuseArgs->toExtract);
ExtractFileFromFS(fuseArgs->toExtract);
if(fuseArgs->list)
lsfs();
unmapfs();
ListFS();
UnmapFS();
}
// Initialize entire fuseStruct

View File

@ -6,7 +6,7 @@
unsigned char* fs;
void mapfs(int fd)
void MapFS(int fd)
{
fs = mmap(NULL, FSSIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (fs == NULL)
@ -16,37 +16,37 @@ void mapfs(int fd)
}
}
void unmapfs()
void UnmapFS()
{
munmap(fs, FSSIZE);
}
void formatfs()
void FormatFS()
{
}
void loadfs()
void LoadFS()
{
}
void lsfs()
void ListFS()
{
}
void addfilefs(char* fname)
void AddFileToFS(char* fname)
{
}
void removefilefs(char* fname)
void RemoveFileFromFS(char* fname)
{
}
void extractfilefs(char* fname)
void ExtractFileFromFS(char* fname)
{
}

View File

@ -24,7 +24,7 @@ void tearDown(void)
;
}
void Test_FuseGetArgs_Should_AddToDummy(void)
void Test_FuseGetArgs_Should_SetDummyArgs(void)
{
FuseGetArgs(argc, argv, &dummyFuse);
TEST_ASSERT_EQUAL(1, dummyFuse.list);
@ -42,6 +42,6 @@ void Test_FuseGetArgs_Should_AddToDummy(void)
int main(void)
{
UNITY_BEGIN();
RUN_TEST(Test_FuseGetArgs_Should_AddToDummy);
RUN_TEST(Test_FuseGetArgs_Should_SetDummyArgs);
return UNITY_END();
}