-
Notifications
You must be signed in to change notification settings - Fork 0
/
structures.h
198 lines (170 loc) · 3.12 KB
/
structures.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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#ifndef STRUCTURES_H
#define STRUCTURES_H
#include <enums.h>
#include <iostream>
//info of partitions
struct Partition
{
char part_status;
char part_type;
char part_fit;
int part_start;
long part_size;
char part_name[16];
};
//info of disk
struct MBR
{
long mbr_tamanio;
char mbr_fecha_creacion[16];
int mbr_disk_signature;
char disk_fit;
Partition particiones[4];
};
//info of extended partitions
//list with pointers to the next EBR
//null = -1
struct EBR
{
char part_status;
char part_fit;
int part_start;
long part_size;
int part_next;
char part_name[16];
};
class virtualBlock{
public:
long size;
int start;
statusBlock status;
virtualBlock *next;
virtualBlock();
virtualBlock(int,int, statusBlock);
};
class MountedPart{
public:
char name[75];
char id[10];
int start;
};
class MountedDisk{
public:
char path[100];
char letter;
MountedPart *parts[60];
MountedDisk(){
int i;
for(i=0;i<60;i++)
parts[i]=NULL;
}
};
//FASE 2 **************************************************************
struct SuperBlock{
int s_filesystem_type;
int s_inodes_count;
int s_blocks_count;
int s_free_blocks_count;
int s_free_inodes_count;
char s_mtime[16];
char s_umtime[16];
int s_mnt_count;
int s_magic;
int s_inode_size;
int s_block_size;
int s_firts_ino;
int s_first_blo;
int s_bm_inode_start;
int s_bm_block_start;
int s_inode_start;
int s_block_start;
};
struct Inodo{
int i_uid;
int i_gid;
int i_size;
char i_atime[16];
char i_ctime[16];
char i_mtime[16];
int i_block[15];
TypeInode i_type;
int i_perm;
};
struct Content{
char b_name[12];
int b_inodo;
};
struct BlockDirectory
{
Content b_content[4];
};
struct BlockFile
{
char b_content[64];
};
struct BlockPointer
{
int b_pointers[16];
};
class Journal{
public:
Operation j_operation;
char j_date[16];
char *j_path;
char *j_content;
char *j_user;
char *j_group;
int j_size;
int j_perms;
bool j_boolean;
Journal(){
this->j_operation = EMPTY;
//this->j_date = NULL;
this->j_path = NULL;
this->j_content = NULL;
this->j_group = NULL;
this->j_user = NULL;
this->j_size = -1;
this->j_perms = -1;
this->j_boolean = false;
}
};
class Sesion{
public:
char *user;
char *path;
char *namePartition;
char *id;
char *idUser;
char *idGrp;
Sesion(){
this->user = NULL;
this->path = NULL;
this->namePartition = NULL;
this->id = NULL;
this->idGrp = NULL;
this->idUser = NULL;
}
void clear(){
user = NULL;
path = NULL;
namePartition = NULL;
id = NULL;
this->idGrp = NULL;
this->idUser = NULL;
}
};
class User{
public:
std::string id;
char type;
std::string name;
std::string pwd;
std::string group;
};
class Group{
public:
std::string id;
std::string name;
};
#endif // STRUCTURES_H