-
Notifications
You must be signed in to change notification settings - Fork 1
/
sharedfile.h
78 lines (72 loc) · 1.54 KB
/
sharedfile.h
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
73
74
75
76
77
78
#define MAXINODE 50
#define READ 1
#define WRITE 2
#define MAXFILESIZE 1024
#define REGULAR 1
#define SPECIAL 2
#define START 0
#define CURRENT 1
#define END 2
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<unistd.h>
typedef struct superblock
{
int TotalInodes;
int FreeInode;
}SUPERBLOCK, *PSUPERBLOCK;
typedef struct inode
{
char FileName[50];
int InodeNumber;
int FileSize;
int FileActualSize;
int FileType;
char *Buffer;
int LinkCount;
int ReferenceCount;
int Permission;
struct inode *next;
}INODE, *PINODE, **PPINODE;
typedef struct filetable
{
int readoffset;
int writeoffset;
int count;
int mode;
PINODE ptrinode;
}FILETABLE, *PFILETABLE;
typedef struct ufdt
{
PFILETABLE ptrfiletable;
}UFDT;
class VirtualFS
{
private:
UFDT UFDTArr[50];
SUPERBLOCK SUPERBLOCKobj;
PINODE head;
public:
VirtualFS();
~VirtualFS();
virtual void man(char *);
virtual void initSuperBlock();
virtual void initInodeTable();
virtual void lsFile();
virtual void closeAllFile();
virtual void displayHelp();
virtual int statFile(char *);
virtual int fstatFile(int );
virtual int closeFileByName(char *);
virtual int getFDFromName(char *);
virtual int rmFile(char *);
virtual int truncateFile(char *);
virtual int writeFile(int , char *, int );
virtual int createFile(char *, int );
virtual PINODE getInode(char *);
virtual int openFile(char *,int );
virtual int readFile(int , char *, int );
virtual int lseekFile(int , int , int );
};