-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfiles.h
More file actions
113 lines (94 loc) · 2.3 KB
/
files.h
File metadata and controls
113 lines (94 loc) · 2.3 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
//
// Created by pedro on 26/09/2024.
// //
#ifndef S0_P0_FILES_H
#define S0_P0_FILES_H
#define MAX 2048
#include <stdbool.h>
enum status {FINISHED , STOPPED , SIGNALED, ACTIVE};
typedef struct file{
char filename[MAX];
int mode;
int descriptor;
}tfile;
typedef struct memory{
void *adress;
long size;
char date[MAX];
char method[MAX];
int kdf;
char filename[MAX];
}tmemory;
typedef struct process{
int PID;
char date[MAX];
enum status state;
char* comline;
}tprocess;
typedef struct directory{
char dirname[MAX];
}tdirectory;
typedef struct tNode* tPos;
typedef struct mNode* mPos;
typedef struct pNode* pPos;
typedef struct dNode* dPos;
struct tNode{
tfile data;
tPos next;
};
struct mNode{
tmemory data;
mPos next;
};
struct pNode{
tprocess data;
pPos next;
};
struct dNode{
tdirectory data;
dPos next;
};
typedef tPos tfilelist;
typedef mPos tmemlist;
typedef pPos tproclist;
typedef dPos tdirlist;
bool initfilelist(tfilelist* list);
bool isemptyfiles(tfilelist);
void createfilelist(tfilelist*);
void printopenfiles(tfilelist);
bool addfile(char *filename,int df, int mode,tfilelist*);
void closefile(tPos, tfilelist*);
tfile getfile (tPos p, tfilelist);
tPos findfile (int ,tfilelist);
void cd();
tPos first (tfilelist);
tPos last (tfilelist);
tPos previous (tPos, tfilelist);
void updatefile (tfile, tPos, tfilelist*);
void FreeFileList(tfilelist);
bool isemptymem(tmemlist);
void creatememlist(tmemlist*);
void printmemory(tmemlist, char*);
bool addmem(void *address,long size,char* date,char *method,char *filename,int kdf, tmemlist*);
mPos findmemad(void* adress,tmemlist*);
mPos findmemsz(int size,tmemlist*);
mPos findmemsh(int key,tmemlist*);
mPos findmemfl(char* filename,tmemlist*);
void closemem(mPos,tmemlist*);
void FreeMemList(tmemlist);
void createproclist(tproclist*);
bool isemptyproc(tproclist);
bool addproc(int,char*,char*,tproclist*);
void printproclist(tproclist);
pPos findproc(int pid, tproclist*);
void freeproclist(tproclist);
dPos SearchListFirst(tdirlist);
dPos SearchListNext();
void createdirlist(tdirlist*);
bool isemptydir(tdirlist);
bool adddir(tdirectory,tdirlist *);
dPos finddir(char* dir,tdirlist*);
bool removedir(dPos,tdirlist*);
void printdir(tdirlist);
void freedirlist(tdirlist);
#endif //S0_P0_FILES_H