-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfsInit.c
72 lines (52 loc) · 1.4 KB
/
fsInit.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**************************************************************
* Class: CSC-415-03 Spring 2023
* Names: Danial Tahir, Chris Camano, Mahek Delawala, Savjot Dhillon
* Student IDs: 920838929, 921642160, 922968394, 918239054
* GitHub Name: DanTahir
* Group Name: Segfault
* Project: Basic File System
*
* File: fsInit.c
*
* Description: Main driver for file system assignment.
*
* This file is where you will start and initialize your system
*
**************************************************************/
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include "fsLow.h"
#include "mfs.h"
int initFileSystem (uint64_t numberOfBlocks, uint64_t blockSize)
{
printf ("Initializing File System with %ld blocks with a block size of %ld\n", numberOfBlocks, blockSize);
/* TODO: Add any code you need to initialize your file system. */
uint64_t retVal = isVCBSet(blockSize);
printf("isvcbset returns %lu\n", retVal);
if (retVal == 0){
printf("running setVCB\n");
setVCB(numberOfBlocks, blockSize);
bitmapInit();
printf("getting VCB\n");
VCB * vcb = getVCBG();
printf("writing root directory\n");
dirInitNew(vcb->rootDirStart);
free(vcb);
vcb=NULL;
}
else {
}
VCB * vcb = getVCBG();
dirInitWorking(vcb->rootDirStart);
free(vcb);
vcb=NULL;
return 0;
}
void exitFileSystem ()
{
printf ("System exiting\n");
dirFreeWorking();
}